OpenAL: alBufferData returns AL_INVALID_VALUE, although the input variables * look * OK?

So, I am creating a streaming IMA ADPCM decoder that transmits audio data to OpenAL (see brief description below), but I ran into some problems.

One of my problems is that sometimes my call to alBufferData is:

alBufferData(*bufferID, format, pcmData, sizeInBytes, bitRate);

returns AL_INVALID_VALUE , although when checking the parameters they look, for example, as follows:

bufferID='109770616', format='AL_FORMAT_STEREO16', dataPtr='109754188', sizeInBytes='8164'

Any clues, anyone? The actual sound is played in the form of stuttering when this happens, and the error usually occurs ~ 10 times in a row (on the same sound). This also usually happens when I repeatedly play the same sound (for example, when shooting short bursts using LMG ...;))

Quick simplified stream-decoder-module tour

How is the sound reproduced:

  • Sound starts to play.
  • One sound in bufferSize format is decoded, and the rest are queued for further decoding.
  • To start sound playback, OpenAL is launched.

Decoding / Streaming Cycle

  • For each sound placed in the queue for decoding, decodes the buffer value of the sound.
  • The decoded sound is added to alBuffer (see call above) with the corresponding buffer identifier.
+4
source share
1 answer

If it's not too late, I will tell you about similar problems that I had with BufferData, and here is how I fixed it. Although, keep in mind, I do not know the specifics of your streaming program.

The invalid value is returned for a number of reasons, the ones I know of are ...
-Queuing new buffers (to the streaming source) if the source already has the assigned bufferID (because it is set to static if you set the buffer identifier). If so, remove the identifier in the original property.
-Change the buffer format in the middle of playback. You cannot change the buffer settings (fmt, samplerate), except for the buffer data itself, as soon as the source starts playing, even if it is in a different queue.

It looks like you can change one of these options in another thread.

Another thing that can cause bursts is sound reproduction. A playback call stops the cold source again, then rewinds the current buffer and starts playback from the very beginning. Playing a sound gun doesn't seem to be what you want (on a layer, I guess). 2, mix the remaining gun sound into the buffer, and then play it, but this may not work. another proof of the fool is simply the use of several sources and the turn that each firearm triggers.

good luck with your project.

+3
source

All Articles