I've looked almost everywhere, but all the API calls (PlaySound etc) sem to be geared towards *.wav files. So how do I play a MIDI with the API? Do I HAVE to use MMControl?
Printable View
I've looked almost everywhere, but all the API calls (PlaySound etc) sem to be geared towards *.wav files. So how do I play a MIDI with the API? Do I HAVE to use MMControl?
I expect you could do that using DirectMusic. I have no experience of using DirectX but a lot of the regulars of the games forum do, so maybe it would be a good idea to post ther too. KENNNY posted a good link the other day for tutorials on games-related VB programming, and there was quite a bit on DirectX there. The link was in a post titled 'im a beginner' in the games and graphics forum, I can't remember it now.
The code looks like this:
In your General Declarations:
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
(all of the above is one really long line)
In the sub where the MIDI will be launched:
'ret = mciSendString("open PATHNAME type sequencer alias myfile", 0&, 0, 0)
ret = mciSendString("play myfile wait", 0&, 0, 0)
ret = mciSendString("close myfile", 0&, 0, 0)
(where I typed PATHNAME, replace it with the full pathname or default path to your Midi file, e.g. c:\midis\xxx.mid)
That's all