
HELP: Can't play MIDI and WAV at same time
HELP!!!!
I can't play a midi file and wave file at the same time. Here is my code:
Private Declare Function mciSendString Lib "winmm.dll" Alias
"mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As
String, ByVal uReturnLength As Integer, ByVal hWndCallback As Integer) As
Long
Private Declare Function mciGetErrorString Lib "winmm.dll" Alias
"mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String,
ByVal uLength As Long) As Long
SSResult = mciSendString("close mymid", ReturnString, LenStr, 0)
SSResult = mciSendString("open c:\windows\media\canyon.mid type
sequencer alias mymid", ReturnString, LenStr, 0)
SSResult = mciSendString("play mymid from 1", ReturnString, LenStr, 0)
SSResult = mciSendString("close mywav", ReturnString, LenStr, 0)
SSResult = mciSendString("open c:\windows\media\chimes.wav type
waveaudio alias mywav wait", ReturnString, LenStr, 0)
SSResult = mciSendString("play mywav from 1", ReturnString, LenStr, 0)
SSResult = mciSendString("close mywav", ReturnString, LenStr, 0)
SSResult = mciSendString("close mymid", ReturnString, LenStr, 0)
When I try it, it plays the midi file, then when it gets to "play mywav from
1" it returns the error code for "MMSYSTEM320 All wave devices that can play
files in this format are in use. Try again when a wave device is free."
(which I converted using the GetStringError function).
It also doesn't work for playing midi files this way and using sndPlaySound
function!!!!!!! What would be the solution!?!? I need help ASAP (hopefully
today). Thanks in advance.
Natman