[alsa-devel] alsa-lib: snd_mixer_selem_is_active changes - which event?
Hello
I wonder which event mask notifies an application that snd_mixer_selem_is_active() may have changed.
SND_CTL_EVENT_MASK_VALUE or SND_CTL_EVENT_MASK_INFO
or something else?
I'd be glad for any insights?
Sebastian H.
Sebastian H. wrote:
I wonder which event mask notifies an application that snd_mixer_selem_is_active() may have changed.
SND_CTL_EVENT_MASK_VALUE or SND_CTL_EVENT_MASK_INFO
_VALUE is only for the value itself; all metadata changes generate an _INFO event.
Regards, Clemens
Am 16.02.2011 09:38, schrieb Clemens Ladisch:
Sebastian H. wrote:
I wonder which event mask notifies an application that snd_mixer_selem_is_active() may have changed.
SND_CTL_EVENT_MASK_VALUE or SND_CTL_EVENT_MASK_INFO
_VALUE is only for the value itself; all metadata changes generate an _INFO event.
Great, that justifies the removal of some bloated constructions in qasmixer. :)
Thanks a lot!
Regards, Sebastian H.
2011/2/16 Clemens Ladisch clemens@ladisch.de
Sebastian H. wrote:
I wonder which event mask notifies an application that snd_mixer_selem_is_active() may have changed.
SND_CTL_EVENT_MASK_VALUE or SND_CTL_EVENT_MASK_INFO
_VALUE is only for the value itself; all metadata changes generate an _INFO event.
I have doubt about the implementation of alsamixer is different from the driver
If I add the "Independent HP Switch" which switch the connection of node 0x37 from DAC0 to DAC 1 for ad1988 multi streaming playback model and activate_ctl(codec, "Headphone Playback Volume", spec->independent_hp )
Both "Headphone Playback Volume" and "Headphone playback Switch" are greyed ( inactive) in alsamixer when the independent HP switch is off , but the driver only deactivate the "Headphone Playback Volume".
When I toggle the "Independnent HP switch" on and off , the headphone controls does not change from active to inactive and vice versa
For qasmixer , the "headphone playback volume" and "headphone playback switch" are disappeared when the Indepdent HP switch is off
static int ad1988_independent_hp_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; uinfo->value.integer.min = 0; uinfo->value.integer.max = 1; return 0; }
static int ad1988_independent_hp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct ad198x_spec *spec = codec->spec; *ucontrol->value.integer.value = spec->independent_hp; return 0; }
static void activate_ctl(struct hda_codec *codec, const char *name, int active) { struct snd_kcontrol *ctl = snd_hda_find_mixer_ctl(codec, name); if (ctl) { ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; ctl->vd[0].access |= active ? 0 : SNDRV_CTL_ELEM_ACCESS_INACTIVE; snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); } }
static int ad1988_independent_hp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct ad198x_spec *spec = codec->spec; activate_ctl(codec, "Headphone Playback Volume", *ucontrol->value.integer.value); if ( spec->independent_hp != *ucontrol->value.integer.value ) { spec->independent_hp = *ucontrol->value.integer.value; snd_hda_codec_write(codec, 0x37, 0, AC_VERB_SET_CONNECT_SEL, spec->independent_hp ? 0x00 : 0x01 ); return 1; } return 0; }
static struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = { HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Independent HP", .info = ad1988_independent_hp_info, .get = ad1988_independent_hp_get, .put = ad1988_independent_hp_put, }, { } /* end */ };
2011/2/16 Clemens Ladisch clemens@ladisch.de
Sebastian H. wrote:
I wonder which event mask notifies an application that snd_mixer_selem_is_active() may have changed.
SND_CTL_EVENT_MASK_VALUE or SND_CTL_EVENT_MASK_INFO
_VALUE is only for the value itself; all metadata changes generate an _INFO event.
Regards, Clemens
Patch which fix the display of active/inactive controls in alsamixer
but the problem both "Headphone Playback Volume" and "Headphone Playback Switch" are inactive still not solved using the customised dummy.c
2011/2/28 Clemens Ladisch clemens@ladisch.de
Raymond Yau wrote:
Patch which fix the display of active/inactive controls in alsamixer
Applied, thanks.
Clemens
To really fix the problem, may need to add snd_mixer_selem_xxxxx_ is_active() functions for those controls (where xxxx are. playback_volume, playback_switch, capture_volume ,capture_switch, .... )
For example ad1988 allow multistreaming , The current "6stack-dig-fp" model just add the "Headphone Playback Volume" on DAC0 (i.e. node 0x03) and device 2 for multistreaming playback using front panel headphone.
Adding a new "independent HP" switch to allow routing the front panel headphone back to DAC1 like the "6stack-dig" or auto model need to make "Headphone Playback Volume" inactive
2011/2/16 Sebastian H. vand2@gmx.de
Hello
I wonder which event mask notifies an application that snd_mixer_selem_is_active() may have changed.
SND_CTL_EVENT_MASK_VALUE or SND_CTL_EVENT_MASK_INFO
or something else?
I'd be glad for any insights?
qasmixer display the following message when play audio through front device of emu10k1
alsa_callback_hctl_elem: Unknown mask ( 3 ) [EE] snd_hctl_handle_events : Operation not permitted
which event mask "SND_CTL_EVENT_MASK_VALUE" or "SND_CTL_EVENT_MASK_VALUE " should the mixer application handle first ?
e.g. it is possible that the driver may change access of the control
& ~SNDRV_CTL_ELEM_ACCESS_READ
I wonder which event mask notifies an application that snd_mixer_selem_is_active() may have changed.
SND_CTL_EVENT_MASK_VALUE or SND_CTL_EVENT_MASK_INFO
or something else?
I'd be glad for any insights?
qasmixer display the following message when play audio through front device of emu10k1
alsa_callback_hctl_elem: Unknown mask ( 3 ) [EE] snd_hctl_handle_events : Operation not permitted
This is actually a bug in qasmixer. Up to now it could not handle multi event masks.
Mask 3 seems to be SND_CTL_EVENT_MASK_VALUE & SND_CTL_EVENT_MASK_INFO ( 1 & 2 ) but qasmixer checks for ( mask == SND_CTL_EVENT_MASK_VALUE ) || ( mask == SND_CTL_EVENT_MASK_INFO ) which fails as ( 3 == 1 ) || ( 3 == 2 ) == false;
That should be fixed now. A new version should be around next week. You could also try the development version in the sourceforge mercurial repo.
which event mask "SND_CTL_EVENT_MASK_VALUE" or "SND_CTL_EVENT_MASK_VALUE " should the mixer application handle first ?
IMO the order doesn't matter as long as both events are handled properly and the displayed mixer state equals the system mixer state afterwards.
e.g. it is possible that the driver may change access of the control
& ~SNDRV_CTL_ELEM_ACCESS_READ
If that triggers a SND_CTL_EVENT_MASK_INFO event it shouldn't be a problem in the coming version 0.11.0.
Sebastian H.
participants (3)
-
Clemens Ladisch
-
Raymond Yau
-
Sebastian H.