开发者

Sound Multithreading

I want to play sound while a game is running. I know how to play sound and run the game, but I can't do them at the same time. The DOS game pauses while the sound is playing. Here is the cpp code for the sound:

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

I don't know if it is a situation where开发者_StackOverflow社区 you have to multithread. I think I know what multithreading is but I'm not sure.


Playsound needs another flag to not run synchronously. Call it like this:

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

Notice that i have no idea how to stop the sound until it finishes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜