03-24-2005, 05:32 AM
Code:
Declare Function midiOutClose Lib "winmm" (ByVal hMidiOut As Integer) As Integer
Declare Function midiOutGetVolume Lib "winmm" (ByVal uDeviceID As Integer, ByRef lpdwVolume As Integer) As Integer
Declare Function midiOutMessage Lib "winmm" (ByVal hMidiOut As Integer, ByVal msg As Integer, ByVal dw1 As Integer, ByVal dw2 As Integer) As Integer
Declare Function midiOutOpen Lib "winmm" (ByRef lphMidiOut As Integer, ByVal uDeviceID As Integer, ByVal dwCallback As Integer, ByVal dwInstance As Integer, ByVal dwFlags As Integer) As Integer
Declare Function midiOutReset Lib "winmm" (ByVal hMidiOut As Integer) As Integer
Declare Function midiOutSetVolume Lib "winmm" (ByVal uDeviceID As Integer, ByVal dwVolume As Integer) As Integer
Declare Function midiOutShortMsg Lib "winmm" (ByVal hMidiOut As Integer, ByVal dwMsg As Integer) As Integer
' MIDI Mapper
Const MIDI_MAPPER As Byte = -1
' MIDI Controller Numbers Constants
Const MOD_WHEEL As Byte = 1
Const BREATH_CONTROLLER As Byte = 2
Const FOOT_CONTROLLER As Byte = 4
Const PORTAMENTO_TIME As Byte = 5
Const MAIN_VOLUME As Byte = 7
Const BALANCE As Byte = 8
Const PAN As Byte = 10
Const EXPRESS_CONTROLLER As Byte = 11
Const DAMPER_PEDAL As Byte = 64
Const PORTAMENTO As Byte = 65
Const SOSTENUTO As Byte = 66
Const SOFT_PEDAL As Byte = 67
Const HOLD_2 As Byte = 69
Const EXTERNAL_FX_DEPTH As Byte = 91
Const TREMELO_DEPTH As Byte = 92
Const CHORUS_DEPTH As Byte = 93
Const DETUNE_DEPTH As Byte = 94
Const PHASER_DEPTH As Byte = 95
Const DATA_INCREMENT As Byte = 96
Const DATA_DECREMENT As Byte = 97
' MIDI status messages
Const NOTE_OFF As Byte = &H80
Const NOTE_ON As Byte = &H90
Const POLY_KEY_PRESS As Byte = &HA0
Const CONTROLLER_CHANGE As Byte = &HB0
Const PROGRAM_CHANGE As Byte = &HC0
Const CHANNEL_PRESSURE As Byte = &HD0
Const PITCH_BEND As Byte = &HE0
? "Hi"
'The handle to the midi device
dim hMidi as integer
'the midi handle
'the midi device you want to use in this case the default Windows Midi_Mapper
'A callback function ... not being used here
'A callback Instance ... not being used here
'Flag, here its just CALLBACK_NULL ... i.e. not being used here
midiOutOpen hmidi, MIDI_MAPPER, 0, 0, 0
sleep
midiOutClose hmidi
sleep
When I run this I get this:
Code:
c:\freebasic\midi_test_01.asm Assembler messages:
c:\freebasic\midi_test_01.asm:35:Error:suffix or operands invalid for 'movsx' on line:
I spent all day working up a lovely c++ bit to do Sound and Midi commands using the cross-platform, open source, Synthesis ToolKit (STK). I learned how to send midi messages, generate all kinds of tones, and have nice functions for each. I go to make a DLL and it won't work (works fine as a C++ console app). I realize that I am the worlds worse C programmer so I do the sensible thing and curse for a while and decide to do the midi stuff in Windows, in FB, with the winmm library.... and now this.
Sorry for the venting.