Archived

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

Kyo

I need help with MCI wave sound

Recommended Posts

I''m trying to make a sound class using MCI, so I can declare a simple sound using CSound snd, then load a .wav using snd.load(filename), play it using snd.play(loop or play once, start time, end time), and close it using snd.close(). Problem: To loop the sound I can only tell when the wav file finished by making it send an MM_NOTIFY (or something like that) message to a window proc, but I want my sound class to be totally separate I don''t want it to be linked with the window class or it''ll just create confusion. So I was thinking of letting the user specify the start and stop time when calling snd.play, and in the MCI_PLAY_PARMS dwFrom and dwTo I specify the start and end time in milliseconds of when it should play. Then a snd.update or something checks if the time has passed and if it has close the wav file and reopen it to play again. But it won''t start and stop at the times I set it to, if I use playParams.dwFrom = from; playParams.dwTo = to; where from and to are integers specifying the time in milliseconds. I already set the time format to MCI_FORMAT_MILLISECONDS before as well. And another problem is one CSound MCI device can only be associated with one wav file so I can''t have multiple CSounds for the same wav file, which is an annoying problem as if I have multiple CBomb classes each with a CSound in it for an explosion.wav, it gives me errors. If I make the CSound static then if several bombs explode at once you can only hear one at a time. This is my first time programming sound can anyone point me to other solutions not requiring OpenGL or DirectX please? Or is there a way using MCI?

Share this post


Link to post
Share on other sites