PDA

Click to See Complete Forum and Search --> : midiOut API - change instrument


Dougs3761
Apr 1st, 2001, 10:22 PM
I have created a program to simply playa single MIDI note, I will later add several to play songs. I have so far been able to play a note as well as a song and it works very well, however, I am stuck with the Grand Piano! I would like to know how to change the instrument as well as (if possible) get a list of instruments.

==

==Form1
Dim hMIDI, MIDIMSG As Long Private Sub Command1_Click()
midiOutOpen hMIDI, 0, 0, 0, 0
MIDIMSG = 144 + (60 * 256) + (127 * 65536) + 0
midiOutShortMsg hMIDI, MIDIMSG
midiOutClose hMIDI
End Sub

==The equation (I found this from Microsoft corp @ http://support.microsoft.com/support/kb/articles/Q181/3/60.asp)
MIDIMSG = &H90 + (intNote * &H100) + (intVolume * &H10000) + intChannel
midiOutShortMsg hMIDI, MIDIMSG

==Module1
Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long
Declare Function midiOutOpen Lib "winmm.dll" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long

==

Thank you for your time and help!

Dougs3761
Apr 5th, 2001, 09:12 PM
Thanks to anyone who read this. I have gotten an answer, however, from Microsoft Corp help.

Thank you

parksie
Apr 6th, 2001, 12:20 PM
Here's a good resource for MIDI: http://www.borg.com/~jglatt/tech/midispec.htm