[MPlayer-users] How to set volume at startup ?

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Dec 1 19:27:38 CET 2007


Hello,
On Sat, Dec 01, 2007 at 06:40:59PM +0100, Bertrand Florat wrote:
> The nearest related option I found so far is -af volume=[gain] with gain from
> -200 (mute) to 60 (max). Does it mean there's not other way to set volume and we
> have to use a Volume = 100/260 *(Gain + 200) function and use -af command ?

Well, you can try attached patch, but I am not sure it is in any way
better than the -af way...

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: mplayer.c
===================================================================
--- mplayer.c	(revision 25234)
+++ mplayer.c	(working copy)
@@ -84,6 +84,7 @@
 int player_idle_mode=0;
 int quiet=0;
 int enable_mouse_movements=0;
+float start_volume = -1;
 
 #ifdef WIN32
 char * proc_priority=NULL;
@@ -3292,6 +3294,8 @@
     audio_delay += mpctx->sh_video->stream_delay;
 }
 if(mpctx->sh_audio){
+  if (start_volume >= 0)
+    mixer_setvolume(&mpctx->mixer, start_volume, start_volume);
   if (! ignore_start)
     audio_delay -= mpctx->sh_audio->stream_delay;
   mpctx->delay=-audio_delay;
Index: cfg-mplayer.h
===================================================================
--- cfg-mplayer.h	(revision 25234)
+++ cfg-mplayer.h	(working copy)
@@ -124,6 +124,7 @@
         {"nosoftvol", &soft_vol, CONF_TYPE_FLAG, 0, 1, 0, NULL},
         {"softvol-max", &soft_vol_max, CONF_TYPE_FLOAT, CONF_RANGE, 10, 10000, NULL},
 	{"volstep", &volstep, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
+	{"volume", &start_volume, CONF_TYPE_FLOAT, CONF_RANGE, -1, 10000, NULL},
 	{"master", "Option -master has been removed, use -af volume instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
 	// override audio buffer size (used only by -ao oss, anyway obsolete...)
 	{"abs", &ao_data.buffersize, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},


More information about the MPlayer-users mailing list