PDA

Click to See Complete Forum and Search --> : Play Midi file without wait....


wengang
Apr 15th, 2000, 11:47 PM
If anyone knows how to play a MIDI file during a game without stopping the game, please do let me know. Thanks.

KENNNY
Apr 16th, 2000, 05:01 AM
yeah, use DirectMusic, assuming your game is DirectX.
Otherwise, can't you use MciExecute or something?

wengang
Apr 16th, 2000, 05:31 AM
Well, it isn't DirectX (which I still don't know how to use). I am using this one that I found in a FAQ on another website:
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

Dim ret As Long
(and in the sub)
ret = mciSendString("open c:\midi\myfile.mid type sequencer alias myfile", 0&, 0, 0)
ret = mciSendString("play myfile wait", 0&, 0, 0)
ret = mciSendString("close myfile", 0&, 0, 0)

The problem is with the "WAIT" command the Midi starts when the game starts and then control is not returned to the game until the MIDI finishes. When the "WAIT" is taken out, it simply doesn't play the MIDI. Any thoughts?