Multithreading sound

I want to play sound during the game. I know how to play sound and run the game, but I cannot do it at the same time. DOS game pauses during audio playback. Here is the cpp code for the sound:

void watersplashsound()
{PlaySound(TEXT("waterSPLASH.wav"), NULL, SND_FILENAME);}

I do not know if this is a situation where you have multithreading. I think I know what multithreading is, but I'm not sure.

+3
source share
1 answer

Playsoundyou need another flag that will not run synchronously. Call it that:

void watersplashsound()
{
  PlaySound(TEXT("waterSPLASH.wav"), NULL, SND_FILENAME | SND_ASYNC);
}

Please note: I do not know how to stop the sound until it ends.

+2
source

All Articles