Looping sound with mciSendString

How to do it? I want it to loop it forever. Just that. Loops and loops. But to still play it in the background, obviously!
Last edited on
It should just be as simple as adding the "repeat" flag to your "play" command. But it doesn't work for me for some reason. :-(

But I remember it used to, and there are plenty of examples of this use on the web, inc.

How to Perform Auto Repeat as Media Player Does
http://support.microsoft.com/kb/124185

mciSendString("play mov notify repeat", NULL, 0, hWnd);

I just mis-assumed it'd still work!

If the repeat flag doesn't work for you, it might mean you have to ove to a different API.

Andy

See MSDN for further information:

play command
http://msdn.microsoft.com/en-us/library/windows/desktop/dd743667%28v=vs.85%29.aspx
Last edited on
That's awesome! Thanks!
So if i write:
mciSendString("play C:\\Sound.mp3 repeat",0,0,0);
It should work? Or is it
mciSendString("play repeat C:\\Sound.mp3",0,0,0);

PD: Is it possible to change the volume? I don't need that, but it would be something interesting to know.
repeat should be after the media name.

I do prefer to open with an alias, and then play, as this simplifes all sunsequent command (esp. if you want to parameterize the media file)

The setaudio MCI command can be used to set the volume. Look for "volume" in the following article.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd798662%28v=vs.85%29.aspx
Last edited on
Topic archived. No new replies allowed.