Hi CK,
> > How does ALSA (or alsamixer) know which controls are "Capture"?
> I'm also curious to know how to seperate capture from playback.
I digged into alsa-lib 1.0.28 some more and found out how control creation
and grouping works (I hope indentation will not get messed up in the following):
-> snd_mixer_load loads hctls
-> snd_hctl_load, these have a callback for event handling
-> simple_event_add
-> determines key directly (actually base_len checks
"suffixes", see below)
-> simple_add1(key <-- this is the "ctls" key; see
below)
-> selem_none_t allocation (by calloc; good
luck finding it)
-> snd_mixer_elem_new
-> key is corrected for enumerations
-> "ctls" dictionary (see below) is updated
-> simple_update (updates caps)
The selem_none_t has a "ctls" dictionary which has an entry per gui control
type
(one for a switch, if any; one for a capture volume, if any; etcetc).
static const struct suf {
const char *suffix;
selem_ctl_type_t type;
} suffixes[] = {
{" Playback Enum", CTL_PLAYBACK_ENUM},
{" Playback Switch", CTL_PLAYBACK_SWITCH},
{" Playback Route", CTL_PLAYBACK_ROUTE},
{" Playback Volume", CTL_PLAYBACK_VOLUME},
{" Capture Enum", CTL_CAPTURE_ENUM},
{" Capture Switch", CTL_CAPTURE_SWITCH},
{" Capture Route", CTL_CAPTURE_ROUTE},
{" Capture Volume", CTL_CAPTURE_VOLUME},
{" Enum", CTL_GLOBAL_ENUM},
{" Switch", CTL_GLOBAL_SWITCH},
{" Route", CTL_GLOBAL_ROUTE},
{" Volume", CTL_GLOBAL_VOLUME},
{NULL, 0}
};
A control ends up being SND_CTL_ELEM_TYPE_ENUMERATED by
snd_ctl_elem_add_enumerated.
That is called by alsa-utils alsactl:
-> load_state (from usually "/var/lib/alsa/asound.state")
-> set_controls
-> set_control
-> checks whether comment access has "user"
-> if so, add_user_control
So basically if it was in the file as ENUMERATED it is restored as ENUMERATED.
Also, in alisp it can end up as ENUMERATED if it was that way in the LISP
source.
Not sure how they are initially created...
Regards,
Danny
--
You received this message because you are subscribed to the Google Groups
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.