[alsa-devel] [PATCH 1/2 v2] ALSA: Add snd_ctl_update() to dynamically update a control

Takashi Iwai tiwai at suse.de
Wed Mar 16 08:01:33 CET 2011


At Wed, 16 Mar 2011 08:56:36 +0800,
Raymond Yau wrote:
> 
> 2011/3/15 Takashi Iwai <tiwai at suse.de>
> 
> > At Tue, 15 Mar 2011 15:17:58 +0100,
> > Clemens Ladisch wrote:
> > >
> > > > +   up_write(&card->controls_rwsem);
> > > > +   ret = snd_ctl_add(card, kcontrol);
> > >
> > > Doing this outside the semaphore doesn't look good.
> >
> > Using an internal function without semaphore would be preferred, yes.
> >
> > > I wonder whether snd_ctl_add() is the right function to use, because it
> > > will assign a different numid event if the control didn't change.
> >
> > Hm, actually the function can compare whether it's really changed or
> > not.  If any change, it makes really sense to assign a different
> > numid.
> >
> >
> >
> 
> does it mean that the driver can update "Input Source" controls for those
> HDA codec on a motherboard with 3 audio jacks at rear panel ?
> 
> i.e. remove/add "Rear Mic" and "Line in" from/to "Input Source" when user
> switch "channel_mode" between 2 and 6 or  switch"smart51" on/off

In theory, yes.  But, practically, I'm afraid that this is rather
confusing for normal desktop apps.  Most of mixer apps aren't written
robustly for handling the dynamically changed control elements.


Takashi


More information about the Alsa-devel mailing list