From 440d75f93873e2ed0e471d4cd7f27e0d2c324a16 Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Thu, 2 Feb 2006 20:03:43 +0000 Subject: No need for different name members in eq_data struct. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8534 a1c6a512-1295-4272-9138-f99709370657 --- apps/dsp.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/apps/dsp.c b/apps/dsp.c index b2fc0ce7a2..789cf72b20 100644 --- a/apps/dsp.c +++ b/apps/dsp.c @@ -172,9 +172,7 @@ struct crossfeed_data but adding peaking filters are possible. */ struct eq_state { char enabled[5]; /* Flags for active filters */ - struct eqfilter ls; - struct eqfilter pk[3]; - struct eqfilter hs; + struct eqfilter filters[5]; }; static struct dsp_config dsp_conf[2] IBSS_ATTR; @@ -621,22 +619,25 @@ static void apply_crossfeed(long* src[], int count) #endif /* Apply EQ filters to those bands that have got it switched on. */ -void eq_process(long **x, unsigned num) +static void eq_process(long **x, unsigned num) { int i; unsigned int channels = dsp->stereo_mode != STEREO_MONO ? 2 : 1; - + unsigned shift; + /* filter configuration currently is 1 low shelf filter, 3 band peaking - filters and 1 high shelf filter, in that order. + filters and 1 high shelf filter, in that order. we need to know this + so we can choose the correct shift factor. */ - if (eq_data.enabled[0]) - eq_filter(x, &eq_data.ls, num, channels, EQ_SHELF_SHIFT); - for (i = 0; i < 3; i++) { - if (eq_data.enabled[1 + i]) - eq_filter(x, &eq_data.pk[i], num, channels, EQ_PEAK_SHIFT); + for (i = 0; i < 5; i++) { + if (eq_data.enabled[i]) { + if (i == 0 || i == 4) /* shelving filters */ + shift = EQ_SHELF_SHIFT; + else + shift = EQ_PEAK_SHIFT; + eq_filter(x, &eq_data.filters[i], num, channels, shift); + } } - if (eq_data.enabled[4]) - eq_filter(x, &eq_data.hs, num, channels, EQ_SHELF_SHIFT); } /* Apply a constant gain to the samples (e.g., for ReplayGain). May update -- cgit v1.2.3