[alsa-devel] [Alsa-user] How to get set/fixed sample rate of ALSA device?

Rene Herman rene.herman at keyaccess.nl
Tue Oct 9 02:23:35 CEST 2007


On 10/08/2007 09:30 PM, Rene Herman wrote:

> On 10/08/2007 09:14 PM, Bill Unruh wrote:

>>>> Introducing a /proc/asound/card0/pcm0{p,c}/hw_limits or similar might
>>>>  not be a bad idea though?

[ ... ]

> It could also be done in userspace by opening the stream and quering the 
> format_mask, channels and rates and stuff and I'll look into that a bit 
> as a followup to the rates_min/max thing that I posted if only as a 
> template thingy, but unless I'm missing it, I don't believe there's 
> actually a way to get the information from userspace without opening the 
> "hw" device, and that one only allows "subdevices_count" concurrent 
> opens, meaning you'd have to stop things talking to your soundcard if it 
> has just one (normal).

Okay, well, in userspace it would be something like this.

Not too sure about that subformat thing by the way. Jaroslav (or anyone, 
obviously): is the subformat intended/designed to be format-specific or 
snd_pcm_t global?

Currently there is only ever one subformat (STD) anyway but generally, I'd 
expect a subformat to be specific to a given format. There's just one non 
format-specific SND_PCM_SUBFORMAT_LAST though, no defines (or functions) to 
get subformats from the format. Is the design that all formats would be 
supporting all subformats or something?

This is modelled after the hw_params file in an opened substream directory 
(and ignores the possibility of anything more involved than simple min-max 
intervals). Provide a "-c" for the capture direction.

Not sure if this helps much (other than hopefully teaching me about subformats).

Rene

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ainfo.c
Url: http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20071009/1a2f33b6/attachment.bat 


More information about the Alsa-devel mailing list