i`m trying to implement a background music loop and do other sounds that wont cut it when I use the "PlaySound" function again.
void CcpPongView::playBGsound(int num)
{
//added in the linker to additional name : winmm.lib
if(num)
PlaySound(L"sound.wav", NULL, SND_LOOP | SND_ASYNC);
}
void CcpPongView::initGame()
{
std::thread test (playBGsound, 1);
test.join();
}
this is the second place I use Playsound
void Ball::playSound()
{
switch (rand()%2) {
case 0:PlaySound(sounds[0], NULL, SND_FILENAME | SND_ASYNC);
break;
case 1:PlaySound(sounds[1], NULL, SND_FILENAME | SND_ASYNC);
break;
}
im not sure where I need to place the thread or how to make a thread in mfc Single Document.. (the "num" was to test)
if there is another way to do it i`m all ears
thanks for the help every one :)