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

Hans-Dieter Kosch hdkosch at kabelbw.de
Tue Apr 8 02:31:18 CEST 2014


Reimar Döffinger wrote:

> 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);

Unmute to only 10 or 50 or so, in order to not unexpectedly load the speakers 
(and the audience's ears) with full power?

Hans-Dieter


More information about the MPlayer-dev-eng mailing list