summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index 7ea9ecfafd..daecd5c69e 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -624,48 +624,43 @@ static void apply_crossfeed(long* src[], int count)
624#define EQ_GAIN_USER2REAL(x) (((x) << 16) / 10) 624#define EQ_GAIN_USER2REAL(x) (((x) << 16) / 10)
625 625
626/* Synchronize the EQ filters with the global settings */ 626/* Synchronize the EQ filters with the global settings */
627void dsp_eq_update_data(bool enabled) 627void dsp_eq_update_data(bool enabled, int band)
628{ 628{
629 int i;
630 int *setting; 629 int *setting;
631 int gain, cutoff, q, maxgain; 630 int gain, cutoff, q;
632 631
633 dsp->eq_enabled = enabled; 632 dsp->eq_enabled = enabled;
634 setting = &global_settings.eq_band0_cutoff;
635 maxgain = 0;
636 633
634 /* Adjust setting pointer to the band we actually want to change */
635 setting = &global_settings.eq_band0_cutoff + (band * 3);
636
637 cutoff = *setting++;
638 q = *setting++;
639 gain = *setting++;
640
641 DEBUGF("cutoff %d, q %d, gain %d\n", cutoff, q, gain);
642
637 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 643 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
638 /* set emac unit for dsp processing, and save old macsr, we're running in 644 /* set emac unit for dsp processing, and save old macsr, we're running in
639 codec thread context at this point, so can't clobber it */ 645 codec thread context at this point, so can't clobber it */
640 unsigned long old_macsr = coldfire_get_macsr(); 646 unsigned long old_macsr = coldfire_get_macsr();
641 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE | EMAC_ROUND); 647 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE | EMAC_ROUND);
642 #endif 648 #endif
643
644 /* Iterate over each band and update the appropriate filter */
645 for(i = 0; i < 5; i++) {
646 cutoff = *setting++;
647 q = *setting++;
648 gain = *setting++;
649
650 /* Keep track of maxgain for the pre-amp */
651 if (gain > maxgain)
652 maxgain = gain;
653
654 if (gain == 0) {
655 eq_data.enabled[i] = 0;
656 } else {
657 if (i == 0)
658 eq_ls_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
659 EQ_GAIN_USER2REAL(gain), eq_data.filters[0].coefs);
660 else if (i == 4)
661 eq_hs_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
662 EQ_GAIN_USER2REAL(gain), eq_data.filters[4].coefs);
663 else
664 eq_pk_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
665 EQ_GAIN_USER2REAL(gain), eq_data.filters[i].coefs);
666 649
667 eq_data.enabled[i] = 1; 650 if (gain == 0) {
668 } 651 eq_data.enabled[band] = 0;
652 } else {
653 if (band == 0)
654 eq_ls_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
655 EQ_GAIN_USER2REAL(gain), eq_data.filters[band].coefs);
656 else if (band == 4)
657 eq_hs_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
658 EQ_GAIN_USER2REAL(gain), eq_data.filters[band].coefs);
659 else
660 eq_pk_coefs(EQ_CUTOFF_USER2REAL(cutoff), EQ_Q_USER2REAL(q),
661 EQ_GAIN_USER2REAL(gain), eq_data.filters[band].coefs);
662
663 eq_data.enabled[band] = 1;
669 } 664 }
670 665
671 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 666 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)