Fixes for parametric-eq and T_3.6.

pull/95/head
Holger Wirtz 3 years ago
parent 37e60acb2c
commit a9b10f4729
  1. 5
      MicroDexed.ino
  2. 26
      control_sgtl5000plus.cpp
  3. 8
      control_sgtl5000plus.h
  4. 4
      sequencer.cpp

@ -119,7 +119,7 @@ AudioMixer8 drum_reverb_send_mixer_l;
#if defined(TEENSY_AUDIO_BOARD)
AudioOutputI2S i2s1;
#ifdef SGTL5000_AUDIO_ENHANCE
AudioControlSGTL5000Plus sgtl5000(7);
AudioControlSGTL5000Plus sgtl5000;
#else
AudioControlSGTL5000 sgtl5000;
#endif
@ -433,6 +433,7 @@ void setup()
#endif
#ifdef SGTL5000_AUDIO_ENHANCE
sgtl5000.audioPostProcessorEnable();
sgtl5000.init_parametric_eq(7);
//sgtl5000.enhanceBassEnable();
//sgtl5000.enhanceBass(1.0, 1.5, 0, 5); // enhanceBass(1.0, 1.0, 1, 2); // Configures the bass enhancement by setting the levels of the original stereo signal and the bass-enhanced mono level which will be mixed together. The high-pass filter may be enabled (0) or bypassed (1).
//sgtl5000.surroundSoundEnable();
@ -663,7 +664,7 @@ void loop()
if (seq_step != seq_UI_last_step)
{
seq_UI_last_step = seq_step;
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) //is in UI of Sequencer
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) //is in UI of Sequencer
{
lcd.setCursor(seq_step, 1);
lcd.print("X");

@ -26,8 +26,10 @@
#include <Audio.h>
#include "control_sgtl5000plus.h"
void AudioControlSGTL5000Plus::init_parametric_eq(void)
void AudioControlSGTL5000Plus::init_parametric_eq(uint8_t n)
{
num_bands = constrain(n, 1, 7);
eqSelect(PARAMETRIC_EQUALIZER);
eqFilterCount(num_bands);
@ -95,11 +97,13 @@ void AudioControlSGTL5000Plus::init_parametric_eq(void)
setEQGain(7, 0.0);
commitFilter(7);
}
_enabled = true;
}
void AudioControlSGTL5000Plus::setEQType(uint8_t band, uint8_t ft)
{
if (filter_type)
if (filter_type && _enabled == true)
{
band = constrain(band, 1, num_bands);
filter_type[band - 1] = ft;
@ -108,7 +112,7 @@ void AudioControlSGTL5000Plus::setEQType(uint8_t band, uint8_t ft)
void AudioControlSGTL5000Plus::setEQFc(uint8_t band, float frq)
{
if (Fc)
if (Fc && _enabled == true)
{
band = constrain(band, 1, num_bands);
Fc[band - 1] = frq;
@ -117,7 +121,7 @@ void AudioControlSGTL5000Plus::setEQFc(uint8_t band, float frq)
void AudioControlSGTL5000Plus::setEQQ(uint8_t band, float q)
{
if (Q)
if (Q && _enabled == true)
{
band = constrain(band, 1, num_bands);
Q[band - 1] = q;
@ -128,7 +132,7 @@ void AudioControlSGTL5000Plus::setEQQ(uint8_t band, float q)
// Calculate Q: http://www.sengpielaudio.com/calculator-bandwidth.htm
void setEQBandwidth(uint8_t band, float bw)
{
if (Q && Fc)
if (Q && Fc && _enabled == true)
{
band = constrain(band, 1, num_bands);
//Q[band - 1] = ;
@ -138,7 +142,7 @@ void AudioControlSGTL5000Plus::setEQQ(uint8_t band, float q)
void AudioControlSGTL5000Plus::setEQGain(uint8_t band, float gain)
{
if (peakGainDB)
if (peakGainDB && _enabled == true)
{
band = constrain(band, 1, num_bands);
peakGainDB[band - 1] = gain;
@ -149,6 +153,9 @@ void AudioControlSGTL5000Plus::commitFilter(uint8_t band)
{
int filter[5] = {0, 0, 0, 0, 0};
if (_enabled == false)
return;
band = constrain(band, 1, num_bands);
calcBiquad(filter_type[band - 1], Fc[band - 1], peakGainDB[band - 1], Q[band - 1], 0x80000, AUDIO_SAMPLE_RATE, filter);
@ -157,6 +164,12 @@ void AudioControlSGTL5000Plus::commitFilter(uint8_t band)
void AudioControlSGTL5000Plus::show_params(uint8_t band)
{
if (_enabled == false)
{
Serial.print(F("Parametric-EQ not initialized!"));
}
else
{
Serial.print(F("Band: "));
Serial.print(band, DEC);
Serial.print(F(" Type:"));
@ -168,4 +181,5 @@ void AudioControlSGTL5000Plus::show_params(uint8_t band)
Serial.print(F(" peakGainDB:"));
Serial.print(peakGainDB[band - 1], 1);
Serial.println();
}
}

@ -59,9 +59,8 @@
class AudioControlSGTL5000Plus : public AudioControlSGTL5000
{
public:
AudioControlSGTL5000Plus(uint8_t n = 7) {
num_bands = constrain(n, 1, 7);
init_parametric_eq();
AudioControlSGTL5000Plus() {
_enabled = false;
};
void setEQType(uint8_t band, uint8_t ft);
void setEQFc(uint8_t band, float frq);
@ -70,9 +69,10 @@ class AudioControlSGTL5000Plus : public AudioControlSGTL5000
void setEQGain(uint8_t band, float gain);
void commitFilter(uint8_t band);
void show_params(uint8_t band);
void init_parametric_eq(uint8_t n = 7);
private:
void init_parametric_eq(void);
bool _enabled;
uint8_t num_bands;
uint8_t* filter_type;
float* Fc;

@ -10,7 +10,7 @@ extern config_t configuration;
extern uint8_t drum_midi_channel;
extern void handleNoteOn(byte , byte , byte );
extern void handleNoteOff(byte , byte , byte );
extern void UI_func_sequencer(uint8_t);
extern void UI_func_seq_pattern_editor(uint8_t);
extern void UI_func_arpeggio(uint8_t);
extern const char* seq_find_shortname(uint8_t);
boolean interrupt_swapper = false;
@ -27,7 +27,7 @@ void sequencer_part1(void)
//}
//record to sequencer if sequencer menu is active and recording is active
if (seq_note_in > 0 && seq_recording == true && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) {
if (seq_note_in > 0 && seq_recording == true && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) {
seq_data[seq_active_track][seq_step] = seq_note_in;
seq_vel[seq_active_track][seq_step] = seq_note_in_velocity;
seq_note_in = 0;

Loading…
Cancel
Save