Archived

This topic is now archived and is closed to further replies.

Is their a way to use PlaySound() to play 2 sounds at once?

This topic is 5674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When i use PlaySound or sndPlaySound ( pretty much the same thing but older ) and I have looping background music. When I play another sound the background music stops. Is their another way i could play sounds to fix this like use direct 3d sound.

Share this post


Link to post
Share on other sites
You need one buffer per sound playing.

You should write a wrapper for DSound to simplify everything. I have one function that plays a specific buffer number. On that loads the file on the fly to the first open buffer and plays it. And a few others.

Ben




IcarusIndie.com [ The Rabbit Hole | The Labyrinth | Programming | Gang Wars | The Wall | Hosting]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you want simpler than DirectSound (which I assume because you were using PlaySound) use the MCIWnd macros.

Share this post


Link to post
Share on other sites
oh im sure i could have used direct sound but ive never done it and i just wanted to throw in sounds and make them work. From the responses im assuming i cant do it in playsound(). Next time i will just spend the time to use direct sound.

Share this post


Link to post
Share on other sites
You might make your life easier by using DirectMusic instead. Starting with DX8 DirectMusic can handle both command-based and wave sounds, and makes the entire implementation rather simple. I was able to jump in and make a class to handle all music for a game I am working on in about 20 minutes, with no prior experience.

Share this post


Link to post
Share on other sites
MCIWnd is really easy to use. I coded a simple MFC dialog to play two mp3s at once, each one of which could be independently paused/resumed, with only a dozen lines of MCI code. DirectX Audio will most likely give you better performance, but it will require more effort as well.

Share this post


Link to post
Share on other sites