diff options
author | Dan Everton <dan@iocaine.org> | 2006-03-28 21:19:30 +0000 |
---|---|---|
committer | Dan Everton <dan@iocaine.org> | 2006-03-28 21:19:30 +0000 |
commit | daebff8b5d2e4de9116e497781568d521f7ff1be (patch) | |
tree | a2a92100b17c7ff29021a7aa85202a8595cc003b /apps | |
parent | fc9bc173353341c4a4e6c4a93bb0045743f5b8d1 (diff) | |
download | rockbox-daebff8b5d2e4de9116e497781568d521f7ff1be.tar.gz rockbox-daebff8b5d2e4de9116e497781568d521f7ff1be.zip |
Update equalizer precut value as it's adjusted.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9332 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dsp.c | 15 | ||||
-rw-r--r-- | apps/dsp.h | 5 | ||||
-rw-r--r-- | apps/eq_menu.c | 20 | ||||
-rw-r--r-- | apps/settings.c | 5 |
4 files changed, 27 insertions, 18 deletions
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) | |||
591 | #endif | 591 | #endif |
592 | 592 | ||
593 | /** | 593 | /** |
594 | * Use to enable the equalizer and set any pregain. | 594 | * Use to enable the equalizer. |
595 | * | 595 | * |
596 | * @param enable true to enable the equalizer | 596 | * @param enable true to enable the equalizer |
597 | * @param precut to apply in decibels (multiplied by 10) | ||
598 | */ | 597 | */ |
599 | void dsp_eq_set(bool enable, unsigned int precut) | 598 | void dsp_set_eq(bool enable) |
600 | { | 599 | { |
601 | dsp->eq_enabled = enable; | 600 | dsp->eq_enabled = enable; |
601 | } | ||
602 | 602 | ||
603 | /** | ||
604 | * Update the amount to cut the audio before applying the equalizer. | ||
605 | * | ||
606 | * @param precut to apply in decibels (multiplied by 10) | ||
607 | */ | ||
608 | void dsp_set_eq_precut(int precut) | ||
609 | { | ||
603 | /* Needs to be in s8.23 format amplitude for apply_gain() */ | 610 | /* Needs to be in s8.23 format amplitude for apply_gain() */ |
604 | dsp->eq_precut = get_replaygain_int(precut * -10) >> 1; | 611 | dsp->eq_precut = get_replaygain_int(precut * -10) >> 1; |
605 | } | 612 | } |
@@ -609,7 +616,7 @@ void dsp_eq_set(bool enable, unsigned int precut) | |||
609 | * | 616 | * |
610 | * @param band the equalizer band to synchronize | 617 | * @param band the equalizer band to synchronize |
611 | */ | 618 | */ |
612 | void dsp_eq_update_filter_coefs(int band) | 619 | void dsp_set_eq_coefs(int band) |
613 | { | 620 | { |
614 | const int *setting; | 621 | const int *setting; |
615 | long gain; | 622 | 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); | |||
54 | bool dsp_configure(int setting, void *value); | 54 | bool dsp_configure(int setting, void *value); |
55 | void dsp_set_replaygain(bool always); | 55 | void dsp_set_replaygain(bool always); |
56 | void dsp_set_crossfeed(bool enable); | 56 | void dsp_set_crossfeed(bool enable); |
57 | void dsp_eq_set(bool enable, unsigned int precut); | 57 | void dsp_set_eq(bool enable); |
58 | void dsp_eq_update_filter_coefs(int band); | 58 | void dsp_set_eq_precut(int precut); |
59 | void dsp_set_eq_coefs(int band); | ||
59 | void sound_set_pitch(int r); | 60 | void sound_set_pitch(int r); |
60 | int sound_get_pitch(void); | 61 | int sound_get_pitch(void); |
61 | void channels_set(int value); | 62 | 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) | |||
147 | bool result = set_bool(str(LANG_EQUALIZER_ENABLED), | 147 | bool result = set_bool(str(LANG_EQUALIZER_ENABLED), |
148 | &global_settings.eq_enabled); | 148 | &global_settings.eq_enabled); |
149 | 149 | ||
150 | dsp_eq_set(global_settings.eq_enabled, global_settings.eq_precut); | 150 | dsp_set_eq(global_settings.eq_enabled); |
151 | |||
152 | dsp_set_eq_precut(global_settings.eq_precut); | ||
151 | 153 | ||
152 | /* Update all bands */ | 154 | /* Update all bands */ |
153 | for(i = 0; i < 5; i++) { | 155 | for(i = 0; i < 5; i++) { |
154 | dsp_eq_update_filter_coefs(i); | 156 | dsp_set_eq_coefs(i); |
155 | } | 157 | } |
156 | 158 | ||
157 | return result; | 159 | return result; |
@@ -160,11 +162,9 @@ static bool eq_enabled(void) | |||
160 | static bool eq_precut(void) | 162 | static bool eq_precut(void) |
161 | { | 163 | { |
162 | bool result = set_int(str(LANG_EQUALIZER_PRECUT), str(LANG_UNIT_DB), | 164 | bool result = set_int(str(LANG_EQUALIZER_PRECUT), str(LANG_UNIT_DB), |
163 | UNIT_DB, &global_settings.eq_precut, NULL, 5, 0, 240, | 165 | UNIT_DB, &global_settings.eq_precut, dsp_set_eq_precut, 5, 0, 240, |
164 | eq_precut_format); | 166 | eq_precut_format); |
165 | 167 | ||
166 | dsp_eq_set(global_settings.eq_enabled, global_settings.eq_precut); | ||
167 | |||
168 | return result; | 168 | return result; |
169 | } | 169 | } |
170 | 170 | ||
@@ -178,7 +178,7 @@ static bool eq_set_band ## band ## _center(void) \ | |||
178 | bool result = set_int(str(LANG_EQUALIZER_BAND_CENTER), "Hertz", \ | 178 | bool result = set_int(str(LANG_EQUALIZER_BAND_CENTER), "Hertz", \ |
179 | UNIT_HERTZ, &global_settings.eq_band ## band ## _cutoff, NULL, \ | 179 | UNIT_HERTZ, &global_settings.eq_band ## band ## _cutoff, NULL, \ |
180 | EQ_CUTOFF_STEP, EQ_CUTOFF_MIN, EQ_CUTOFF_MAX, NULL); \ | 180 | EQ_CUTOFF_STEP, EQ_CUTOFF_MIN, EQ_CUTOFF_MAX, NULL); \ |
181 | dsp_eq_update_filter_coefs(band); \ | 181 | dsp_set_eq_coefs(band); \ |
182 | return result; \ | 182 | return result; \ |
183 | } | 183 | } |
184 | 184 | ||
@@ -188,7 +188,7 @@ static bool eq_set_band ## band ## _cutoff(void) \ | |||
188 | bool result = set_int(str(LANG_EQUALIZER_BAND_CUTOFF), "Hertz", \ | 188 | bool result = set_int(str(LANG_EQUALIZER_BAND_CUTOFF), "Hertz", \ |
189 | UNIT_HERTZ, &global_settings.eq_band ## band ## _cutoff, NULL, \ | 189 | UNIT_HERTZ, &global_settings.eq_band ## band ## _cutoff, NULL, \ |
190 | EQ_CUTOFF_STEP, EQ_CUTOFF_MIN, EQ_CUTOFF_MAX, NULL); \ | 190 | EQ_CUTOFF_STEP, EQ_CUTOFF_MIN, EQ_CUTOFF_MAX, NULL); \ |
191 | dsp_eq_update_filter_coefs(band); \ | 191 | dsp_set_eq_coefs(band); \ |
192 | return result; \ | 192 | return result; \ |
193 | } | 193 | } |
194 | 194 | ||
@@ -198,7 +198,7 @@ static bool eq_set_band ## band ## _q(void) \ | |||
198 | bool result = set_int(str(LANG_EQUALIZER_BAND_Q), "Q", UNIT_INT, \ | 198 | bool result = set_int(str(LANG_EQUALIZER_BAND_Q), "Q", UNIT_INT, \ |
199 | &global_settings.eq_band ## band ## _q, NULL, \ | 199 | &global_settings.eq_band ## band ## _q, NULL, \ |
200 | EQ_Q_STEP, EQ_Q_MIN, EQ_Q_MAX, eq_q_format); \ | 200 | EQ_Q_STEP, EQ_Q_MIN, EQ_Q_MAX, eq_q_format); \ |
201 | dsp_eq_update_filter_coefs(band); \ | 201 | dsp_set_eq_coefs(band); \ |
202 | return result; \ | 202 | return result; \ |
203 | } | 203 | } |
204 | 204 | ||
@@ -208,7 +208,7 @@ static bool eq_set_band ## band ## _gain(void) \ | |||
208 | bool result = set_int("Band " #band, str(LANG_UNIT_DB), UNIT_DB, \ | 208 | bool result = set_int("Band " #band, str(LANG_UNIT_DB), UNIT_DB, \ |
209 | &global_settings.eq_band ## band ## _gain, NULL, \ | 209 | &global_settings.eq_band ## band ## _gain, NULL, \ |
210 | EQ_GAIN_STEP, EQ_GAIN_MIN, EQ_GAIN_MAX, eq_gain_format); \ | 210 | EQ_GAIN_STEP, EQ_GAIN_MIN, EQ_GAIN_MAX, eq_gain_format); \ |
211 | dsp_eq_update_filter_coefs(band); \ | 211 | dsp_set_eq_coefs(band); \ |
212 | return result; \ | 212 | return result; \ |
213 | } | 213 | } |
214 | 214 | ||
@@ -693,7 +693,7 @@ bool eq_menu_graphical(void) | |||
693 | 693 | ||
694 | /* Update the filter if the user changed something */ | 694 | /* Update the filter if the user changed something */ |
695 | if (has_changed) { | 695 | if (has_changed) { |
696 | dsp_eq_update_filter_coefs(current_band); | 696 | dsp_set_eq_coefs(current_band); |
697 | has_changed = false; | 697 | has_changed = false; |
698 | } | 698 | } |
699 | } | 699 | } |
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) | |||
1130 | dsp_set_replaygain(true); | 1130 | dsp_set_replaygain(true); |
1131 | dsp_set_crossfeed(global_settings.crossfeed); | 1131 | dsp_set_crossfeed(global_settings.crossfeed); |
1132 | 1132 | ||
1133 | dsp_eq_set(global_settings.eq_enabled, global_settings.eq_precut); | 1133 | dsp_set_eq(global_settings.eq_enabled); |
1134 | dsp_set_eq_precut(global_settings.eq_precut); | ||
1134 | /* Update all EQ bands */ | 1135 | /* Update all EQ bands */ |
1135 | for(i = 0; i < 5; i++) { | 1136 | for(i = 0; i < 5; i++) { |
1136 | dsp_eq_update_filter_coefs(i); | 1137 | dsp_set_eq_coefs(i); |
1137 | } | 1138 | } |
1138 | #endif | 1139 | #endif |
1139 | 1140 | ||