Re: IO streams sync

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



alejandro wrote:
> Hello,
> 
> Is there any document describing the ALSA components and functions?
> Particularly the link between audio I/O and timers, in order to frame 
> accurate sync multiple audio cards and video.
> 
> Thank you,
> 

Alejandro,

This is achieved using the snd_pcm_delay() function call.
It gives you a measure of the number of samples between the current
write pointer and the codec output.
I.e. If you call snd_pcm_writei() now, it will be snd_pcm_delay() sample
frames duration until the sample reach the speakers.
So, from that you can accurately predict the exact time that a
particular sample will reach the speakers, and therefore keep video in
sync with it.
This method is used in xine  (http://xinehq.de)
See the audio_out.c loop.

One then combines this with a resampler (as xine does), to adjust for
clock speed differences between sound cards and the system timer, so
this prevents sync drift.

James


_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux