Latency in SDL_AudioSpec.callback

Hi All,

I am looking at the SDL_AudioSpec data structure and am trying to figure out how to know the exact moment when an audio buffer is rendered (or at least as close as possible). When SDL calls back on SDL_AudioSpec.callback requesting a buffer of data, from that point on, what is the latency (is it known) between when I feed it the data, and the exact moment in which it is rendered on the sound card – or maybe more appropriately, is there any way to know (event) when that data buffer is rendered?

thanks.

-phil

Philip Pellouchoud wrote:

Hi All,

I am looking at the SDL_AudioSpec data structure and am trying to figure
out how to know the exact moment when an audio buffer is rendered (or at
least as close as possible). When SDL calls back on
SDL_AudioSpec.callback requesting a buffer of data, from that point on,
what is the latency (is it known) between when I feed it the data, and
the exact moment in which it is rendered on the sound card – or maybe
more appropriately, is there any way to know (event) when that data
buffer is rendered?

You can’t determine this from the SDL apis.

In my mpeg4ip project, I’ve added these APIs by copying the SDL code
and creating a new API. It works for oss, alsa and windows -
look at lib/SDLAudio