[alsa-devel] SALSA library and recording
clemens at ladisch.de
Thu Apr 16 09:12:17 CEST 2009
Manisha Sankpal wrote:
> I am using salsa library to capture the data from the sound card. The
> requirement is that the recording should be done from line-in port of the
> sound card. The selection of "Line-in" port should be done programatically.
> With ALSA library, I am able to select the line-in by calling
> snd_mixer_selem_set_capture_switch_all() function. However, this function
> is returning an error when SALSA library is used.
The high-level mixer functions are not implemented in the SALSA library.
> Is there any other function/way to select the line-in mixer element in
> the SALSA API?
You'll have to use the snd_ctl* functions.
To change the value of a mixer control, do something like this:
int onoff = 1; /* or 0 for off */
err = snd_ctl_open(&ctl, "default", 0);
snd_ctl_elem_value_set_name(value, "xxxxx Capture Switch");
snd_ctl_elem_value_set_boolean(value, 0, onoff);
err = snd_ctl_elem_write(ctl, value);
You have to use the correct name; the names of mixer controls can be
seen in the output of "amixer controls".
If your hardware has a single "Capture Source" control instead, you
have to replace _set_boolean with _set_enumerated and use the correct
More information about the Alsa-devel