amram71
08-30-2000, 07:18 PM
How the *beep* do I use Midi api.
What I really want to know is where to store the sounds. I downloaded the Drum Machine at Planet-Source-Code. (contest winner)
If anyone can take the time to tell me where all the sounds are stored in that app, i would appreciate it. thankx
BillSoo
08-31-2000, 05:36 PM
I took a quick look at the code and it appears that the sounds are stored in an array:
' Application Defined Structure Used For Playback, Editing etc...
Type Kit
bNoteOn As Boolean
PercName As Integer
PercVol As Integer
MidiMsg As Long
End Type
' Massive Array Of 100, 16 Step Pattern,s (16 Track... Rows Are Tracks).
Public Ptrns(15, 1599) As Kit
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
amram71
08-31-2000, 10:13 PM
I saw that, but how are the sounds of each instrument stored in the array. Does the computer have each sound stored in Memory?
BillSoo
09-01-2000, 01:09 PM
This code in the mnuNew_Click event seems to populate the array:
...
' Build The Default Pattern Array.
For R = 0 To 15
Select Case R
Case 0: N = 35
Case 1: N = 37
Case 2: N = 38
Case 3: N = 39
Case 4: N = 40
Case 5: N = 42
Case 6: N = 44
Case 7: N = 46
Case 8: N = 45
Case 9: N = 47
Case 10: N = 48
Case 11: N = 50
Case 12: N = 49
Case 13: N = 51
Case 14: N = 54
Case 15: N = 56
End Select
For C = 0 To 1599 ' 100, 16 Step Patterns In One BIG Array.
Ptrns(R, C).bNoteOn = False
Ptrns(R, C).PercVol = 127
Ptrns(R, C).PercName = N
Ptrns(R, C).MidiMsg = &H7F0099 + (N * &H100)
Next
Next
...
MidiMsg seems to contain the info for generating the sound.
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder