GetCue - Duplicates Sound Buffer?
Hi all, I've been checking out XACT/XNA a bit recently but wasn't going to commit to it just yet on my current project. That is until I just ran into a huge issue - I'm using Managed DirectSound in C# but don't see an equivalent to the C++ IDirectSound8::DuplicateSoundBuffer() function. I need to be able to load wave data once and play the same data into the primary mixer multiple times which simply doesn't seem possible in Managed DirectSound.
So my question is - when you call GetCue and play it, can you do this multiple times for the same cue and play it simultaneously multiple times? Or does calling GetCue for a specific cue name always return the same object like a singleton? If I call GetCue and then Play twice sequentially on the same cue will it play twice mixed (what I want) or only once? If there is no way to easily play the same main memory buffer multiple times as a separate voice in the mixer I guess I'll have to go back to using C++.
[979 byte] By [
guile0] at [2008-2-10]
Managed DirectSound does have an equivalent to the DuplicateSoundBuffer functionality - check out the Buffer.Clone() and SecondaryBuffer.Clone() methods.
However, XACT is more actively developed and supported nowadays than DirectSound, so if you find that it meets your needs I would encourage you to use it instead of DirectSound. It provides a lot of higher-level functionality that DirectSound lacks.
Dugan Porter - Game Audio Team - Microsoft
This posting is provided "as is" with no warranties, and confers no rightsI forgot to say that yes, you can do what you want in XACT. The same cue instance cannot be played more than once, but you can call IXACTSoundBank::Prepare more than once for the same cue index, and then each IXACTCue obtained will act as a separate stream but use the same source data.
Thanks for the answer, I eventually did find Clone on my own... it really should have been obvious, but for some reason I just assumed that was a base object clone method that wouldn't have been handled properly by DirectSound. Doh! Thanks again for the clarification.