# HG changeset patch # User Eugene Zagidullin # Date 1204571607 -10800 # Node ID e548627b20045469933700a74a3a6bc434933690 # Parent 772de6f365cf851f16ac88413367cb9b2e604105 EQ pregain works. nobody uses it though diff -r 772de6f365cf -r e548627b2004 src/audacious/equalizer_flow.c --- a/src/audacious/equalizer_flow.c Sun Mar 02 22:04:03 2008 +0300 +++ b/src/audacious/equalizer_flow.c Mon Mar 03 22:13:27 2008 +0300 @@ -20,6 +20,7 @@ /*#define AUD_DEBUG*/ #include +#include #include "main.h" #include "plugin.h" #include "flow.h" @@ -81,14 +82,27 @@ { int i; af_control_ext_t ctl; + gfloat b[10]; + gfloat adj = 0.0; AUDDBG("\n"); if(eq == NULL) { eq = g_malloc(sizeof(af_instance_t)); equalizer_open(eq); } - - ctl.arg = bands; + + for(i = 0; i < 10; i++) + b[i] = bands[i] + pre; + + for(i = 0; i < 10; i++) + if(fabsf(b[i]) > fabsf(adj)) adj = b[i]; + + if(fabsf(adj) > EQUALIZER_MAX_GAIN) { + adj = adj > 0.0 ? EQUALIZER_MAX_GAIN - adj : -EQUALIZER_MAX_GAIN - adj; + for(i = 0; i < 10; i++) b[i] += adj; + } + + ctl.arg = b; for(i = 0; i < AF_NCH; i++) { ctl.ch = i; eq->control(eq, AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &ctl);