From: Fons Adriaensen <fons@linuxaudio.org>
To: alsa-devel@alsa-project.org
Subject: Re: Some questions related to ALSA based duplex audio processing
Date: Tue, 31 Jan 2012 12:10:19 +0000 [thread overview]
Message-ID: <20120131121018.GA7388@linuxaudio.org> (raw)
In-Reply-To: <4F27D30B.6010607@ind.rwth-aachen.de>
On Tue, Jan 31, 2012 at 12:39:55PM +0100, public-hk wrote:
> So, the conclusion is that it is not really defined and I have to deal
> with synchronization of
> input and output myself, is that the right interpretation?
If the capture and playback devices use the same sample clock
(which will be the case if they refer to the same soundcard),
and they are started together, they will remain in sync and
both sides will be ready at the same time - any difference
will be trivially small compared to the period time.
If they don't use the same sample clock you have a difficult
problem: you need adaptive resampling (which is the subject
of my proposed LAC paper).
So in practice, if you use one and the same soundcard for input
and output there is nothing to be gained from keeping the two
separate, and in most cases the driver will allow then to be
'linked', that is started and stopped with a single call.
Waiting for ALSA devices using poll() can be complicated.
In the general case there will be more than one filedesc,
the poll events returned don't always correspond to the
logical direction and have to reworked, you need to take
care of error recovery, etc. This is one of the many things
zita-alsa-pcmi will do for you, just call pcm_wait(). When
it returns you can read and write one period (in theory
there could be more than one, but that is quite exceptional
- I've never seen it happen).
Ciao,
--
FA
Vor uns liegt ein weites Tal, die Sonne scheint - ein Glitzerstrahl.
next prev parent reply other threads:[~2012-01-31 12:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-29 19:19 Some questions related to ALSA based duplex audio processing public-hk
2012-01-29 20:31 ` Fons Adriaensen
2012-01-31 11:07 ` public-hk
2012-01-31 10:40 ` Clemens Ladisch
2012-01-31 11:39 ` public-hk
2012-01-31 12:10 ` Fons Adriaensen [this message]
2012-02-02 9:45 ` public-hk
2012-01-31 13:30 ` Clemens Ladisch
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=20120131121018.GA7388@linuxaudio.org \
--to=fons@linuxaudio.org \
--cc=alsa-devel@alsa-project.org \
/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.