From: James Courtier-Dutton <James@superbug.co.uk>
To: alejandro <alejandro@openstudionetworks.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: IO streams sync
Date: Mon, 19 Jun 2006 20:05:39 +0100 [thread overview]
Message-ID: <4496F583.5060701@superbug.co.uk> (raw)
In-Reply-To: <4496CE0A.2000109@openstudionetworks.com>
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
next prev parent reply other threads:[~2006-06-19 19:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.3908.1150727591.2958.alsa-devel@lists.sourceforge.net>
2006-06-19 16:17 ` IO streams sync alejandro
2006-06-19 16:21 ` Lee Revell
2006-06-19 19:05 ` James Courtier-Dutton [this message]
[not found] <mailman.4401.1150734905.2958.alsa-devel@lists.sourceforge.net>
2006-06-20 10:38 ` alejandro
2006-06-20 20:18 ` James Courtier-Dutton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4496F583.5060701@superbug.co.uk \
--to=james@superbug.co.uk \
--cc=alejandro@openstudionetworks.com \
--cc=alsa-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.