Is their a way to use PlaySound() to play 2 sounds at once?
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.
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]
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]
If you want simpler than DirectSound (which I assume because you were using PlaySound) use the MCIWnd macros.
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement