[alsa-devel] Is there a way to figure out if the clocks of two snd_pcm_t's deviate? (snd_pcm_info_get_sync?)

Lennart Poettering mznyfn at 0pointer.de
Wed Sep 9 01:18:53 CEST 2009


On Fri, 04.09.09 07:52, pl bossart (bossart.nospam at gmail.com) wrote:

> 
> > I am looking for a way to find out whether the clocks of two
> > snd_pcm_t's are perfectly in sync and don't deviate (or only deviate
> > by a constant phase).
> 
> short answer:no
> You would need hardware that would count the bit clock transitions and
> provide the delta. Few devices provide this in the consumer space, and
> when they do they actually perform an asynchronous sample-rate
> conversion on the fly (cf. Freescale DSP563xx). Analog Devices also
> provides dedicated sample-rate converters that perform this comparison
> and resampling; they are typically used when multiple masters are
> present.
> All this nice hardware wouldn't work anyway for USB where audio is
> transmitted in packets every ms; it's hard to guess what the real
> audio speed is.

But that should already be good enough for my purposes. I mostly care
that over a longer period of time the deviation between input and
output (or two outputs) is bounded. That means, if there is a fixed
time deviation between recording and playback and I know only that it
is fixed but don't know exactly what it is I am already a happier man.

> That's the reason why I introduced the resampling enable/disable in
> the PA module-loopback code, only the user/system designer will know
> if you have one master or more, and whether you should enable
> variable-rate interpolation.

but why shouldn't this information be queriable from the drivers?
Drivers do know a lot about the hardware they drive, so they should
now about clocks, too.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the Alsa-devel mailing list