[Openal] Notification of buffers being processed

Daniel PEACOCK dpeacock at creativelabs.com
Mon Apr 2 18:29:00 PDT 2007





Hi Chris,

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

No there isn't.

> 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?

Is your code that checks for Processed Buffers in a separate thread ?
That's normally a good way of handling streaming.  You can of course
calculate the duration of your Buffers if you know the sample format and
rate (and pitch if you are setting that parameter) .. but expect some
error, due to things like latency.   The amount of time to sleep will be
dependent on the duration of your Buffers.  e.g If you have 2 Buffers of
0.5 seconds, I would check the Buffers Processed every 100ms or so, so that
your Source continues to playback even if you miss a couple of timer
callbacks.

Dan

Notice
The information in this message is confidential and may be legally
privileged.  It is intended solely for the addressee.  Access to this
message by anyone else is unauthorized.  If you are not the intended
recipient,  any disclosure,  copying or distribution of the message,  or
any action taken by you in reliance on it,  is prohibited and may be
unlawful.  If you have received this message in error,  please delete it
and contact the sender immediately.  Thank you.



                                                                           
             "Chris Double"                                                
             <chris.double at dou                                             
             ble.co.nz>                                                 To 
             Sent by:                  openal at opensource.creative.com      
             openal-bounces at op                                          cc 
             ensource.creative                                             
             .com                                                  Subject 
                                       [Openal] Notification of buffers    
                                       being processed                     
             04/01/2007 06:02                                              
             PM                                                            
                                                                           
                                                                           
                                                                           
                                                                           




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
_______________________________________________
Openal mailing list
Openal at opensource.creative.com
http://opensource.creative.com/mailman/listinfo/openal

ForwardSourceID:NT0003EDFE



More information about the Openal mailing list