Hi
I am reading up on XAudio2 and I have some questions.
So the pipeline is as follows:
pBuffer(RAM) -> Source Voice -> Mixer Voice -> Master Voice -> Sound Adapter.
Data is loaded to RAM in a special way. You get a pointer to the audio pBuffer. This is then submitted to a source voice which can then start().
My question regards how to manage buffers and Source voices.
Lets say I have a sound effect that consist of 5 short sounds to be played in a distinct sequence. I would then have one buffer for each sound, submit them to 5 different Source voices. Confiugre the source voices with different delays, then use the start() method on all 5 source voices.
So far so good.
But, if I have 100 sound effects, each having 5 short sounds in them. Should I make 500 Source voices, one for each buffer in RAM? Or, should I only have as many as I need playing at the same time? Say 50, for max 10 sound effects?
For c++, I would think that a sound (pBuffer) could be wrapped in its own class called ShortSounds. Then have SoundEffect class which holds many ShortSounds instances (std::vector<*ShortSound>). Then the Audio class would have many SoundEffects (std::map<*SoundEffect>).
Then I could just call the method Audio::Play(EffectID).
Is this a good idea?