________________________________________ From: Clemens Ladisch [clemens@ladisch.de] Sent: Tuesday, October 18, 2011 5:11 PM To: Anders Gnistrup Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] What is wrong in this code.
Anders Gnistrup wrote:
The code works just as expected when using the: snd_ctl_elem_id_set_name(id, "PCM Playback Volume"); But when I use the snd_ctl_elem_id_set_numid(id, numid); (with numid=23) it fails. ... snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
//snd_ctl_elem_id_set_numid(id, numid); snd_ctl_elem_id_set_name(id, "PCM Playback Volume");
When using the numid to access elements, it must be the only field that is set in the elem id.
Hello Clemens
I have tried just that, but is still does not work. It was my first try, but in frustration I shifted it to snd_ctl_elem_id_set_name. If both is set (numid,name) it still works, but I think the numid is silently ignored.
There might be a known bug/'not implemented feature' in the libalsa version I got. From the amixer.c source code in alsa-utils I have found this:
snd_ctl_elem_info_get_id(info, id); /* FIXME: Remove it when hctl find works ok !!! */ type = snd_ctl_elem_info_get_type(info); count = snd_ctl_elem_info_get_count(info); snd_ctl_elem_value_set_id(control, id);
In the function "cset". I assume that FIXME note function is "snd_hctl_find_elem". The cset function also shows a valid path to get around the problem. I have downloaded alsa-utils version 1.0.24.2.22.gaf0bf and the note is still present.
Have the problem with the /* FIXME: Remove it when hctl find works ok !!! */ been solved in latest git release of alsalib?
Regards, Clemens