changeset 37088:3a9a804e488b

mixer: do not unmute to volume 0, instead unmute to max. 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.
author reimar
date Tue, 06 May 2014 19:02:02 +0000
parents e476a46c6a2b
children 86893b300a45
files mixer.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mixer.c	Sat May 03 06:25:05 2014 +0000
+++ b/mixer.c	Tue May 06 19:02:02 2014 +0000
@@ -129,7 +129,12 @@
 
 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, &mixer->last_l, &mixer->last_r);