Fixing parametric EQ.

pull/89/head
Holger Wirtz 3 years ago
parent a878f5f8f5
commit 5fe3505140
  1. 4
      MicroDexed.ino
  2. 2
      UI.hpp
  3. 19
      control_sgtl5000plus.cpp
  4. 15
      control_sgtl5000plus.h

@ -634,10 +634,6 @@ void setup()
audio_thru_mixer_l.gain(3, 0.0); audio_thru_mixer_l.gain(3, 0.0);
#endif #endif
#ifdef SGTL5000_AUDIO_ENHANCE
//setup_sgtl5000_graphic_7band_eq();
#endif
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("<setup end>")); Serial.println(F("<setup end>"));
#endif #endif

@ -7720,6 +7720,8 @@ void UI_func_eq_1(uint8_t param)
sgtl5000.setEQGain(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, -9.9, 9.9)); sgtl5000.setEQGain(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, -9.9, 9.9));
sgtl5000.commitFilter(1); sgtl5000.commitFilter(1);
#ifdef DEBUG #ifdef DEBUG
Serial.print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Serial.println(mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, -9.9, 9.9), 3);
sgtl5000.show_params(1); sgtl5000.show_params(1);
#endif #endif
} }

@ -28,8 +28,8 @@
void AudioControlSGTL5000Plus::init_parametric_eq(void) void AudioControlSGTL5000Plus::init_parametric_eq(void)
{ {
//eqSelect(PARAMETRIC_EQUALIZER); eqSelect(PARAMETRIC_EQUALIZER);
//eqFilterCount(num_bands); eqFilterCount(num_bands);
filter_type = new uint8_t[num_bands]; filter_type = new uint8_t[num_bands];
Fc = new float[num_bands]; Fc = new float[num_bands];
@ -115,15 +115,24 @@ void AudioControlSGTL5000Plus::setEQFc(uint8_t band, float frq)
} }
} }
void AudioControlSGTL5000Plus::setEQQ(uint8_t band, float q) // Calculate Q: http://www.sengpielaudio.com/calculator-bandwidth.htm
{ /* void AudioControlSGTL5000Plus::setEQQ(uint8_t band, float q)
{
if (Q) if (Q)
{ {
band = constrain(band, 1, num_bands); band = constrain(band, 1, num_bands);
Q[band - 1] = q; Q[band - 1] = q;
} }
} }*/
void setEQBandwidth(uint8_t band, float bw);
{
if (Q && Fc)
{
band = constrain(band, 1, num_bands);
//Q[band - 1] = ;
}
}
void AudioControlSGTL5000Plus::setEQGain(uint8_t band, float gain) void AudioControlSGTL5000Plus::setEQGain(uint8_t band, float gain)
{ {
if (peakGainDB) if (peakGainDB)

@ -30,31 +30,31 @@
#define EQ_TYPE_0 FILTER_HIPASS #define EQ_TYPE_0 FILTER_HIPASS
#define EQ_CENTER_FRQ_0 50.0 #define EQ_CENTER_FRQ_0 50.0
#define EQ_Q_0 0.5 #define EQ_Q_0 0.126984
#define EQ_TYPE_1 FILTER_PARAEQ #define EQ_TYPE_1 FILTER_PARAEQ
#define EQ_CENTER_FRQ_1 120.0 #define EQ_CENTER_FRQ_1 120.0
#define EQ_Q_1 0.5 #define EQ_Q_1 0.126984
#define EQ_TYPE_2 FILTER_PARAEQ #define EQ_TYPE_2 FILTER_PARAEQ
#define EQ_CENTER_FRQ_2 220.0 #define EQ_CENTER_FRQ_2 220.0
#define EQ_Q_2 0.5 #define EQ_Q_2 0.126984
#define EQ_TYPE_3 FILTER_PARAEQ #define EQ_TYPE_3 FILTER_PARAEQ
#define EQ_CENTER_FRQ_3 1000.0 #define EQ_CENTER_FRQ_3 1000.0
#define EQ_Q_3 0.5 #define EQ_Q_3 0.126984
#define EQ_TYPE_4 FILTER_PARAEQ #define EQ_TYPE_4 FILTER_PARAEQ
#define EQ_CENTER_FRQ_4 2000.0 #define EQ_CENTER_FRQ_4 2000.0
#define EQ_Q_4 0.5 #define EQ_Q_4 0.126984
#define EQ_TYPE_5 FILTER_PARAEQ #define EQ_TYPE_5 FILTER_PARAEQ
#define EQ_CENTER_FRQ_5 7000.0 #define EQ_CENTER_FRQ_5 7000.0
#define EQ_Q_5 0.5 #define EQ_Q_5 0.126984
#define EQ_TYPE_6 FILTER_LOPASS #define EQ_TYPE_6 FILTER_LOPASS
#define EQ_CENTER_FRQ_6 10000.0 #define EQ_CENTER_FRQ_6 10000.0
#define EQ_Q_6 0.5 #define EQ_Q_6 0.126984
class AudioControlSGTL5000Plus : public AudioControlSGTL5000 class AudioControlSGTL5000Plus : public AudioControlSGTL5000
{ {
@ -66,6 +66,7 @@ class AudioControlSGTL5000Plus : public AudioControlSGTL5000
void setEQType(uint8_t band, uint8_t ft); void setEQType(uint8_t band, uint8_t ft);
void setEQFc(uint8_t band, float frq); void setEQFc(uint8_t band, float frq);
void setEQQ(uint8_t band, float q); void setEQQ(uint8_t band, float q);
//void setEQBandwidth(uint8_t band, float bw);
void setEQGain(uint8_t band, float gain); void setEQGain(uint8_t band, float gain);
void commitFilter(uint8_t band); void commitFilter(uint8_t band);
void show_params(uint8_t band); void show_params(uint8_t band);

Loading…
Cancel
Save