0

Tried looking for the answer but all I could find was to add another library like OpenAL and such. (all I use except windows.h is glut)

I wrote a multi thread program to check if it is possible that one thread will keep playing the main theme and the 2nd one will play the sound effects but unfortunately it does not work...

Adriano Repetti
  • 65,416
  • 20
  • 137
  • 208
Despairy
  • 13
  • 3

1 Answers1

0

Have you tried the MCI library?

http://msdn.microsoft.com/en-us/library/windows/desktop/dd742874(v=vs.85).aspx

Here's how I do it:

mciSendString(L"open ../mp3/announce_start.mp3 alias announce", 0, 0, 0 );
mciSendString(L"play announce wait", 0, 0, 0 );

If you want your sound file to repeat, try

mciSendString(L"play announce repeat wait", 0, 0, 0 );
ravenspoint
  • 19,093
  • 6
  • 57
  • 103
  • After trying a few codes myself (still hardly understand the syntax) I've found a few bits of code here and there and collected them to the following : ( not working - so what is left to add? ) thanks `TCHAR achCommandBuff[128]; int result; MCIERROR err; LPTSTR lpstrAlias=LPTSTR("music.wav"); // Form the command string. result = swprintf_s( achCommandBuff, TEXT("play %s"), lpstrAlias); err = mciSendString(achCommandBuff, NULL, 0, NULL); ` – Despairy Mar 12 '13 at 20:33
  • I cannot make out the code squished into your comment. It look like maybe you forgot to open your sound file. – ravenspoint Mar 12 '13 at 20:42
  • Thanks, it works like charm ( needed to change a few things so it would work as I want - but great! ) Only left to figure out if there is a loop command to be added. so far by my findings there is no command similar to repeat or replay . but since its on PlaySound I guess there must be one out there. thanks again :) – Despairy Mar 12 '13 at 21:01
  • Thanks again , I tried something like that it didnt work so I had to use SEEK to start every now and then for it to work :) – Despairy Mar 12 '13 at 21:31