Sign in to follow this  
GroZZleR

Managed DirectSound - Multiple Instances Of The Same Sound

Recommended Posts

GroZZleR    820
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
"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
GroZZleR    820
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this