XAudio2 - Multiple instances of the same sound
Posted
by
Boreal
on Game Development
See other posts from Game Development
or by Boreal
Published on 2012-06-05T20:30:13Z
Indexed on
2012/06/05
22:48 UTC
Read the original article
Hit count: 383
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.
The exception occurs on line 156 when I am playing the sound:
source.SubmitSourceBuffer(buffer);
© Game Development or respective owner