[alsa-devel] SALSA library and recording
Hi All, 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. Is there any other function/way to select the line-in mixer element in the SALSA API?
The help would be appreciated. Thanks & regards, manisha
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:
snd_ctl_t *ctl; snd_ctl_elem_value_t *value; int onoff = 1; /* or 0 for off */
err = snd_ctl_open(&ctl, "default", 0); ... snd_ctl_elem_value_alloca(&value); ... snd_ctl_elem_value_set_interface(value, SND_CTL_ELEM_IFACE_MIXER); 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); ... snd_ctl_close(ctl);
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 index.
HTH Clemens
At Thu, 16 Apr 2009 09:12:17 +0200, Clemens Ladisch wrote:
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.
They are. But perhaps there are some bugs...
Takashi
At Wed, 15 Apr 2009 22:02:38 +0530, Manisha Sankpal wrote:
Hi All, 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. Is there any other function/way to select the line-in mixer element in the SALSA API?
The API should be same, so it's likely an implementation issue of salsa-lib. Could you show the generated file via "alsactl -f somefile store"?
Takashi
participants (3)
-
Clemens Ladisch
-
Manisha Sankpal
-
Takashi Iwai