changeset 17194:cd527e59d128

use snd_mixer_selem_set_playback_switch when muting ALSA, patch by Matthias Lederhofer <matled -at- gmx dot net>
author wanderer
date Thu, 15 Dec 2005 17:50:29 +0000
parents 7d48356b7bc6
children 3b33f4c52324
files libao2/ao_alsa.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa.c	Thu Dec 15 16:00:31 2005 +0000
+++ b/libao2/ao_alsa.c	Thu Dec 15 17:50:29 2005 +0000
@@ -197,6 +197,17 @@
 	}
 	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;
+	  } else {
+	    snd_mixer_selem_set_playback_switch(elem, SND_MIXER_SCHN_FRONT_RIGHT, !rmute);
+	  }
+	  snd_mixer_selem_set_playback_switch(elem, SND_MIXER_SCHN_FRONT_LEFT, !lmute);
+	}
       }
       else {
 	snd_mixer_selem_get_playback_volume(elem, 0, &get_vol);