[alsa-devel] Requiring the same sample rate for playback and record?

Timur Tabi timur at freescale.com
Mon Jul 14 23:25:04 CEST 2008


Takashi Iwai wrote:

> Right now there is no "elegant" way for this, unfortunately.
> A common way many drivers use is to remember the rate of the first
> stream, then add it to hw_constraint of the secondary streams.

Can you give me an example of a driver that does this?  I can't seem to find one.

> But, this could be also a bit racy (unavoidable due to its design)
> although practically it seems working.

I've been trying to implement this, but I'm not sure how.  I have a couple
questions:

1) Which snd_pcm_hw_constraint_xxx function should I use to specify a sample
rate or sample size constraint of a single number?  I'm thinking
snd_pcm_hw_constraint_list().

2) Where should I be calling this function?  In my _hw_params() function?  What
I would like to do is require the constraint to be enforced only when a stream
is already playing.  That is, if playback is paused, then the capture stream can
set any sample rate it wants.  Is this doable, or just too complicated?


-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the Alsa-devel mailing list