[alsa-devel] Output to Input routing

Takashi Iwai tiwai at suse.de
Thu Aug 2 19:33:07 CEST 2007


At Thu, 2 Aug 2007 17:21:21 +0000 (UTC),
Vadim Lebedev wrote:
> 
> Takashi Iwai <tiwai <at> suse.de> writes:
> ....
> > > This setting is ideal for echo cancellation algorithm.
> > 
> > 	% amixer cset iface=MIXER,name='Capture Source' 0,5
> .....
> Hi Takashi,
> Tjis is very helpful, thanks a lot....
> I wonder howvere if somoedy can post the same thing said in C?

A shorter version is:

	system("amixer cset iface=MIXER,name='Capture Source' 0,5");

A longer version is something like:

	snd_ctl_t *handle;
	snd_ctl_elem_value_t *val;
	
	err = snd_ctl_open(&handle, "hw", 0);
	if (err < 0)
		return err;

	snd_ctl_elem_value_alloca(&val);
	snd_ctl_elem_value_set_interface(val, SND_CTL_ELEM_IFACE_MIXER);
	snd_ctl_elem_value_set_name(val, "Capture Source");
	snd_ctl_elem_value_set_enumerated(val, 0, 0);
	snd_ctl_elem_value_set_enumerated(val, 1, 5);
	err = snd_ctl_elem_write(handle, val);
	if (err < 0) {
		snd_ctl_close(handle);
		return err;
	}
	snd_ctl_close(handle);
	return 0;


Takashi


More information about the Alsa-devel mailing list