Jump to content
  • Advertisement
Sign in to follow this  
GroZZleR

Managed DirectSound - Multiple Instances Of The Same Sound

This topic is 4713 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

Hey all, What's the most efficient way to play the same wav file at the same time? Is manually reading in wav files into streams and keeping track of those, then creating new SecondaryBuffers (if none non-playing ones available) the way to go? I tried just creating an abundant amount of SecondaryBuffers using a filename, but I believe this to be loading the file every time because my FPS cut from 1K to 100. ;) If anyone has any insights before I jump into manual wav loading, I'd love to hear 'em.

Share this post


Link to post
Share on other sites
Advertisement
"Non-managed" DirectSound has the function: IDirectSound8::DuplicateSoundBuffer(). I would expect managed DirectSound to have the same function somewhere. Don't know the specifics on how it works, but it doesn't duplicate the sound memory itself, just the interface to it so you can play multiple instances of the same sound by duplicating the buffer for each additional instance.

As for wav loading, again for "Non-managed" DirectX the nice people at Microsoft wrote a "CWave" class that wrapped up wav loading. Perhaps there is also a "CWave" class for managed DirectX? Dig around the samples folder.

Share this post


Link to post
Share on other sites
Thanks load_bitmap_file, the Clone() method of the SecondaryBuffer seems to do exactly what you suggest and doesn't seem to kill my frame-rate, so it must be just copying over the properties and not the data itself as you say.

Cheers.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!