From: Giuliano Pochini Date: Sun, 15 Mar 2009 20:35:09 +0000 (+0100) Subject: echomixer: Fix echomixer to work with the new drivers X-Git-Tag: v1.0.20~2 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=cf4b9bcad4eff6e8155203dc8e0782561bbb57a9;p=alsa-tools.git echomixer: Fix echomixer to work with the new drivers There is a long standing bug in the drivers for cards with a vmixer because I overlooked a detail in the c++ generic driver by echoaudio. Those cards do not have a line-out volume control. It is a virtual control provided by the generic driver. The bug is harmless because the DSP just ignores the command to change the volume. Since that control has been removed, echomixer must be updated. With this patch it uses the vmixer to fake the line-out volume. This patch makes echomixer work with the new drivers. Signed-off-by: Giuliano Pochini Signed-off-by: Takashi Iwai --- diff --git a/echomixer/echomixer.c b/echomixer/echomixer.c index cd38b4f..9788935 100644 --- a/echomixer/echomixer.c +++ b/echomixer/echomixer.c @@ -1178,6 +1178,29 @@ void UpdateMixerVolume(int outchannel) { +// Changes the vmixer volume according to the current Line-out volume for vmixer cards. +void UpdateVMixerVolume(int outchannel) { + snd_ctl_elem_id_t *id; + snd_ctl_elem_value_t *control; + int err, val, ch; + + snd_ctl_elem_id_alloca(&id); + snd_ctl_elem_value_alloca(&control); + snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER); + + for (ch=0; chvalue); #ifdef REVERSE v=channel; @@ -1230,13 +1257,17 @@ void Vmixer_volume_changed(GtkWidget *widget, gpointer ch) { o=channel; #endif - val=INVERT((int)GTK_ADJUSTMENT(widget)->value); + // Emulate the line-out volume if this card can't do it in hw. + if (!lineoutId) { + rval=Add_dB(val, lineoutControl.Gain[o]); + ClampOutputVolume(&rval); + } - SetMixerGain(&vmixerControl.mixer[o][v], val); + SetMixerGain(&vmixerControl.mixer[o][v], rval); vmixerControl.mixer[o][v].Gain=val; if (Gang) { - SetMixerGain(&vmixerControl.mixer[o^1][v^1], val); + SetMixerGain(&vmixerControl.mixer[o^1][v^1], rval); vmixerControl.mixer[o^1][v^1].Gain=val; }