[MPlayer-users] [BUGREPORT] Crash when REAL used with any -aop options

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Oct 31 14:59:45 CET 2004


Hi,
> > >>>> I realize -aop is depreciated, but volnorm is still very
> > >>>> useful.
> > >>> 
> > >>> all aops are now available as afs, so no need to use -aop
> > >>> anymore. Thus this won't be fixed anymore (unless it also happens
> > >>> with -af).
> > >> 
> > >> Not with quite the same functionality, they're not. Specifically,
> > >> with -af volume=<value>, I get: an OSD volume display which
> > >> sometimes makes no sense (up to jumping between zero and max when I
> > >> try to adjust volume on the fly); at higher volumes, staticky audio
> > >> which gets worse as time and/or volume adjustments go on; and no
> > >> response whatsoever to the volume adjustment keys, except for a
> > >> change in the OSD. On the other hand, -aop
> > >> list=volume:volume=<value> has none of these problems.
> > > 
> > > That's probably because you're using the volume filter in a way it
> > > isn't supposed to be used...
> > 
> > News to me if so. AFAIK, I'm just following a recommendation (from
> > Richard?) on how to get software volume control at all.
> 
> Probably an older recommendation ;-)
> 
> > I'll have a look, though I may not actually change anything since SDL
> > output seems to give me what I was after.
> > 
> > > Also by adjusting (replacing) the values 90.0 and 180.0 (2*90.0) you
> > > can adjust the possible range of the volume.
> > > 
> > > Care to make a patch to allow to select all this on the command line?
> > > ;-)
> > 
> > If I can figure out how (a *very* big if) and don't procrastinate my way
> > to abandoning the idea (an unfortunately likely proposition), I'd love
> > to.
> 
> How about starting with the attached patch, fixing compilation error in case
> there are any and writing a manpage entry for it ;-)

The attached version works for me, but I still don't have the manpage
part... Anyone volunteering to do that?

Greetings,
  Reimar Döffinger
-------------- next part --------------
Index: mixer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mixer.c,v
retrieving revision 1.18
diff -u -r1.18 mixer.c
--- mixer.c	28 Jul 2004 12:17:48 -0000	1.18
+++ mixer.c	31 Oct 2004 13:10:01 -0000
@@ -15,13 +15,15 @@
 
 char * mixer_device=NULL;
 char * mixer_channel=NULL;
+int soft_vol = 0;
+float soft_vol_normal = 90.0;
 
 void mixer_getvolume(mixer_t *mixer, float *l, float *r)
 {
   ao_control_vol_t vol;
   *l=0; *r=0;
   if(mixer->audio_out){
-    if(CONTROL_OK != mixer->audio_out->control(AOCONTROL_GET_VOLUME,&vol)) {
+    if(soft_vol || CONTROL_OK != mixer->audio_out->control(AOCONTROL_GET_VOLUME,&vol)) {
       if (!mixer->afilter)
         return;
       else {
@@ -31,8 +33,8 @@
           db_vals[0] = db_vals[1] = 1.0;
         else
         af_from_dB (2, db_vals, db_vals, 20.0, -200.0, 60.0);
-        vol.left = db_vals[0] * 90.0;
-        vol.right = db_vals[1] * 90.0;
+        vol.left = db_vals[0] * soft_vol_normal;
+        vol.right = db_vals[1] * soft_vol_normal;
       }
     }
     *r=vol.right;
@@ -45,7 +47,7 @@
   ao_control_vol_t vol;
   vol.right=r; vol.left=l;
   if(mixer->audio_out){
-    if(CONTROL_OK != mixer->audio_out->control(AOCONTROL_SET_VOLUME,&vol)) {
+    if(soft_vol || CONTROL_OK != mixer->audio_out->control(AOCONTROL_SET_VOLUME,&vol)) {
       if (!mixer->afilter)
         return;
       else {
@@ -54,10 +56,10 @@
         int i;
         // a volume of 90% will give 0 dB (no change)
         // like this, amplification is possible as well
-        db_vals[0] = l / 90.0;
-        db_vals[1] = r / 90.0;
+        db_vals[0] = l / soft_vol_normal;
+        db_vals[1] = r / soft_vol_normal;
         for (i = 2; i < AF_NCH; i++) {
-          db_vals[i] = (l + r) / 180.0;
+          db_vals[i] = (l + r) / (2 * soft_vol_normal);
         }
         af_to_dB (AF_NCH, db_vals, db_vals, 20.0);
         if (!af_control_any_rev(mixer->afilter,
Index: mixer.h
===================================================================
RCS file: /cvsroot/mplayer/main/mixer.h,v
retrieving revision 1.6
diff -u -r1.6 mixer.h
--- mixer.h	26 Jun 2004 09:14:20 -0000	1.6
+++ mixer.h	31 Oct 2004 13:10:01 -0000
@@ -6,6 +6,8 @@
 
 extern char * mixer_device;
 extern char * mixer_channel;
+extern int soft_vol;
+extern float soft_vol_normal;
 
 typedef struct mixer_s {
     ao_functions_t *audio_out;
Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.230
diff -u -r1.230 cfg-mplayer.h
--- cfg-mplayer.h	28 Oct 2004 23:25:17 -0000	1.230
+++ cfg-mplayer.h	31 Oct 2004 13:10:02 -0000
@@ -174,6 +174,9 @@
 	{"dsp", "Use -ao oss:dsp_path.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
         {"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
         {"mixer-channel", &mixer_channel, CONF_TYPE_STRING, 0, 0, 0, NULL},
+        {"softvol", &soft_vol, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+        {"nosoftvol", &soft_vol, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+        {"softvol-normal", &soft_vol_normal, CONF_TYPE_FLOAT, CONF_RANGE, 10, 200, NULL},
 	{"volstep", &volstep, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
 	{"master", "Option -master has been removed, use -aop list=volume instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
 	// override audio buffer size (used only by -ao oss, anyway obsolete...)


More information about the MPlayer-users mailing list