[alsa-devel] Softvol controls

Takashi Iwai tiwai at suse.de
Fri Nov 30 09:59:34 CET 2007

At Fri, 30 Nov 2007 00:28:59 +0100,
Lennart Poettering wrote:
> On Wed, 21.11.07 12:22, Takashi Iwai (tiwai at suse.de) wrote:
> > >    Now, is there a way I can detect for a mixer element if it is
> > >    "real" or if it is implemented only for the "plughw" PCM? As it
> > >    seems the "hw:0" mixer device does contain "virtual" tracks, isn't that a
> > >    bit strange? Shouldn't the virtual mixer tracks be available only
> > >    in a mixer device "plughw:0"? That at least would be symmetric to
> > >    the PCM case, wouldn't it?
> > 
> > Check snd_ctl_elem_info_is_user().  All softvol controls are
> > implemented as user elements.
> Hmm, how am I supposed to get the snd_ctl_elem_info_t from a
> snd_mixer_elem_t or snd_mixer_selem_id_t?

No, there is no API to get the id mapping.
And I guess we can't do it because there is no 1:1 mapping between
ctl_elem and mixer_selem.  It's N:1.

> I figure there is no useful documentation or even example how this is
> supposed to work? Hmm, is there any real documentation available which
> describes the relation of ctl, hctl, mixer and smixer at all? For the
> uninitated the whols structure looks overly complex and redundant.

Yes, it's overly complex.  The mixer abstracion is what I'd really
love to clean up, maybe better to write from scratch.

I guess PA could use ctl API better than mixer API because it requires
only certain elements like Master or PCM.  You can simply take
"Master Playback Control" with MIXER iface for master volume and
"Master Playback Switch" for master mute switch.  Of course, you'll
take care of number of channels or value range, but it's also same for
mixer API, too.


More information about the Alsa-devel mailing list