Skip to contentSkip to conversation

SALSA library and recording

DISCUSSION Manisha Sankpal 3 participants 4 messages Apr 15, 2009 – Apr 16, 2009

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 7 lines · Manisha Sankpal

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.

Quoted 2 lines

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

#2 lore raw

At Thu, 16 Apr 2009 09:12:17 +0200,

Quoted 11 lines · Clemens Ladisch
Quoted 7 lines · Manisha Sankpal

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

#3 lore raw
In reply to Manisha Sankpal

At Wed, 15 Apr 2009 22:02:38 +0530,

Quoted 11 lines · Manisha Sankpal

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