XAudio2 - Multiple instances of the same sound
- by Boreal
Right now, I'm adding a rudimentary sound engine to my game. So far, I am able to load in a WAV file and play it once, then free up the memory when I close the game. However, the game crashes with a nice ArgumentOutOfBoundsException when I try to play another sound instance.
Specified argument was out of the range of valid values.
Parameter name: readLength
I'm following this tutorial pretty much exactly, but I still keep getting the aforementioned error. Here's my sound-related code.
http://pastebin.com/FgaqfXTs
The exception occurs on line 156 when I am playing the sound:
source.SubmitSourceBuffer(buffer);