So, I'm building a threaded IMA ADPCM decoder streaming audio data to OpenAL (see below for short description) but I've run into some trouble.
One of my issues is that sometimes my call to alBufferData:
alBufferData(*bufferID, format, pcmData, sizeInBytes, bitRate);
returns AL_INVALID_VALUE
even though, when checking the parameters they look, e.g., like this:
bufferID='109770616', format='AL_FORMAT_STEREO16', dataPtr='109754188', sizeInBytes='8164'
Any clues, anyone? The actual sound being played sort of stutteres when this happens, and the error usually happens ~10 times in a row (on the same sound). It also usually happens when I repeatedly start the same sound (for example when shooting short bursts with an LMG... ;))
Quick simplified tour of the streaming-decoder-module-thing
How a sound gets played:
- A sound is triggered to play.
- One bufferSize worth of audio is decoded and the rest is queued for further decoding.
- OpenAL is triggered to start playing the sound.
The decoding/streaming loop
- For each sound queued for decoding, decode bufferSize worth of audio.
- The decoded audio is added to an alBuffer (see call above) with the appropriate bufferID.