Looping and buffer queuing

Carsten Fuchs <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
Dear OpenAL list,

I'm currently trying to find a good solution for the "worst" case with buffer queuing, where all 
buffers are processed before the application had a chance to enqueue more buffers.

The "normal" behaviour in this case is that the source enters state AL_STOPPED, and it can be 
difficult to learn later whether this state was entered as a result of all buffers were 
processed or from an explicit call to alSourceStop().
(One solution might be to duplicate and keep the source state ourselves, but that comes with 
it's own set of problems, e.g. think of non-queued buffers that are assigned with alSourcei().)

When I found in the OpenAL 1.1 spec that

"AL_LOOPING is a flag that indicates that the source will not be in AL_STOPPED state once it 
reaches the end of last buffer in the buffer queue."

I thought it might be a good idea to combine AL_LOOPING with buffer queueing in order to avoid 
the problematic buffer "underrun" as outlined above.


Well, I found that if AL_LOOPING is activated, the query for AL_BUFFERS_PROCESSED always returns 
0 (tested with both the Windows SDK as well as with OpenAL-Soft on Linux).
That is, in order to "circumvent" this, on each OpenAL "update" in the "master game loop", we 
have to disable looping first, then query for the number of buffers processed, possibly re-queue 
more/reused buffers, then enable looping again.

At the same time, although the observed behaviour (buffers_processed==0 while looping==true) 
seems correct, the spec says nothing else about the behaviour of the buffer queue while looping 
is enabled. For example, my first assumption was that when you have five buffers enqueued and 
looping is enabled, the first four will be processed and reportet as usual, and looping only 
occurs over the fifth buffer.


Considering all this, is this combining of looping with buffer queuing generally a recommended 
and practiced idea (when the main goal is to avoid accidentally entering the AL_STOPPED state)?
Anything else we should take into account? Additional or alternative considerations?

I'd be very grateful for thoughts/feedback.  :-)

Best regards,
Carsten



-- 
    Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
           Learn more at http://www.cafu.de

_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
smime.p7s (application/pkcs7-signature, 5 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.