From daebff8b5d2e4de9116e497781568d521f7ff1be Mon Sep 17 00:00:00 2001 From: Dan Everton Date: Tue, 28 Mar 2006 21:19:30 +0000 Subject: Update equalizer precut value as it's adjusted. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9332 a1c6a512-1295-4272-9138-f99709370657 --- apps/dsp.c | 15 +++++++++++---- apps/dsp.h | 5 +++-- apps/eq_menu.c | 20 ++++++++++---------- apps/settings.c | 5 +++-- 4 files changed, 27 insertions(+), 18 deletions(-) (limited to 'apps') diff --git a/apps/dsp.c b/apps/dsp.c index b199d4e693..9cdc715109 100644 --- a/apps/dsp.c +++ b/apps/dsp.c @@ -591,15 +591,22 @@ static void apply_crossfeed(int32_t* src[], int count) #endif /** - * Use to enable the equalizer and set any pregain. + * Use to enable the equalizer. * * @param enable true to enable the equalizer - * @param precut to apply in decibels (multiplied by 10) */ -void dsp_eq_set(bool enable, unsigned int precut) +void dsp_set_eq(bool enable) { dsp->eq_enabled = enable; +} +/** + * Update the amount to cut the audio before applying the equalizer. + * + * @param precut to apply in decibels (multiplied by 10) + */ +void dsp_set_eq_precut(int precut) +{ /* Needs to be in s8.23 format amplitude for apply_gain() */ dsp->eq_precut = get_replaygain_int(precut * -10) >> 1; } @@ -609,7 +616,7 @@ void dsp_eq_set(bool enable, unsigned int precut) * * @param band the equalizer band to synchronize */ -void dsp_eq_update_filter_coefs(int band) +void dsp_set_eq_coefs(int band) { const int *setting; long gain; diff --git a/apps/dsp.h b/apps/dsp.h index 35a1e88744..368326d7f2 100644 --- a/apps/dsp.h +++ b/apps/dsp.h @@ -54,8 +54,9 @@ int dsp_stereo_mode(void); bool dsp_configure(int setting, void *value); void dsp_set_replaygain(bool always); void dsp_set_crossfeed(bool enable); -void dsp_eq_set(bool enable, unsigned int precut); -void dsp_eq_update_filter_coefs(int band); +void dsp_set_eq(bool enable); +void dsp_set_eq_precut(int precut); +void dsp_set_eq_coefs(int band); void sound_set_pitch(int r); int sound_get_pitch(void); void channels_set(int value); diff --git a/apps/eq_menu.c b/apps/eq_menu.c index 61d38f473c..2e04a88f9a 100644 --- a/apps/eq_menu.c +++ b/apps/eq_menu.c @@ -147,11 +147,13 @@ static bool eq_enabled(void) bool result = set_bool(str(LANG_EQUALIZER_ENABLED), &global_settings.eq_enabled); - dsp_eq_set(global_settings.eq_enabled, global_settings.eq_precut); + dsp_set_eq(global_settings.eq_enabled); + + dsp_set_eq_precut(global_settings.eq_precut); /* Update all bands */ for(i = 0; i < 5; i++) { - dsp_eq_update_filter_coefs(i); + dsp_set_eq_coefs(i); } return result; @@ -160,11 +162,9 @@ static bool eq_enabled(void) static bool eq_precut(void) { bool result = set_int(str(LANG_EQUALIZER_PRECUT), str(LANG_UNIT_DB), - UNIT_DB, &global_settings.eq_precut, NULL, 5, 0, 240, + UNIT_DB, &global_settings.eq_precut, dsp_set_eq_precut, 5, 0, 240, eq_precut_format); - dsp_eq_set(global_settings.eq_enabled, global_settings.eq_precut); - return result; } @@ -178,7 +178,7 @@ static bool eq_set_band ## band ## _center(void) \ bool result = set_int(str(LANG_EQUALIZER_BAND_CENTER), "Hertz", \ UNIT_HERTZ, &global_settings.eq_band ## band ## _cutoff, NULL, \ EQ_CUTOFF_STEP, EQ_CUTOFF_MIN, EQ_CUTOFF_MAX, NULL); \ - dsp_eq_update_filter_coefs(band); \ + dsp_set_eq_coefs(band); \ return result; \ } @@ -188,7 +188,7 @@ static bool eq_set_band ## band ## _cutoff(void) \ bool result = set_int(str(LANG_EQUALIZER_BAND_CUTOFF), "Hertz", \ UNIT_HERTZ, &global_settings.eq_band ## band ## _cutoff, NULL, \ EQ_CUTOFF_STEP, EQ_CUTOFF_MIN, EQ_CUTOFF_MAX, NULL); \ - dsp_eq_update_filter_coefs(band); \ + dsp_set_eq_coefs(band); \ return result; \ } @@ -198,7 +198,7 @@ static bool eq_set_band ## band ## _q(void) \ bool result = set_int(str(LANG_EQUALIZER_BAND_Q), "Q", UNIT_INT, \ &global_settings.eq_band ## band ## _q, NULL, \ EQ_Q_STEP, EQ_Q_MIN, EQ_Q_MAX, eq_q_format); \ - dsp_eq_update_filter_coefs(band); \ + dsp_set_eq_coefs(band); \ return result; \ } @@ -208,7 +208,7 @@ static bool eq_set_band ## band ## _gain(void) \ bool result = set_int("Band " #band, str(LANG_UNIT_DB), UNIT_DB, \ &global_settings.eq_band ## band ## _gain, NULL, \ EQ_GAIN_STEP, EQ_GAIN_MIN, EQ_GAIN_MAX, eq_gain_format); \ - dsp_eq_update_filter_coefs(band); \ + dsp_set_eq_coefs(band); \ return result; \ } @@ -693,7 +693,7 @@ bool eq_menu_graphical(void) /* Update the filter if the user changed something */ if (has_changed) { - dsp_eq_update_filter_coefs(current_band); + dsp_set_eq_coefs(current_band); has_changed = false; } } diff --git a/apps/settings.c b/apps/settings.c index 5552eaa70c..e87e5247e6 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -1130,10 +1130,11 @@ void settings_apply(void) dsp_set_replaygain(true); dsp_set_crossfeed(global_settings.crossfeed); - dsp_eq_set(global_settings.eq_enabled, global_settings.eq_precut); + dsp_set_eq(global_settings.eq_enabled); + dsp_set_eq_precut(global_settings.eq_precut); /* Update all EQ bands */ for(i = 0; i < 5; i++) { - dsp_eq_update_filter_coefs(i); + dsp_set_eq_coefs(i); } #endif -- cgit v1.2.3