Play midi music
I know this isn''t a directly OpenGL problem, but it''s urgently (want to publish my new OpenGL game ''Invasion2'')
and I think when I could get somewere help then here!
I need some functions to play midi music.
At the moment I use this function (from Windows):
DWORD playMidi(LPSTR lpszMIDIFileName)
{
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_PLAY_PARMS mciPlayParms;
mciOpenParms.lpstrDeviceType = "sequencer";
mciOpenParms.lpstrElementName = lpszMIDIFileName;
if (dwReturn = mciSendCommand(NULL, MCI_OPEN,
MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,
(DWORD)(LPVOID) &mciOpenParms)) return (0);
mciPlayParms.dwCallback = NULL;
if (dwReturn = mciSendCommand(mciOpenParms.wDeviceID, MCI_PLAY, MCI_NOTIFY,
(DWORD)(LPVOID) &mciPlayParms))
{
mciSendCommand(mciOpenParms.wDeviceID, MCI_CLOSE, 0, NULL);
return 0;
}
return 1;
}
But when the music is completed I want that it is played automatically again...
and this isn''t done and I couldn''t find out if the music is complete or not!
Please help my! Thanks!
You can''t make it play automatically, you need to check status of MIDI at every iteration of your main loop, check if it is stopped, I think status is 3 for stopped, then you have to replay it.
Check my Dream demo, I''ve used this technique for playing Midi.
Check my Dream demo, I''ve used this technique for playing Midi.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement