Ich hab hier mal nen Mini-Beispiel ausgegraben...
Code: Alles auswählen
Global hMidiOut
#Channel1 = 1
#Channel2 = 2
#Channel3 = 3
#Channel4 = 4
#Channel5 = 5
#Channel6 = 6
Procedure MidiOutMessage(hMidi,iStatus,iChannel,iData1,iData2)
dwMessage = iStatus | iChannel | (iData1 << 8 ) | (iData2 << 16)
ProcedureReturn midiOutShortMsg_(hMidi, dwMessage) ;
EndProcedure
Procedure SetInstrument(channel,instrument)
MidiOutMessage(hMidiOut, $C0, channel, instrument, 0)
EndProcedure
Procedure PlayNote(channel,Note,velocity)
MidiOutMessage(hMidiOut, $90, channel, Note , velocity)
EndProcedure
Procedure StopNote(channel,Note)
MidiOutMessage(hMidiOut, $90, channel, Note , 0)
EndProcedure
midi.MIDIOUTCAPS
devices = midiOutGetNumDevs_()
For devnum=-1 To devices-1
If midiOutGetDevCaps_(devnum,@midi,SizeOf(MIDIOUTCAPS))=0
If midi\wVoices >0
midiport=devnum
EndIf
EndIf
Next
hMidiOut.l
If midiOutOpen_(@hMidiOut,midiport,0,0,0) = #MMSYSERR_NOERROR
; "25" = Akustische Gitarre
SetInstrument(#Channel1,25)
SetInstrument(#Channel2,25)
SetInstrument(#Channel3,25)
SetInstrument(#Channel4,25)
For a = 1 To 5
; normal sound
PlayNote(#Channel1,$2D,63)
PlayNote(#Channel2,$39,63)
PlayNote(#Channel3,$3C,63)
PlayNote(#Channel4,$40,63)
Delay (2000)
StopNote(#Channel1,$2D)
StopNote(#Channel2,$39)
StopNote(#Channel3,$3C)
StopNote(#Channel3,$40)
; this must be a staccato sound
PlayNote(#Channel1,$39,100)
PlayNote(#Channel2,$3C,100)
PlayNote(#Channel3,$40,100)
Delay (300)
StopNote(#Channel1,$39)
StopNote(#Channel2,$3C)
StopNote(#Channel3,$40)
Delay (200)
; this must be a muted sound
PlayNote(#Channel1,$2D,80)
PlayNote(#Channel2,$30,80)
PlayNote(#Channel3,$34,80)
Delay (300)
StopNote(#Channel1,$2D)
StopNote(#Channel2,$30)
StopNote(#Channel3,$34 )
Delay (285)
Next
; Zurücksetzen der Instrumente
SetInstrument(#Channel1,0)
SetInstrument(#Channel2,0)
SetInstrument(#Channel3,0)
SetInstrument(#Channel4,0)
; MIDI-Output schließen
midiOutClose_(hMidiOut)
EndIf
End
Vielleicht hilft's ja was...
Aber wie MIDI-Dateien aufgebaut sind.. ka