summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-02-04 23:16:31 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-02-04 23:16:31 +0000
commitdd8cb8a2c12a538e935d508e77794753f5f11276 (patch)
treeca6a135526ada7a629d8046af74bc30b37e83003
parent621bcc22940aed0242ed1795491a400521d2394d (diff)
downloadrockbox-dd8cb8a2c12a538e935d508e77794753f5f11276.tar.gz
rockbox-dd8cb8a2c12a538e935d508e77794753f5f11276.zip
Committed a little too much
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8569 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES1
-rw-r--r--apps/dsp.c58
-rw-r--r--apps/dsp.h1
-rw-r--r--apps/eq.c8
-rw-r--r--apps/lang/english.lang54
-rw-r--r--apps/settings.c22
-rw-r--r--apps/settings.h34
-rw-r--r--apps/sound_menu.c2
-rwxr-xr-xtools/buildzip.pl1
9 files changed, 6 insertions, 175 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index ef65789588..35f78c455e 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -78,5 +78,4 @@ eq_cf.S
78#elif defined(CPU_ARM) && !defined(SIMULATOR) 78#elif defined(CPU_ARM) && !defined(SIMULATOR)
79eq_arm.S 79eq_arm.S
80#endif 80#endif
81eq_menu.c
82#endif 81#endif
diff --git a/apps/dsp.c b/apps/dsp.c
index f403674ba2..789cf72b20 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -145,7 +145,6 @@ struct dsp_config
145 bool dither_enabled; 145 bool dither_enabled;
146 bool new_gain; 146 bool new_gain;
147 bool crossfeed_enabled; 147 bool crossfeed_enabled;
148 bool eq_enabled;
149}; 148};
150 149
151struct resample_data 150struct resample_data
@@ -619,52 +618,6 @@ static void apply_crossfeed(long* src[], int count)
619} 618}
620#endif 619#endif
621 620
622#define EQ_CUTOFF_USER2REAL(x) (0xffffffff / dsp->frequency * (x))
623#define EQ_Q_USER2REAL(x) (((x) << 16) / 10)
624#define EQ_GAIN_USER2REAL(x) (((x) << 16) / 10)
625
626/* Synchronize the EQ filters with the global settings */
627static void eq_update_data()
628{
629 int i;
630 int *setting;
631 int gain, cutoff, q, maxgain;
632
633 /* Don't do anything if we're not playing */
634 if (dsp->frequency == 0)
635 return;
636
637 setting = &global_settings.eq_band0_cutoff;
638 maxgain = 0;
639
640 /* Iterate over each band and update the appropriate filter */
641 for(i = 0; i < 5; i++) {
642 cutoff = *setting++;
643 q = *setting++;
644 gain = *setting++;
645
646 /* Keep track of maxgain for the pre-amp */
647 if (gain > maxgain)
648 maxgain = gain;
649
650 if (gain == 0) {
651 eq_data.enabled[i] = 0;
652 } else {
653 if (i == 0)
654 eq_ls_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
655 EQ_GAIN_USER2REAL(gain), eq_data.filters[0].coefs);
656 else if (i == 4)
657 eq_hs_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
658 EQ_GAIN_USER2REAL(gain), eq_data.filters[4].coefs);
659 else
660 eq_pk_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
661 EQ_GAIN_USER2REAL(gain), eq_data.filters[i].coefs);
662
663 eq_data.enabled[i] = 1;
664 }
665 }
666}
667
668/* Apply EQ filters to those bands that have got it switched on. */ 621/* Apply EQ filters to those bands that have got it switched on. */
669static void eq_process(long **x, unsigned num) 622static void eq_process(long **x, unsigned num)
670{ 623{
@@ -784,9 +737,6 @@ long dsp_process(char* dst, char* src[], long size)
784 size /= dsp->sample_bytes * factor; 737 size /= dsp->sample_bytes * factor;
785 dsp_set_replaygain(false); 738 dsp_set_replaygain(false);
786 739
787 if (dsp->eq_enabled)
788 eq_update_data();
789
790 while (size > 0) 740 while (size > 0)
791 { 741 {
792 samples = convert_to_internal(src, size, tmp); 742 samples = convert_to_internal(src, size, tmp);
@@ -795,7 +745,8 @@ long dsp_process(char* dst, char* src[], long size)
795 samples = resample(tmp, samples); 745 samples = resample(tmp, samples);
796 if (dsp->crossfeed_enabled && dsp->stereo_mode != STEREO_MONO) 746 if (dsp->crossfeed_enabled && dsp->stereo_mode != STEREO_MONO)
797 apply_crossfeed(tmp, samples); 747 apply_crossfeed(tmp, samples);
798 if (dsp->eq_enabled) 748 /* TODO: Might want to wrap this with a generic eq_enabled when the
749 settings are in place */
799 eq_process(tmp, samples); 750 eq_process(tmp, samples);
800 write_samples((short*) dst, tmp, samples); 751 write_samples((short*) dst, tmp, samples);
801 written += samples; 752 written += samples;
@@ -992,11 +943,6 @@ bool dsp_configure(int setting, void *value)
992 return 1; 943 return 1;
993} 944}
994 945
995void dsp_set_eq(bool enable)
996{
997 dsp->eq_enabled = enable;
998}
999
1000void dsp_set_crossfeed(bool enable) 946void dsp_set_crossfeed(bool enable)
1001{ 947{
1002 if (enable) 948 if (enable)
diff --git a/apps/dsp.h b/apps/dsp.h
index 11b20b1866..f86a4d9989 100644
--- a/apps/dsp.h
+++ b/apps/dsp.h
@@ -54,7 +54,6 @@ int dsp_stereo_mode(void);
54bool dsp_configure(int setting, void *value); 54bool dsp_configure(int setting, void *value);
55void dsp_set_replaygain(bool always); 55void dsp_set_replaygain(bool always);
56void dsp_set_crossfeed(bool enable); 56void dsp_set_crossfeed(bool enable);
57void dsp_set_eq(bool enable);
58void sound_set_pitch(int r); 57void sound_set_pitch(int r);
59int sound_get_pitch(void); 58int sound_get_pitch(void);
60#endif 59#endif
diff --git a/apps/eq.c b/apps/eq.c
index 7921028403..17165be541 100644
--- a/apps/eq.c
+++ b/apps/eq.c
@@ -32,11 +32,11 @@
32 */ 32 */
33 33
34#define DIV64(x, y, z) (long)(((long long)(x) << (z))/(y)) 34#define DIV64(x, y, z) (long)(((long long)(x) << (z))/(y))
35/* This macro requires the EMAC unit to be in fractional mode 35/* TODO: This macro requires the EMAC unit to be in fractional mode
36 when the coef generator routines are called. If this can't be guaranteeed, 36 when the coef generator routines are called. If this can be guaranteeed,
37 then add "&& 0" below. This will use a slower coef calculation on Coldfire. 37 then remove the "&& 0" below for faster coef calculation on Coldfire.
38 */ 38 */
39#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 39#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) && 0
40#define FRACMUL(x, y) \ 40#define FRACMUL(x, y) \
41({ \ 41({ \
42 long t; \ 42 long t; \
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index f024d645fe..a2803ad432 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3599,57 +3599,3 @@ eng: "Backdrop failed"
3599voice: "Backdrop failed" 3599voice: "Backdrop failed"
3600new: 3600new:
3601 3601
3602id: LANG_EQUALIZER
3603desc: in the sound settings menu
3604eng: "Equalizer"
3605voice: "Equalizer"
3606new:
3607
3608id: LANG_EQUALIZER_SETTINGS
3609desc: in the equalizer menu
3610eng: "Browse EQ Presets"
3611voice: "Browse EQ Presets"
3612new:
3613
3614id: LANG_EQUALIZER_GRAPHICAL
3615desc: in the equalizer menu
3616eng: "Graphical EQ"
3617voice: "Graphical EQ"
3618new:
3619
3620id: LANG_EQUALIZER_GAIN
3621desc: in the equalizer menu
3622eng: "EQ Gain"
3623voice: "EQ Gain"
3624new:
3625
3626id: LANG_EQUALIZER_GAIN_ITEM
3627desc: in the equalizer menu
3628eng: "%d Hz Band Gain"
3629voice: ""
3630new:
3631
3632id: LANG_EQUALIZER_ADVANCED
3633desc: in the equalizer menu
3634eng: "EQ Advanced Settings"
3635voice: "EQ Advanced Settings"
3636new:
3637
3638id: LANG_EQUALIZER_BAND_CUTOFF
3639desc: in the equalizer menu
3640eng: "Cutoff"
3641voice: "Cutoff"
3642new:
3643
3644id: LANG_EQUALIZER_BAND_Q
3645desc: in the equalizer menu
3646eng: "Q"
3647voice: "Q"
3648new:
3649
3650id: LANG_EQUALIZER_BAND_GAIN
3651desc: in the equalizer menu
3652eng: "Gain"
3653voice: "Gain"
3654new:
3655
diff --git a/apps/settings.c b/apps/settings.c
index fd1b530890..07db21ef66 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -508,28 +508,6 @@ static const struct bit_entry hd_bits[] =
508#endif 508#endif
509#endif /* HAVE_LCD_BITMAP */ 509#endif /* HAVE_LCD_BITMAP */
510 510
511#if CONFIG_CODEC == SWCODEC
512 {1, S_O(eq_enabled), false, "eq enabled", off_on },
513 /* 0..32768 Hz */
514 {15, S_O(eq_band0_cutoff), 60, "eq band 0 cutoff", NULL },
515 {15, S_O(eq_band1_cutoff), 200, "eq band 1 cutoff", NULL },
516 {15, S_O(eq_band2_cutoff), 800, "eq band 2 cutoff", NULL },
517 {15, S_O(eq_band3_cutoff), 4000, "eq band 3 cutoff", NULL },
518 {15, S_O(eq_band4_cutoff), 12000, "eq band 4 cutoff", NULL },
519 /* 0..64 (or 0.0 to 6.4) */
520 {6, S_O(eq_band0_q), 7, "eq band 0 q", NULL },
521 {6, S_O(eq_band1_q), 10, "eq band 1 q", NULL },
522 {6, S_O(eq_band2_q), 10, "eq band 2 q", NULL },
523 {6, S_O(eq_band3_q), 10, "eq band 3 q", NULL },
524 {6, S_O(eq_band4_q), 7, "eq band 4 q", NULL },
525 /* -240..240 (or -24db to +24db) */
526 {9|SIGNED, S_O(eq_band0_gain), 0, "eq band 0 gain", NULL },
527 {9|SIGNED, S_O(eq_band1_gain), 0, "eq band 1 gain", NULL },
528 {9|SIGNED, S_O(eq_band2_gain), 0, "eq band 2 gain", NULL },
529 {9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL },
530 {9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL },
531#endif
532
533 /* If values are just added to the end, no need to bump the version. */ 511 /* If values are just added to the end, no need to bump the version. */
534 /* new stuff to be added at the end */ 512 /* new stuff to be added at the end */
535 513
diff --git a/apps/settings.h b/apps/settings.h
index bb401b674e..bb58336202 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -39,7 +39,6 @@
39#define PLUGIN_DIR ROCKBOX_DIR"/rocks" 39#define PLUGIN_DIR ROCKBOX_DIR"/rocks"
40#define BACKDROP_DIR ROCKBOX_DIR"/backdrops" 40#define BACKDROP_DIR ROCKBOX_DIR"/backdrops"
41#define REC_BASE_DIR "/recordings" 41#define REC_BASE_DIR "/recordings"
42#define EQS_DIR ROCKBOX_DIR "/eqs"
43 42
44#define MAX_FILENAME 20 43#define MAX_FILENAME 20
45 44
@@ -409,39 +408,6 @@ struct user_settings
409 int brightness; /* iriver h300: backlight PWM value: 2..15 408 int brightness; /* iriver h300: backlight PWM value: 2..15
410 (0 and 1 are black) */ 409 (0 and 1 are black) */
411#endif 410#endif
412
413#if CONFIG_CODEC == SWCODEC
414 bool eq_enabled; /* Enable equalizer */
415
416 /* Order is important here, must be cutoff, q, then gain for each band.
417 See dsp_eq_update_data in dsp.c for why. */
418
419 /* Band 0 settings */
420 int eq_band0_cutoff; /* Hz */
421 int eq_band0_q;
422 int eq_band0_gain; /* +/- dB */
423
424 /* Band 1 settings */
425 int eq_band1_cutoff; /* Hz */
426 int eq_band1_q;
427 int eq_band1_gain; /* +/- dB */
428
429 /* Band 2 settings */
430 int eq_band2_cutoff; /* Hz */
431 int eq_band2_q;
432 int eq_band2_gain; /* +/- dB */
433
434 /* Band 3 settings */
435 int eq_band3_cutoff; /* Hz */
436 int eq_band3_q;
437 int eq_band3_gain; /* +/- dB */
438
439 /* Band 4 settings */
440 int eq_band4_cutoff; /* Hz */
441 int eq_band4_q;
442 int eq_band4_gain; /* +/- dB */
443#endif
444
445#ifdef HAVE_LCD_COLOR 411#ifdef HAVE_LCD_COLOR
446 unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */ 412 unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */
447#endif 413#endif
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index 2bd0ff6e59..e44aa68231 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -45,7 +45,6 @@
45#include "splash.h" 45#include "splash.h"
46#if CONFIG_CODEC == SWCODEC 46#if CONFIG_CODEC == SWCODEC
47#include "dsp.h" 47#include "dsp.h"
48#include "eq_menu.h"
49#endif 48#endif
50 49
51int selected_setting; /* Used by the callback */ 50int selected_setting; /* Used by the callback */
@@ -380,7 +379,6 @@ bool sound_menu(void)
380 { ID2P(LANG_STEREO_WIDTH), stereo_width }, 379 { ID2P(LANG_STEREO_WIDTH), stereo_width },
381#if CONFIG_CODEC == SWCODEC 380#if CONFIG_CODEC == SWCODEC
382 { ID2P(LANG_CROSSFEED), crossfeed }, 381 { ID2P(LANG_CROSSFEED), crossfeed },
383 { ID2P(LANG_EQUALIZER), eq_menu },
384#endif 382#endif
385#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 383#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
386 { ID2P(LANG_LOUDNESS), loudness }, 384 { ID2P(LANG_LOUDNESS), loudness },
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index fad73624ed..a9af7619db 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -91,7 +91,6 @@ sub buildzip {
91 mkdir ".rockbox/wps", 0777; 91 mkdir ".rockbox/wps", 0777;
92 mkdir ".rockbox/themes", 0777; 92 mkdir ".rockbox/themes", 0777;
93 mkdir ".rockbox/backdrops", 0777; 93 mkdir ".rockbox/backdrops", 0777;
94 mkdir ".rockbox/eqs", 0777;
95 94
96 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \;'; 95 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \;';
97 print `$c`; 96 print `$c`;