[Openal-devel] Questionable "invalid value" from
alSourceUnqueueBuffers
Chris Robinson
chris.kcat at gmail.com
Tue Aug 11 04:37:09 PDT 2009
On Monday 10 August 2009 11:37:46 pm Jan Wassenberg wrote:
> I'm working on sound for the 0 A.D. project (www.wildfiregames.com/0ad)
> and have encountered an error on OpenALsoft implementations of OpenAL. The
> first time alSourceUnqueueBuffers is called upon to unqueue a single
> buffer, it raises an "invalid value" error, but not subsequently.
>
> My understanding of the OpenAL Programmer's Guide (revision 1.2) is that
> alSourceUnqueueBuffers fails with "invalid value" iff a buffer can't be
> unqueued because it had yet to be processed. However, we are first
> checking alGetSourcei AL_BUFFERS_PROCESSED and receiving a nonzero count
> for that source.
Hi.
Looking at the call trace, it appears you initially set the source as looping,
then unset the looping flag before trying to unqueue the buffer.
The issue is, while the source is marked as looping it won't set any buffers
as processed. Once looping is unset, OpenAL Soft will tell you how many
buffers have been played, but their internal status won't have been marked as
processed yet. So if:
alSourcei(source, AL_LOOPING, AL_FALSE);
alGetSourcei(source, AL_BUFFERS_PROCESSED, &count);
if(count > 0)
alSourceUnqueueBuffers(source, 1, &buffer);
runs before the mixer next updates the source, AL_BUFFERS_PROCESSED will see
finished buffers that aren't marked as processed. Oddly, I can't see how this
would happen in your snd_mgr.cpp, but that's what I'm seeing in the trace.
So there is a bug in OpenAL Soft which could cause it to report processed
buffers that aren't marked processed yet, when the loop flag is toggled off.
But if possible, you shouldn't set the source as looping if you're going to
unqueue buffers from it.
> If it helps, our interface to OpenAL can be viewed at
> http://trac.wildfiregames.com/browser/ps/trunk/source/lib/res/sound/snd_mgr
>.cpp
As an aside, it looks like there might be an issue in vsrc_latch. If a source
is used and made relative, its rolloff factor is set to 0. But if the source
is re-used and made not relative, its rolloff factor will be left at 0.
More information about the Openal-devel
mailing list