From ad6d781c1abcef0f046bb71d85f86928c2fae0e4 Mon Sep 17 00:00:00 2001 From: Robert Jacobs Date: Thu, 4 Dec 2014 02:18:24 -0600 Subject: [PATCH] Keep mute state from getting out of sync with reality --- AlsaMixer.app/AMixer/AChannel.cc | 3 +++ AlsaMixer.app/Mixer.cc | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AlsaMixer.app/AMixer/AChannel.cc b/AlsaMixer.app/AMixer/AChannel.cc index 81df656..745bf08 100644 --- a/AlsaMixer.app/AMixer/AChannel.cc +++ b/AlsaMixer.app/AMixer/AChannel.cc @@ -35,6 +35,9 @@ void AChannel::setVolume(long value) { bool AChannel::isMuted() { int val; + if (!snd_mixer_selem_has_playback_switch(aItem->aElem)) { + return (false); /* can't be muted? isn't muted. */ + } snd_mixer_selem_get_playback_switch(aItem->aElem, (SNDCHID_T) id, &val); return (! (bool) val); diff --git a/AlsaMixer.app/Mixer.cc b/AlsaMixer.app/Mixer.cc index b982413..66ebe6e 100644 --- a/AlsaMixer.app/Mixer.cc +++ b/AlsaMixer.app/Mixer.cc @@ -464,8 +464,8 @@ void Mixer::setVolume(int button, int volume) void Mixer::toggleMute(int button) { - mVolumeMute[button] = !mVolumeMute[button]; aMixer->itemToggleMute(button); + mVolumeMute[button] = aMixer->itemIsMuted(button); setButtonType(button); }