[MPlayer-dev-eng] [PATCH] ao effect plugin: extrastereo

pl p_l at gmx.fr
Sat Mar 2 15:47:07 CET 2002


Hi,

Here is a port of extrastereo plugin from xmms, which sometimes enhances
some audio outputs (YMMV).

Patch + file pl_extrastereo.c to put in libao2 attached.
If there's some interest and it's OK, I'll commit it.


Usage: -aop list=extrastereo
       -aop list=extrastereo:mul=4.2

The algo is:
  avg = (l + r) / 2
  l = avg + mul * (l - avg) 
  r = avg + mul * (r - avg)

Default mul coefficient is 2.5.
If mul=0.0 => mono sound
Id mul=1.0 => unchanged sound

-- 
Best regards,
  pl
-------------- next part --------------
Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.136
diff -u -r1.136 cfg-mplayer.h
--- cfg-mplayer.h	28 Feb 2002 13:48:04 -0000	1.136
+++ cfg-mplayer.h	2 Mar 2002 14:32:54 -0000
@@ -107,6 +107,7 @@
 	{"format", &ao_plugin_cfg.pl_format_type, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
 	{"fout", &ao_plugin_cfg.pl_resample_fout, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
 	{"volume", &ao_plugin_cfg.pl_volume_volume, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
+	{"mul", &ao_plugin_cfg.pl_extrastereo_mul, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL},
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
Index: libao2/Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- libao2/Makefile	25 Feb 2002 13:31:25 -0000	1.19
+++ libao2/Makefile	2 Mar 2002 14:32:57 -0000
@@ -4,7 +4,7 @@
 LIBNAME = libao2.a
 
 # TODO: moveout ao_sdl.c so it's only used when SDL is detected
-SRCS=afmt.c audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c ao_plugin.c pl_delay.c pl_format.c pl_surround.c remez.c pl_resample.c pl_volume.c $(OPTIONAL_SRCS)
+SRCS=afmt.c audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c ao_plugin.c pl_delay.c pl_format.c pl_surround.c remez.c pl_resample.c pl_volume.c pl_extrastereo.c $(OPTIONAL_SRCS)
 
 OBJS=$(SRCS:.c=.o)
 
Index: libao2/audio_plugin.h
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/audio_plugin.h,v
retrieving revision 1.7
diff -u -r1.7 audio_plugin.h
--- libao2/audio_plugin.h	25 Feb 2002 13:31:25 -0000	1.7
+++ libao2/audio_plugin.h	2 Mar 2002 14:32:57 -0000
@@ -36,6 +36,7 @@
   int pl_delay_len;	// Number of samples to delay sound output
   int pl_resample_fout;	// Output frequency from resampling
   int pl_volume_volume; // Initial volume setting
+  float pl_extrastereo_mul; // Stereo enhancer multiplier
 } ao_plugin_cfg_t;
 
 extern ao_plugin_cfg_t ao_plugin_cfg;
@@ -46,19 +47,21 @@
  AFMT_S16_LE, \
  0, \
  48000, \
- 255 \
+ 255, \
+ 2.5 \
 };
 
 // This block should not be available in the pl_xxxx files
 // due to compilation issues
 #ifndef PLUGIN
-#define NPL 5+1 // Number of PLugins ( +1 list ends with NULL )
+#define NPL 6+1 // Number of PLugins ( +1 list ends with NULL )
 // List of plugins 
 extern ao_plugin_functions_t audio_plugin_delay;
 extern ao_plugin_functions_t audio_plugin_format; 
 extern ao_plugin_functions_t audio_plugin_surround;
 extern ao_plugin_functions_t audio_plugin_resample;
 extern ao_plugin_functions_t audio_plugin_volume;
+extern ao_plugin_functions_t audio_plugin_extrastereo;
 
 
 #define AO_PLUGINS { \
@@ -67,6 +70,7 @@
    &audio_plugin_surround, \
    &audio_plugin_resample, \
    &audio_plugin_volume, \
+   &audio_plugin_extrastereo, \
    NULL \
 }
 #endif /* PLUGIN */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pl_extrastereo.c
Type: text/x-csrc
Size: 2312 bytes
Desc: pl_extrastereo.c
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20020302/a5183726/attachment.c>


More information about the MPlayer-dev-eng mailing list