[MPlayer-dev-eng] [PATCH] use playback_switch with alsa for muting

Alexander Strasser eclipse7 at gmx.net
Fri Nov 18 17:18:15 CET 2005


Reimar Döffinger wrote:
> On Fri, Nov 18, 2005 at 02:09:17PM +0100, Matthias Lederhofer wrote:
> > I wrote a patch to libao2/ao_alsa.c which uses
> > snd_mixer_selem_set_playback_switch when the volume is set to 0.0.
> > This is the function intended for muting by alsa and I can still hear
> > a bit of the sound without it when I set master and my speakers to
> > full volume.
> 
> Overcomplicated, try the attached patch. Anyway, I am a bit unsure about
> this, but what about any other channels? Since it is called FRONT_LEFT,
> I guess there also is REAR_LEFT or so?
>
> Index: libao2/ao_alsa.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libao2/ao_alsa.c,v
> retrieving revision 1.20
> diff -u -r1.20 ao_alsa.c
> --- libao2/ao_alsa.c	25 Aug 2005 21:46:32 -0000	1.20
> +++ libao2/ao_alsa.c	18 Nov 2005 15:35:07 -0000
> @@ -197,6 +197,15 @@
>  	}
>  	mp_msg(MSGT_AO,MSGL_DBG2,"right=%li, pmin=%li, pmax=%li, mult=%f\n", 
>  	       set_vol, pmin, pmax, f_multi);
> +
> +	if (snd_mixer_selem_has_playback_switch(elem)) {
> +	  int lmute = (vol->left == 0.0);
> +	  int rmute = (vol->right == 0.0);
> +	  if (snd_mixer_selem_has_playback_switch_joined(elem))
> +	    lmute = rmute = lmute & rmute;

  Is the bit operation intentional?

[...]

  Alex (beastd)




More information about the MPlayer-dev-eng mailing list