Added SGTL5000 EQ (2 band tone control).

pull/32/head
Holger Wirtz 5 years ago
parent 65861b256f
commit a43b6ace1e
  1. 9
      MicroDexed.ino
  2. 89
      UI.hpp
  3. 125
      UI_FX.h
  4. 12
      config.h

@ -287,8 +287,9 @@ void setup()
sgtl5000_1.unmuteHeadphone();
sgtl5000_1.unmuteLineout();
sgtl5000_1.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume
#ifdef SGTL5000_AUDIO_ENHANCE
sgtl5000_1.audioProcessorDisable();
sgtl5000_1.audioPostProcessorEnable();
#ifdef SGTL5000_AUDIO_ENHANCE
sgtl5000_1.enhanceBassEnable();
sgtl5000_1.enhanceBass(1.0, 1.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_1.surroundSoundEnable();
@ -305,7 +306,8 @@ void setup()
5 200Hz
6 225Hz
*/
//sgtl5000_1.eqBands(bass, mid_bass, midrange, mid_treble, treble);
sgtl5000_1.eqSelect(2); // Tone Control
sgtl5000_1.eqBands(EQ_BASS_DEFAULT, EQ_TREBLE_DEFAULT);
#else
sgtl5000_1.autoVolumeDisable();
sgtl5000_1.surroundSoundDisable();
@ -1762,6 +1764,9 @@ void set_fx_params(void)
master_mixer_r.gain(3, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)));
master_mixer_l.gain(3, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)));
#endif
#ifdef SGTL5000_AUDIO_ENHANCE
sgtl5000_1.eqBands(mapfloat(configuration.fx.eq_bass, EQ_BASS_MIN, EQ_BASS_MAX, -1.0, 1.0), mapfloat(configuration.fx.eq_treble, EQ_TREBLE_MIN, EQ_TREBLE_MAX, -1.0, 1.0));
#endif
}
void set_voiceconfig_params(uint8_t instance_id)

@ -249,6 +249,8 @@ void UI_func_sysex_receive_voice(uint8_t param);
void UI_func_save_voice(uint8_t param);
void UI_func_sysex_receive_bank(uint8_t param);
void UI_func_sysex_send_bank(uint8_t param);
void UI_func_eq_bass(uint8_t param);
void UI_func_eq_treble(uint8_t param);
void UI_function_not_enabled(void);
void UI_function_not_implemented(uint8_t param);
void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign);
@ -4806,6 +4808,93 @@ void UI_func_sysex_receive_voice(uint8_t param)
}
}
void UI_func_eq_bass(uint8_t param)
{
#ifndef SGTL5000_AUDIO_ENHANCE
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("EQ Bass"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
}
#else
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd_special_chars(METERBAR);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
{
configuration.fx.eq_bass = constrain(configuration.fx.eq_bass + ENCODER[ENC_R].speed(), EQ_BASS_MIN, EQ_BASS_MAX);
}
else if (LCDML.BT_checkUp())
{
configuration.fx.eq_bass = constrain(configuration.fx.eq_bass - ENCODER[ENC_R].speed(), EQ_BASS_MIN, EQ_BASS_MAX);
}
}
lcd_display_meter_float("EQ Bass", configuration.fx.eq_bass, 0.1, 0.0, EQ_BASS_MIN, EQ_BASS_MAX, 1, 1, false, true, true);
sgtl5000_1.eqBands(mapfloat(configuration.fx.eq_bass, EQ_BASS_MIN, EQ_BASS_MAX, -1.0, 1.0), mapfloat(configuration.fx.eq_treble, EQ_TREBLE_MIN, EQ_TREBLE_MAX, -1.0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.eq_bass), configuration.fx.eq_bass);
}
#endif
}
void UI_func_eq_treble(uint8_t param)
{
#ifndef SGTL5000_AUDIO_ENHANCE
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("EQ Bass"));
lcd.setCursor(0, 1);
lcd.print(F("Not implemented."));
}
#else
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd_special_chars(METERBAR);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
{
configuration.fx.eq_treble = constrain(configuration.fx.eq_treble + ENCODER[ENC_R].speed(), EQ_TREBLE_MIN, EQ_TREBLE_MAX);
}
else if (LCDML.BT_checkUp())
{
configuration.fx.eq_treble = constrain(configuration.fx.eq_treble - ENCODER[ENC_R].speed(), EQ_TREBLE_MIN, EQ_TREBLE_MAX);
}
}
lcd_display_meter_float("EQ TREBLE", configuration.fx.eq_treble, 0.1, 0.0, EQ_TREBLE_MIN, EQ_TREBLE_MAX, 1, 1, false, true, true);
sgtl5000_1.eqBands(mapfloat(configuration.fx.eq_treble, EQ_TREBLE_MIN, EQ_TREBLE_MAX, -1.0, 1.0), mapfloat(configuration.fx.eq_treble, EQ_TREBLE_MIN, EQ_TREBLE_MAX, -1.0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.eq_treble), configuration.fx.eq_treble);
}
#endif
}
void UI_function_not_enabled(void)
{

@ -48,65 +48,68 @@ LCDML_add(19, LCDML_0_1_2_3_4, 1, "Roomsize", UI_func_reverb_roomsize);
LCDML_add(20, LCDML_0_1_2_3_4, 2, "Damping", UI_func_reverb_damping);
LCDML_add(21, LCDML_0_1_2_3_4, 3, "Level", UI_func_reverb_level);
LCDML_add(22, LCDML_0_1_2_3_4, 4, "Reverb Send", UI_func_reverb_send);
LCDML_add(23, LCDML_0_1, 3, "Controller", NULL);
LCDML_add(24, LCDML_0_1_3, 1, "Pitchbend", NULL);
LCDML_add(25, LCDML_0_1_3_1, 1, "PB Range", UI_func_pb_range);
LCDML_add(26, LCDML_0_1_3_1, 2, "PB Step", UI_func_pb_step);
LCDML_add(27, LCDML_0_1_3, 2, "Mod Wheel", NULL);
LCDML_add(28, LCDML_0_1_3_2, 1, "MW Range", UI_func_mw_range);
LCDML_add(29, LCDML_0_1_3_2, 2, "MW Assign", UI_func_mw_assign);
LCDML_add(30, LCDML_0_1_3_2, 3, "MW Mode", UI_func_mw_mode);
LCDML_add(31, LCDML_0_1_3, 3, "Aftertouch", NULL);
LCDML_add(32, LCDML_0_1_3_3, 1, "AT Range", UI_func_at_range);
LCDML_add(33, LCDML_0_1_3_3, 2, "AT Assign", UI_func_at_assign);
LCDML_add(34, LCDML_0_1_3_3, 3, "AT Mode", UI_func_at_mode);
LCDML_add(35, LCDML_0_1_3, 4, "Foot Ctrl", NULL);
LCDML_add(36, LCDML_0_1_3_4, 1, "FC Range", UI_func_fc_range);
LCDML_add(37, LCDML_0_1_3_4, 2, "FC Assign", UI_func_fc_assign);
LCDML_add(38, LCDML_0_1_3_4, 3, "FC Mode", UI_func_fc_mode);
LCDML_add(39, LCDML_0_1_3, 5, "Breath Ctrl", NULL);
LCDML_add(40, LCDML_0_1_3_5, 1, "BC Range", UI_func_bc_range);
LCDML_add(41, LCDML_0_1_3_5, 2, "BC Assign", UI_func_bc_assign);
LCDML_add(42, LCDML_0_1_3_5, 3, "BC Mode", UI_func_bc_mode);
LCDML_add(43, LCDML_0_1, 4, "MIDI", NULL);
LCDML_add(44, LCDML_0_1_4, 1, "MIDI Channel", UI_func_midi_channel);
LCDML_add(45, LCDML_0_1_4, 2, "Lowest Note", UI_func_lowest_note);
LCDML_add(46, LCDML_0_1_4, 3, "Highest Note", UI_func_highest_note);
LCDML_add(47, LCDML_0_1_4, 4, "Send Voice", UI_func_sysex_send_voice);
LCDML_add(48, LCDML_0_1_4, 5, "Receive Voice", UI_func_sysex_receive_voice);
LCDML_add(49, LCDML_0_1, 5, "Setup", NULL);
LCDML_add(50, LCDML_0_1_5, 1, "Portamento", NULL);
LCDML_add(51, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode);
LCDML_add(52, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando);
LCDML_add(53, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time);
LCDML_add(54, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony);
LCDML_add(55, LCDML_0_1_5, 3, "Transpose", UI_func_transpose);
LCDML_add(56, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune);
LCDML_add(57, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly);
LCDML_add(58, LCDML_0_1, 6, "Internal", NULL);
LCDML_add(59, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh);
LCDML_add(60, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level);
LCDML_add(61, LCDML_0_1_6, 3, "Engine", UI_func_engine);
LCDML_add(62, LCDML_0_1, 7, "Operator", UI_handle_OP);
LCDML_add(63, LCDML_0_1, 8, "Save Voice", UI_func_save_voice);
LCDML_add(64, LCDML_0, 3, "Load/Save", NULL);
LCDML_add(65, LCDML_0_3, 1, "Performance", NULL);
LCDML_add(66, LCDML_0_3_1, 1, "Load Perf.", UI_func_load_performance);
LCDML_add(67, LCDML_0_3_1, 2, "Save Perf.", UI_func_save_performance);
LCDML_add(68, LCDML_0_3, 2, "Voice Config", NULL);
LCDML_add(69, LCDML_0_3_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig);
LCDML_add(70, LCDML_0_3_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig);
LCDML_add(71, LCDML_0_3, 3, "Effects", NULL);
LCDML_add(72, LCDML_0_3_3, 1, "Load Effects", UI_func_load_fx);
LCDML_add(73, LCDML_0_3_3, 2, "Save Effects", UI_func_save_fx);
LCDML_add(74, LCDML_0_3, 5, "MIDI", NULL);
LCDML_add(75, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(76, LCDML_0_3_5, 2, "MIDI Send Bank", UI_func_sysex_send_bank);
LCDML_add(77, LCDML_0, 4, "System", NULL);
LCDML_add(78, LCDML_0_4, 1, "Volume", UI_func_volume);
LCDML_add(79, LCDML_0_4, 2, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(80, LCDML_0_4, 3, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(81, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(82, LCDML_0, 6, "Info", UI_func_information);
#define _LCDML_DISP_cnt 82
LCDML_add(23, LCDML_0_1_2_3, 5, "EQ", NULL);
LCDML_add(24, LCDML_0_1_2_3_5, 1, "Bass", UI_func_eq_bass);
LCDML_add(25, LCDML_0_1_2_3_5, 2, "Treble", UI_func_eq_treble);
LCDML_add(26, LCDML_0_1, 3, "Controller", NULL);
LCDML_add(27, LCDML_0_1_3, 1, "Pitchbend", NULL);
LCDML_add(28, LCDML_0_1_3_1, 1, "PB Range", UI_func_pb_range);
LCDML_add(29, LCDML_0_1_3_1, 2, "PB Step", UI_func_pb_step);
LCDML_add(30, LCDML_0_1_3, 2, "Mod Wheel", NULL);
LCDML_add(31, LCDML_0_1_3_2, 1, "MW Range", UI_func_mw_range);
LCDML_add(32, LCDML_0_1_3_2, 2, "MW Assign", UI_func_mw_assign);
LCDML_add(33, LCDML_0_1_3_2, 3, "MW Mode", UI_func_mw_mode);
LCDML_add(34, LCDML_0_1_3, 3, "Aftertouch", NULL);
LCDML_add(35, LCDML_0_1_3_3, 1, "AT Range", UI_func_at_range);
LCDML_add(36, LCDML_0_1_3_3, 2, "AT Assign", UI_func_at_assign);
LCDML_add(37, LCDML_0_1_3_3, 3, "AT Mode", UI_func_at_mode);
LCDML_add(38, LCDML_0_1_3, 4, "Foot Ctrl", NULL);
LCDML_add(39, LCDML_0_1_3_4, 1, "FC Range", UI_func_fc_range);
LCDML_add(40, LCDML_0_1_3_4, 2, "FC Assign", UI_func_fc_assign);
LCDML_add(41, LCDML_0_1_3_4, 3, "FC Mode", UI_func_fc_mode);
LCDML_add(42, LCDML_0_1_3, 5, "Breath Ctrl", NULL);
LCDML_add(43, LCDML_0_1_3_5, 1, "BC Range", UI_func_bc_range);
LCDML_add(44, LCDML_0_1_3_5, 2, "BC Assign", UI_func_bc_assign);
LCDML_add(45, LCDML_0_1_3_5, 3, "BC Mode", UI_func_bc_mode);
LCDML_add(46, LCDML_0_1, 4, "MIDI", NULL);
LCDML_add(47, LCDML_0_1_4, 1, "MIDI Channel", UI_func_midi_channel);
LCDML_add(48, LCDML_0_1_4, 2, "Lowest Note", UI_func_lowest_note);
LCDML_add(49, LCDML_0_1_4, 3, "Highest Note", UI_func_highest_note);
LCDML_add(50, LCDML_0_1_4, 4, "Send Voice", UI_func_sysex_send_voice);
LCDML_add(51, LCDML_0_1_4, 5, "Receive Voice", UI_func_sysex_receive_voice);
LCDML_add(52, LCDML_0_1, 5, "Setup", NULL);
LCDML_add(53, LCDML_0_1_5, 1, "Portamento", NULL);
LCDML_add(54, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode);
LCDML_add(55, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando);
LCDML_add(56, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time);
LCDML_add(57, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony);
LCDML_add(58, LCDML_0_1_5, 3, "Transpose", UI_func_transpose);
LCDML_add(59, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune);
LCDML_add(60, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly);
LCDML_add(61, LCDML_0_1, 6, "Internal", NULL);
LCDML_add(62, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh);
LCDML_add(63, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level);
LCDML_add(64, LCDML_0_1_6, 3, "Engine", UI_func_engine);
LCDML_add(65, LCDML_0_1, 7, "Operator", UI_handle_OP);
LCDML_add(66, LCDML_0_1, 8, "Save Voice", UI_func_save_voice);
LCDML_add(67, LCDML_0, 3, "Load/Save", NULL);
LCDML_add(68, LCDML_0_3, 1, "Performance", NULL);
LCDML_add(69, LCDML_0_3_1, 1, "Load Perf.", UI_func_load_performance);
LCDML_add(70, LCDML_0_3_1, 2, "Save Perf.", UI_func_save_performance);
LCDML_add(71, LCDML_0_3, 2, "Voice Config", NULL);
LCDML_add(72, LCDML_0_3_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig);
LCDML_add(73, LCDML_0_3_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig);
LCDML_add(74, LCDML_0_3, 3, "Effects", NULL);
LCDML_add(75, LCDML_0_3_3, 1, "Load Effects", UI_func_load_fx);
LCDML_add(76, LCDML_0_3_3, 2, "Save Effects", UI_func_save_fx);
LCDML_add(77, LCDML_0_3, 5, "MIDI", NULL);
LCDML_add(78, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank);
LCDML_add(79, LCDML_0_3_5, 2, "MIDI Send Bank", UI_func_sysex_send_bank);
LCDML_add(80, LCDML_0, 4, "System", NULL);
LCDML_add(81, LCDML_0_4, 1, "Volume", UI_func_volume);
LCDML_add(82, LCDML_0_4, 2, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(83, LCDML_0_4, 3, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(84, LCDML_0_4, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(85, LCDML_0, 6, "Info", UI_func_information);
#define _LCDML_DISP_cnt 85
#endif

@ -108,7 +108,7 @@
// REVERB parameters
#define REVERB_ANTIALIAS_FRQ 7500
// SGTL5000
//#define SGTL5000_AUDIO_ENHANCE 1
#define SGTL5000_AUDIO_ENHANCE 1
//*************************************************************************************************
//* AUDIO SOFTWARE SETTINGS
@ -532,6 +532,14 @@
#define VOICECONFIG_NUM_MAX MAX_VOICECONFIG
#define VOICECONFIG_NUM_DEFAULT -1
#define EQ_BASS_MIN -10
#define EQ_BASS_MAX 10
#define EQ_BASS_DEFAULT 0
#define EQ_TREBLE_MIN -10
#define EQ_TREBLE_MAX 10
#define EQ_TREBLE_DEFAULT 0
//
typedef struct dexed_s {
uint8_t lowest_note;
@ -580,6 +588,8 @@ typedef struct fx_s {
uint8_t reverb_roomsize;
uint8_t reverb_damping;
uint8_t reverb_level;
int8_t eq_bass;
int8_t eq_treble;
} fx_t;
typedef struct performance_s {

Loading…
Cancel
Save