[openal] Buffer fill callback
anders.genell at gmail.com
Sat Feb 11 04:41:01 EST 2017
I didn't really know what to put in the subject field, so please forgive any misdirection.
I am no programmer myself so I may well have misunderstood things, but I'll try my best to ask anyway.
In some (many?) audio applications the way to avoid hardware buffer underruns is to have the audio interface driver ask the application for more data when (part of) a buffer has been consumed. That way processing rate will essentially be controlled by the audio hardware. In our case we use Csound under Linux to generate audio. Using the Csound API we can tell Csound to generate one chunk of audio data at a time, and by choosing the chunk size to be the same as buffer or period size things will sync up nicely.
If we want to transfer that audio data to OpenAL-soft buffers, however, there seem to be a need to poll for buffer fill rate, which would mean we need to choose an appropriate polling frequency to ensure buffers are never empty. If I have understood things correctly this will not sync up as nicely to the audio hardware. In our case, OpenAL-soft uses the alsa backend, so the hardware buffer callback would be available in theory.
My question is: is there some way to have OpenAL-soft handle hardware buffer callbacks like that?
I hope I have managed to formulate a intelligible question.
More information about the openal