diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-02-04 23:16:31 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-02-04 23:16:31 +0000 |
commit | dd8cb8a2c12a538e935d508e77794753f5f11276 (patch) | |
tree | ca6a135526ada7a629d8046af74bc30b37e83003 /apps/dsp.c | |
parent | 621bcc22940aed0242ed1795491a400521d2394d (diff) | |
download | rockbox-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
Diffstat (limited to 'apps/dsp.c')
-rw-r--r-- | apps/dsp.c | 58 |
1 files changed, 2 insertions, 56 deletions
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 | ||
151 | struct resample_data | 150 | struct 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 */ | ||
627 | static 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. */ |
669 | static void eq_process(long **x, unsigned num) | 622 | static 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 | ||
995 | void dsp_set_eq(bool enable) | ||
996 | { | ||
997 | dsp->eq_enabled = enable; | ||
998 | } | ||
999 | |||
1000 | void dsp_set_crossfeed(bool enable) | 946 | void dsp_set_crossfeed(bool enable) |
1001 | { | 947 | { |
1002 | if (enable) | 948 | if (enable) |