Fix set_mute in corner cases
authorManuel Bachmann <manuel.bachmann@iot.bzh>
Tue, 5 Jan 2016 14:45:34 +0000 (15:45 +0100)
committerManuel Bachmann <manuel.bachmann@iot.bzh>
Tue, 5 Jan 2016 14:45:34 +0000 (15:45 +0100)
Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
plugins/audio/audio-alsa.c

index afbff42..51f4970 100644 (file)
@@ -227,18 +227,20 @@ PUBLIC unsigned char _alsa_get_mute (unsigned int num) {
         return (unsigned char)!mute;
 }
 
-PUBLIC void _alsa_set_mute (unsigned int num, unsigned char mute) {
+PUBLIC void _alsa_set_mute (unsigned int num, unsigned char tomute) {
 
     snd_mixer_elem_t *elm_m;
+    int mute;
 
-    if (!dev_ctx || !dev_ctx[num] || !dev_ctx[num]->mixer_elm || 1 < mute < 0)
+    if (!dev_ctx || !dev_ctx[num] || !dev_ctx[num]->mixer_elm || 1 < tomute < 0)
         return;
 
     if (dev_ctx[num]->mixer_elm_m) {
         elm_m = dev_ctx[num]->mixer_elm_m;
-        mute = !mute;
+        mute = (int)!tomute;
     } else {
         elm_m = dev_ctx[num]->mixer_elm;
+        mute = (int)tomute;
     }
 
     if (snd_mixer_selem_has_playback_switch (elm_m))