[MPlayer-users] Mute not silent: hack fix.

Brad Allen Ulmo-MPlayer-Users at Usenet.Q.Net
Fri Feb 27 02:30:42 CET 2004


Mute isn't silent.  I mute to turn off distraction, and a mute that
doesn't completely silence output isn't mute to me.

The problem is simple:  The way MPlayer executes mute is to set volume
to 0 for both left and right channel, however, that is insufficient to
mute.  What does work is to set each channel to Mute; that makes it
100% silent, and is what I want.

My question is how can I get mplayer mute command to actually execute
a mute instead of a volume zero?

I started to look into ALSA to see how to execute Mute.  I will have
to learn more about alsalib and its higher level access functions, and
then copy code in amixer.c and/or alsamixer.c to MPlayer.  I got 1/4th
done when I decided it's too much work to do unless no one else has
done it.

I do know other solutions, but they are all non-free and a pain, which
seems unnecessary since there's obviously a SW solution mentioned above:

* Buy much larger hard disks, and stop watching things I can't pause,
  and use "-ao none" for anything that I don't want to hear, or just
  set mute before running MPlayer;

* Buy additional IR receiver HW (by builing my own from components, most
  likely), and use LIRC and a shell script I already wrote for
  Hauppague WinTV PVR '350 that has fairly full "amixer" control via a
  remote;

* Buy an additional WinTV PVR '350 or '250 (do they both have remotes?),
  and put it into every box where I might use MPlayer, and use
  abovementioned shell script;

* Buy a dumb terminal (anybody have any free adm3a's and/or Wyse terminals
  laying about?) and put it next to every seat where I might use
  MPlayer, and have a mute login;

* Buy more computers, and have an extra computer next to every mplayer
  playing computer;

* Go to another computer in another room and press mute.  Currently
  this is what I do, and it is a big pain!

Hmm, I just thought of an easy hack:

* system("amixer sset PCM mute");

Here's a patch for above hack which is tested and works:

--- mixer.c.~1~	2003-03-31 09:32:46.000000000 -0800
+++ mixer.c	2004-02-26 16:35:22.217643037 -0800
@@ -73,16 +80,29 @@
  return ( mixer_l + mixer_r ) / 2;
 }
 
+#define MUTE_BY_VOLUME	(1)
+#define MUTE_BY_MUTE	(0)
+#define mute_method MUTE_BY_MUTE
+#define mute_avail (1)
+
 void mixer_mute( void )
 {
- if ( muted ) mixer_setvolume( mute_l,mute_r );
-  else
-   { 
-    mixer_getvolume( &mute_l,&mute_r );
-    mixer_setvolume( 0,0 );
-    muted=1;
-   }
+  if(mute_method==MUTE_BY_MUTE && mute_avail) {
+    muted=!muted;
+    /*    mixer_setmute(muted,muted); */
+    if(muted)
+      system("/usr/bin/amixer sset PCM mute");
+    else
+      system("/usr/bin/amixer sset PCM unmute");
+  } else {
+  /* MPlayer mute via volume hack */
+    if ( muted ) {
+      mixer_setvolume( mute_l,mute_r );
+      /* mixer_setvolume sets muted=0 */
+    } else { 
+      mixer_getvolume( &mute_l,&mute_r );
+      mixer_setvolume( 0,0 );
+      muted=1;
+    }
+  }
 }
-
-
-

Above tested and works.  Finally.

P.S., anybody get JACK (<URL:"http://JACKIT.SourceForge.Net/">)
working with MPlayer?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mute.hack.patch
Type: application/octet-stream
Size: 969 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-users/attachments/20040226/c8fb41cf/attachment.obj>


More information about the MPlayer-users mailing list