Re: Requiring the same sample rate for playback and record?

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

 



At Mon, 14 Jul 2008 16:25:04 -0500,
Timur Tabi wrote:
> 
> 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.

In a simple case, you don't need hw_constraint functions.  Just
override the corresponding fields of runtime->hw in open callback.

For example, pci/via82xx.c sets the current rate value to
runtime->hw.rate_min/max if there is another stream.
More complicated examples are found in echoaudio driver.


> > 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().

The simplest way is to override the runtime->hw parameter as mentinoed
in the above.

> 2) Where should I be calling this function?  In my _hw_params()
 function? 

Usually these hw_constraints are set in open callback.

> 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?

This is a scenario above a simple hw_constraint.  This would be also
confusing to apps in many cases.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/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