Fix mute status for Porter/Koelsch
authorManuel Bachmann <manuel.bachmann@iot.bzh>
Tue, 29 Dec 2015 20:11:44 +0000 (21:11 +0100)
committerManuel Bachmann <manuel.bachmann@iot.bzh>
Tue, 29 Dec 2015 20:11:44 +0000 (21:11 +0100)
Mute status on Porter/Koelsch is reversed, take this
into account.

Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
plugins/audio/audio-alsa.c

index 8a4caf2..afbff42 100644 (file)
@@ -221,7 +221,10 @@ PUBLIC unsigned char _alsa_get_mute (unsigned int num) {
         snd_mixer_selem_get_playback_switch (elm_m, SND_MIXER_SCHN_FRONT_RIGHT, &mute);
     }
 
-    return (unsigned char)!mute;
+    if (dev_ctx[num]->mixer_elm_m)
+        return (unsigned char)mute;
+    else
+        return (unsigned char)!mute;
 }
 
 PUBLIC void _alsa_set_mute (unsigned int num, unsigned char mute) {
@@ -231,8 +234,12 @@ PUBLIC void _alsa_set_mute (unsigned int num, unsigned char mute) {
     if (!dev_ctx || !dev_ctx[num] || !dev_ctx[num]->mixer_elm || 1 < mute < 0)
         return;
 
-    dev_ctx[num]->mixer_elm_m ? (elm_m = dev_ctx[num]->mixer_elm_m) :
-                                (elm_m = dev_ctx[num]->mixer_elm);
+    if (dev_ctx[num]->mixer_elm_m) {
+        elm_m = dev_ctx[num]->mixer_elm_m;
+        mute = !mute;
+    } else {
+        elm_m = dev_ctx[num]->mixer_elm;
+    }
 
     if (snd_mixer_selem_has_playback_switch (elm_m))
         snd_mixer_selem_set_playback_switch_all (elm_m, !mute);