From b3cd4a824100b970ca24949a162d391e3f33d500 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 15 Sep 2021 16:06:18 +0200 Subject: [PATCH] Small fixes for EQ. --- MicroDexed.ino | 2 +- UI.hpp | 4 ++-- control_sgtl5000plus.cpp | 15 +++++++-------- control_sgtl5000plus.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 92b2f06..98787b2 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -2438,7 +2438,7 @@ void generate_version_string(char* buffer, uint8_t len) strncat(buffer, "-3.6", 4); #elif defined(TEENSY4_0) strncat(buffer, "-4.0", 4); -#elif defined(TEENSY4_0) +#elif defined(TEENSY4_1) strncat(buffer, "-4.1", 4); #endif #if defined(USE_FX) diff --git a/UI.hpp b/UI.hpp index 864d06a..ca3f0b2 100644 --- a/UI.hpp +++ b/UI.hpp @@ -8641,7 +8641,7 @@ void UI_func_eq_1(uint8_t param) } } lcd_display_meter_int("EQ Low-Cut [Hz]", configuration.fx.eq_1, 1.0, 0.0, EQ_1_MIN, EQ_1_MAX, 3, false, false, true); - sgtl5000.setEQFc(1, mapfloat(configuration.fx.eq_1, EQ_1_MIN, EQ_1_MAX, 15, 250)); + sgtl5000.setEQFc(1, configuration.fx.eq_1); sgtl5000.setEQGain(1, 6.0); sgtl5000.commitFilter(1); #ifdef DEBUG @@ -8930,7 +8930,7 @@ void UI_func_eq_7(uint8_t param) } } lcd_display_meter_float("EQ High-Cut[kHz]", configuration.fx.eq_7, 1.0, 0.0, EQ_7_MIN, EQ_7_MAX, 3, 1, false, false, true); - sgtl5000.setEQFc(7, mapfloat(configuration.fx.eq_7, EQ_7_MIN, EQ_7_MAX, EQ_7_MIN * 1000.0, EQ_7_MAX * 1000.0)); + sgtl5000.setEQFc(7, configuration.fx.eq_7); sgtl5000.commitFilter(7); #ifdef DEBUG sgtl5000.show_params(7); diff --git a/control_sgtl5000plus.cpp b/control_sgtl5000plus.cpp index 7abfec7..e2df989 100644 --- a/control_sgtl5000plus.cpp +++ b/control_sgtl5000plus.cpp @@ -128,17 +128,16 @@ void AudioControlSGTL5000Plus::setEQQ(uint8_t band, float q) } } -/* - // Calculate Q: http://www.sengpielaudio.com/calculator-bandwidth.htm - void setEQBandwidth(uint8_t band, float bw) - { +// Calculate Q: http://www.sengpielaudio.com/calculator-bandwidth.htm +// http://jdm12.ch/Audio/EQ_BPF-Q-bandwidth.asp +void AudioControlSGTL5000Plus::setEQBandwidth(uint8_t band, float bw) +{ if (Q && Fc && _enabled == true) { - band = constrain(band, 1, num_bands); - //Q[band - 1] = ; - } + band = constrain(band, 1, num_bands); + Q[band - 1] = sqrt(pow(2, bw)) / (pow(2, bw) - 1); } -*/ +} void AudioControlSGTL5000Plus::setEQGain(uint8_t band, float gain) { diff --git a/control_sgtl5000plus.h b/control_sgtl5000plus.h index 9711064..672e037 100644 --- a/control_sgtl5000plus.h +++ b/control_sgtl5000plus.h @@ -65,7 +65,7 @@ class AudioControlSGTL5000Plus : public AudioControlSGTL5000 void setEQType(uint8_t band, uint8_t ft); void setEQFc(uint8_t band, float frq); void setEQQ(uint8_t band, float q); - //void setEQBandwidth(uint8_t band, float bw); + void setEQBandwidth(uint8_t band, float bw); void setEQGain(uint8_t band, float gain); void commitFilter(uint8_t band); void show_params(uint8_t band);