Keep mute state from getting out of sync with reality

This commit is contained in:
Robert Jacobs 2014-12-04 02:18:24 -06:00 committed by Carlos R. Mafra
parent 20cb8b1e0f
commit ad6d781c1a
2 changed files with 4 additions and 1 deletions

View file

@ -35,6 +35,9 @@ void AChannel::setVolume(long value) {
bool AChannel::isMuted() { bool AChannel::isMuted() {
int val; 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); snd_mixer_selem_get_playback_switch(aItem->aElem, (SNDCHID_T) id, &val);
return (! (bool) val); return (! (bool) val);

View file

@ -464,8 +464,8 @@ void Mixer::setVolume(int button, int volume)
void Mixer::toggleMute(int button) void Mixer::toggleMute(int button)
{ {
mVolumeMute[button] = !mVolumeMute[button];
aMixer->itemToggleMute(button); aMixer->itemToggleMute(button);
mVolumeMute[button] = aMixer->itemIsMuted(button);
setButtonType(button); setButtonType(button);
} }