summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c58
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
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)