changeset 4299:a16edefb8836

- 1st attempt to integrate MPlayer's equalizer (will work in 24bit mode too). Please, check sound quality! Let me know, if you will find it not appropriate. - EQ pregain doesn't work yet.
author Eugene Zagidullin <e.asphyx@gmail.com>
date Sat, 23 Feb 2008 16:34:10 +0300
parents 5b277773870e
children 060c9865ea17
files src/audacious/Makefile src/audacious/output.c
diffstat 2 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/Makefile	Mon Feb 18 23:20:12 2008 +0300
+++ b/src/audacious/Makefile	Sat Feb 23 16:34:10 2008 +0300
@@ -3,7 +3,8 @@
 SUBDIRS = ${INTL_OBJECTIVE}
 
 PROG = audacious${PROG_SUFFIX}
-SRCS = auddrct.c						\
+SRCS = af_equalizer.c						\
+       auddrct.c						\
        build_stamp.c					\
        configdb.c						\
        custom_uri.c						\
@@ -11,6 +12,7 @@
        dnd.c							\
        dock.c							\
        effect.c							\
+       equalizer_flow.c						\
        eventqueue.c						\
        fft.c							\
        flow.c							\
--- a/src/audacious/output.c	Mon Feb 18 23:20:12 2008 +0300
+++ b/src/audacious/output.c	Sat Feb 23 16:34:10 2008 +0300
@@ -23,7 +23,7 @@
  *  Audacious or using our public API to be a derived work.
  */
 
-/* #define AUD_DEBUG */
+#define AUD_DEBUG
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
@@ -48,6 +48,7 @@
 
 #include "libSAD.h"
 #include "util.h"
+#include "equalizer_flow.h"
 
 #include <math.h>
 
@@ -222,14 +223,24 @@
 output_set_eq(gboolean active, gfloat pre, gfloat * bands)
 {
     int i;
+    /*
     preamp[0] = 1.0 + 0.0932471 * pre + 0.00279033 * pre * pre;
     preamp[1] = 1.0 + 0.0932471 * pre + 0.00279033 * pre * pre;
+    AUDDBG("preamp: %f, bands: %f:%f:%f:%f:%f:%f:%f:%f:%f:%f\n", pre, bands[0], bands[1], bands[2], bands[3], bands[4],
+            bands[5], bands[6], bands[7], bands[8], bands[9]);
 
     for (i = 0; i < 10; ++i)
     {
         set_gain(i, 0, 0.03 * bands[i] + 0.000999999 * bands[i] * bands[i]);
         set_gain(i, 1, 0.03 * bands[i] + 0.000999999 * bands[i] * bands[i]);
     }
+    */
+
+    gfloat b[10];
+    for (i = 0; i < 10; i++) {
+        b[i] = bands[i] * 12.0 / 20.0; /* FIXME: change equalizer sliders range from -20..20 to -12..12 dB --asphyx */
+    }
+    equalizer_flow_set_bands(pre, b);
 }
 
 /* called by input plugin to peek at the output plugin's write progress */
@@ -452,6 +463,7 @@
 
     /* Reset the op_state. */
     op_state.fmt = op_state.rate = op_state.nch = 0;
+    equalizer_flow_free();
 }
 
 void
@@ -528,7 +540,7 @@
         if (legacy_flow == NULL)
         {
             legacy_flow = flow_new();
-            flow_link_element(legacy_flow, iir_flow);
+            /*flow_link_element(legacy_flow, iir_flow);*/
             flow_link_element(legacy_flow, effect_flow);
         }
         
@@ -539,6 +551,7 @@
 #ifdef USE_SRC
             flow_link_element(postproc_flow, src_flow);
 #endif
+            flow_link_element(postproc_flow, equalizer_flow);
             flow_link_element(postproc_flow, volumecontrol_flow);
         }