[MPlayer-dev-eng] [PATCH 1/2] mixer: do not unmute to volume 0, instead unmute to max.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Apr 5 14:53:02 CEST 2014


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, &mixer->last_l, &mixer->last_r);
-- 
1.9.1



More information about the MPlayer-dev-eng mailing list