[alsa-devel] Using snd_pcm_set_params() on a capture handle

Clemens Ladisch clemens at ladisch.de
Mon Oct 26 10:44:32 CET 2015


Erik de Castro Lopo wrote:
> Clemens Ladisch wrote:
>> Erik de Castro Lopo wrote:
>>>     RATE: [44100 96000]
>>
>> snd_pcm_set_params() should have chosen a single rate.
>> Did you dump this after that call?
>
> Yep, the code is:
>
>     snd_pcm_set_params (capture_handle, format, SND_PCM_ACCESS_RW_INTERLEAVED, 2, rate, 0, 25000))
>     snd_pcm_hw_params_any (capture_handle, hw_params)
>     snd_pcm_hw_params_dump (hw_params, output) ;

snd_pcm_hw_params_any() gets a _new_ set of parameters.  You would use
it when you want to configure the device for the first time, or when you
want to reconfigure it from scratch.

To get the current parameters of the device, use snd_pcm_hw_params_current().


Regards,
Clemens


More information about the Alsa-devel mailing list