[Openal] Notification of buffers being processed

Chris Double chris.double at double.co.nz
Sun Apr 1 18:02:02 PDT 2007


Is there a way to tell if buffers in a queue have been processed other
than polling AL_BUFFERS_PROCESSED?

I've written a Vorbis and Theora player in the Factor programming
language [1] and am using Open AL for the sound. I have two buffers
that I use for storing the sound data. While one is playing I fill the
other with data.

At some point I have decoded Vorbis data available but both buffers
are still queued. At this point I'd like to give up CPU timeslices
until one of the buffers is available to fill with the data. Currently
I enter a loop querying AL_BUFFERS_PROCESSED and sleep for a few
milliseconds if none are processed.

Is this a good approach? Or is there a better way? If it is a
reasonable approach is there a way of calculating an optimal time to
sleep?

[1] http://www.bluishcoder.co.nz/2007/03/ogg-vorbis-support-for-factor.html

Chris.
-- 
http://www.bluishcoder.co.nz


More information about the Openal mailing list