Managed DirectSound - Multiple Instances Of The Same Sound

Started by
1 comment, last by GroZZleR 18 years, 9 months ago
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.
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.
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.

This topic is closed to new replies.

Advertisement