« Return to Thread: Problem with alSourceUnqueueBuffers

Re: Problem with alSourceUnqueueBuffers

by qartar :: Rate this Message:

Reply to Author | View in Thread

Daniel PEACOCK wrote:
What OpenAL device are you using, and which OS and soundcard?
OpenAL driver information...
Vendor   : Creative Labs Inc.
Renderer : Software
Version  : 1.1

Daniel PEACOCK wrote:
Buffer underrun is the most likely problem I think.  In your testing are
you able to confirm that Buffers Processed never returns the same number of
Buffers that are actually queued on the Source at the moment?
Yes, confirmed it just now.

Daniel PEACOCK wrote:
For the first iteration how many Buffers are you filling with the 2205
samples?
One buffer.

Daniel PEACOCK wrote:
Are you using get playback offset to determine how many samples to fill?
I would recommend using a fixed buffer size for the streaming operations
rather than trying to compute how many samples have been played.   The get
sample offset call is tricky to use because it returns an offset from the
start of the buffer queue - not the offset in the current buffer.   So, I
would use, say 4 x 25ms buffers and as and when a buffer is processed,
unqueue it, fill it with 25ms of audio data, and requeue it.
Yes, with alGetSourceiv( source, AL_SAMPLE_OFFSET, &samplePos ). If I recall correctly, the function returns the sample offset from the beginning of playback, which would include buffers processed, not just the buffers queued. Is there an issue with buffers if they are uploaded with different lengths of data?

Daniel PEACOCK wrote:
So if you keep generating, filling, and requeueing new Buffers the Source
keeps playing without any problems?  Does it play without glitches?  Some
implementations of OpenAL enable a starved Source to automagically restart
playing if the application never actually queries the playback state and
just queues new buffers on it.
Yes, if I generate new buffers every iteration instead of trying to reuse processed buffers the source plays with zero problems, this is why I don't think it is an underrun issue. On the other hand, I have put queries before and after the calls to unqueue and queue and it reports that the source is still playing.

 « Return to Thread: Problem with alSourceUnqueueBuffers