summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-03-24 14:06:30 +0000
committerDan Everton <dan@iocaine.org>2006-03-24 14:06:30 +0000
commitfac50d12bf33496873e99769e527bc4b9aa676fd (patch)
treef022b631dcaaa0f435c73404281a1a3773a1f996 /apps
parentc76904be53352ec1e7a743de1e7ea2ce51b513d2 (diff)
downloadrockbox-fac50d12bf33496873e99769e527bc4b9aa676fd.zip
rockbox-fac50d12bf33496873e99769e527bc4b9aa676fd.tar.gz
rockbox-fac50d12bf33496873e99769e527bc4b9aa676fd.tar.bz2
rockbox-fac50d12bf33496873e99769e527bc4b9aa676fd.tar.xz
Slightly clearer code in dsp_eq_update_data.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9231 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/dsp.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index 6e6f702..1f477d3 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -589,27 +589,24 @@ static void apply_crossfeed(int32_t* src[], int count)
}
#endif
-#define EQ_CUTOFF_USER2REAL(x) (0xffffffff / NATIVE_FREQUENCY * (x))
-#define EQ_Q_USER2REAL(x) (((x) << 16) / 10)
-#define EQ_GAIN_USER2REAL(x) (((x) << 16) / 10)
-
/* Synchronize the EQ filters with the global settings */
void dsp_eq_update_data(bool enabled, int band)
{
- int *setting;
- int gain, cutoff, q;
+ const int *setting;
+ long gain;
+ unsigned long cutoff, q;
dsp->eq_enabled = enabled;
/* Adjust setting pointer to the band we actually want to change */
setting = &global_settings.eq_band0_cutoff + (band * 3);
- cutoff = *setting++;
- q = *setting++;
- gain = *setting++;
-
- DEBUGF("cutoff %d, q %d, gain %d\n", cutoff, q, gain);
+ /* Convert user settings to format required by coef generator functions */
+ cutoff = 0xffffffff / NATIVE_FREQUENCY * (*setting++);
+ q = ((*setting++) << 16) / 10; /* 16.16 */
+ gain = ((*setting++) << 16) / 10; /* s15.16 */
+ /* The coef functions assume the EMAC unit is in fractional mode */
#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
/* set emac unit for dsp processing, and save old macsr, we're running in
codec thread context at this point, so can't clobber it */
@@ -617,18 +614,16 @@ void dsp_eq_update_data(bool enabled, int band)
coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE | EMAC_ROUND);
#endif
+ /* Assume a band is disabled if the gain is zero */
if (gain == 0) {
eq_data.enabled[band] = 0;
} else {
if (band == 0)
- eq_ls_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
- EQ_GAIN_USER2REAL(gain), eq_data.filters[band].coefs);
+ eq_ls_coefs(cutoff, q, gain, eq_data.filters[band].coefs);
else if (band == 4)
- eq_hs_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
- EQ_GAIN_USER2REAL(gain), eq_data.filters[band].coefs);
+ eq_hs_coefs(cutoff, q, gain, eq_data.filters[band].coefs);
else
- eq_pk_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
- EQ_GAIN_USER2REAL(gain), eq_data.filters[band].coefs);
+ eq_pk_coefs(cutoff, q, gain, eq_data.filters[band].coefs);
eq_data.enabled[band] = 1;
}