>>891
#include once "windows.bi"
#include once "win\mmsystem.bi"

type MidiMessage field=1
Number as UByte
ParmA as UByte
ParmB as UByte
Reserved as UByte
end Type

#define MidiSendMessage(MSGVAR) midiOutShortMsg(MYPLAYDEVICE, *cptr(integer ptr,@MSGVAR))
dim shared as HMIDIOUT MYPLAYDEVICE '// MIDI device interface for sending MIDI output
var FLAG = midiOutOpen(@MYPLAYDEVICE, MIDI_MAPPER, 0, 0, null)
if (FLAG <> MMSYSERR_NOERROR) Then
print "Error opening MIDI Output."
end If

Dim Shared as MidiMessage MidiMsg
MidiMsg.Reserved = 0
Sub NoteOn(channel As UByte, note As UByte, velocity As UByte)
MidiMsg.Number = &h90 + (channel And &hf)
MidiMsg.ParmA = (note And &h7f) 'NOTE
MidiMsg.ParmB = (velocity And &h7f) 'volume
MidiSendMessage(MidiMsg)
End Sub

Dim I As Integer
For I =1 To 50
NoteOn(0,I,127)
Sleep 200
Next I