I am writing a sound engine for my game. I want it to be able to play several static and streaming voices.
I want to be able to set the voice volume, pitch and channel volume matrix.
My approach is to create a combination of audio_render, audio_decode and audio_mixer components, connect them with tunnels and supply with wave buffers.
Can somebody help me with the following please?
- Is it the correct approach to allocate all those components for every voice? I plan to allocate them only when the voice is really playing (I measured and I can only allocate around one hundred of them at once).
- How can I change the pitch of the sound in a realtime (eg. when sound is already playing).
- I want to be able to loop static voices. I tried to submit buffer again in EmptyBufferDone callback but it caused hardware error. Is there a way to play one buffer several times without much effort (without allocating a thread to watch when buffer playback is completed)?