Archived

This topic is now archived and is closed to further replies.

CO

Play midi music

Recommended Posts

CO    122
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!

Share this post


Link to post
Share on other sites
Naveed Ahmed    122
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.

Share this post


Link to post
Share on other sites
CO    122
How could I check it? There is no handle??
Could you give me some code examples (please... I want to publish my game so soon as possible)

Were could I download your Dream demo? (with sourde-code?)


Chris

Share this post


Link to post
Share on other sites