[openal] How to handle callbacks/the chances of seeing callbacks in OpenALSoft?

Austin Hicks camlorn38 at gmail.com
Sun Mar 30 18:15:12 EDT 2014


The subject pretty much says it all.  The only good way I can figure to 
do this right now, without some sort of support in OpenAl Soft or 
similar, is to have a background thread that monitors everything and, 
for the sake of performance, is aware of whether or not something is 
paused.  My tentative thoughts on the subject all involve some sort of 
"cost" that represents time, or a timer that gets more and more precise 
as it gets close to time for an event to happen.  I'm currently 
rewriting my audio engine because this is a necessary feature for what I 
want to do, and I want to do this the right way, or get support down 
into OpenALSoft somehow.  Having a background thread that does checks is 
difficult because of battery life and other performance reasons: 5 
milliseconds might be appropriate in many cases, but there will be times 
when it must be less (and then the battery indicator also goes down).

I'd settle for a good way to be notified of when buffers finish and when 
sources state change-whether or not I'm implementing this myself.  Does 
anyone have any design info for this kind of thing?

I saw the previous thread about realtime audio and blocking callbacks, 
and understand why that could be a problem; nevertheless, the case for 
having OpenALSoft allow it is simple: condition variables, or other 
cross-thread data structures can be used for notification to something 
else on another thread.  Is generic callbacks as big a problem to do 
outside OpenALSoft as I think it is?  I've not yet managed to come up 
with a good solution, but I may just not be seeing it.


More information about the openal mailing list