Quantcast
Channel: MarsHut
Viewing all articles
Browse latest Browse all 6551

mixer: do not unmute to volume 0, instead unmute to max.

$
0
0
It's not very useful for unmute to still result in volume 0.
Plus it makes it easier to enable sound for devices that were
on mute at startup.

mixer.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mixer.c b/mixer.c
index 8b290d5..d2d6e18 100644
--- a/mixer.c
+++ b/mixer.c
@@ -129,7 +129,12 @@ void mixer_getbothvolume(mixer_t *mixer, float *b)

void mixer_mute(mixer_t *mixer)

- if (mixer->muted) mixer_setvolume(mixer, mixer->last_l, mixer->last_r);
+ if (mixer->muted) {
+ // unmuting to volume 0 makes no sense
+ if (mixer->last_l == 0) mixer->last_l = 100;
+ if (mixer->last_r == 0) mixer->last_r = 100;
+ mixer_setvolume(mixer, mixer->last_l, mixer->last_r);
+ }
else

mixer_getvolume(mixer, 騬>last_l, 騬>last_r);

Viewing all articles
Browse latest Browse all 6551

Trending Articles