How to play mp3 repeatedly
-
To play mp3, I use MCIWndPlay macro. I want to make the tune to be played repeatedly until user wants a stop. Does anyone know how to do it?
-
(I am bing daft here - I have not much knowledge of mm programming.) I wanted to use mci functions but hit a rock, because I do not know how to retrieve device id, and the device id is required to send the commands. Can you shed some light or point me to relevent sites? I tried but could not find any example telling me how to get the id, i.e. what name should I use in MCIDEVICEID mciGetDeviceID( LPCTSTR lpszDevice ); I think once I know how to retrive the device Id I should be able to cook. PS I looked at the system.ini file, as a few internet findings suggest, but found nothing under the [mci] section.
-
(I am bing daft here - I have not much knowledge of mm programming.) I wanted to use mci functions but hit a rock, because I do not know how to retrieve device id, and the device id is required to send the commands. Can you shed some light or point me to relevent sites? I tried but could not find any example telling me how to get the id, i.e. what name should I use in MCIDEVICEID mciGetDeviceID( LPCTSTR lpszDevice ); I think once I know how to retrive the device Id I should be able to cook. PS I looked at the system.ini file, as a few internet findings suggest, but found nothing under the [mci] section.
Assuming you know the name of the .mp3 file (I'm boldly assuming it's a file), you can simply do:
// Start playing the file
char szMp3File [MAX_PATH];
strcpy (szMp3File, "C:\\myFile.mp3");
VERIFY (::sndPlaySound (szMp3File, SND_LOOP | SND_ASYNC));...
// Stop playing the file
VERIFY (::sndPlaySound (NULL, 0));/ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com
-
Assuming you know the name of the .mp3 file (I'm boldly assuming it's a file), you can simply do:
// Start playing the file
char szMp3File [MAX_PATH];
strcpy (szMp3File, "C:\\myFile.mp3");
VERIFY (::sndPlaySound (szMp3File, SND_LOOP | SND_ASYNC));...
// Stop playing the file
VERIFY (::sndPlaySound (NULL, 0));/ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com
I tried the sndPlaySound(...) and passed in a .mp3 file but the mp3 file did not get played. instead, a wav file was played. I guess it is because this func works only for wav file so a default sound was played rather than the mp3 specifed. In fact before I use the mp3, I was playing a wav file instead, using the PlaySound(...), which is similar to this one you suggested. I thought I should move up the ladder a bit by tackling more advanced multimedia stuff, which means the application can be more flexible. This is the background info of how I got here... Do u happed to know how to get device id? It is really nice to know.
-
I tried the sndPlaySound(...) and passed in a .mp3 file but the mp3 file did not get played. instead, a wav file was played. I guess it is because this func works only for wav file so a default sound was played rather than the mp3 specifed. In fact before I use the mp3, I was playing a wav file instead, using the PlaySound(...), which is similar to this one you suggested. I thought I should move up the ladder a bit by tackling more advanced multimedia stuff, which means the application can be more flexible. This is the background info of how I got here... Do u happed to know how to get device id? It is really nice to know.