From 0949a9e245449c5fa0cb348b13aa37ed4a4c10b4 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 6 Apr 2020 11:47:09 +0200 Subject: [PATCH] Fixed SysEx voice- and function-parameter change. --- MicroDexed.ino | 60 ++++++++++++++++++++++++++------------------------ UI.hpp | 20 ++++++++--------- UI_1_FX.h | 52 +++++++++++++++++++++---------------------- config.h | 15 ++++++------- controllers.h | 6 ++--- 5 files changed, 77 insertions(+), 76 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 2f98d68..b524c41 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -981,67 +981,78 @@ void handleSystemExclusive(byte * sysex, uint len) sysex[4] &= 0x7f; sysex[5] &= 0x7f; - if (((sysex[3] & 0x7c) >> 2) == 0) + if ((sysex[3] & 0x7c) >> 2 == 0) { - MicroDexed[instance_id]->notesOff(); - for (uint8_t i = 0; i < 128 || sysex[5] != 0xf7; i++) - MicroDexed[instance_id]->data[sysex[4] + ((sysex[3] & 0x03) * 128) + i] = sysex[5]; // set parameter - MicroDexed[instance_id]->doRefreshVoice(); +#ifdef DEBUG + Serial.println(F("SysEx Voice parameter:")); + Serial.print("Parameter #"); + Serial.print(sysex[4] + ((sysex[3] & 0x03) * 128), DEC); + Serial.print(" Value: "); + Serial.println(sysex[5], DEC); +#endif + MicroDexed[instance_id]->data[sysex[4] + ((sysex[3] & 0x03) * 128)] = sysex[5]; } - else + else if ((sysex[3] & 0x7c) >> 2 == 2) { +#ifdef DEBUG + Serial.println(F("SysEx Function parameter:")); + Serial.print("Parameter #"); + Serial.print(sysex[4], DEC); + Serial.print(" Value: "); + Serial.println(sysex[5], DEC); +#endif switch (sysex[4]) { case 65: - configuration.dexed[instance_id].pb_range = constrain(sysex[4], PB_RANGE_MIN, PB_RANGE_MAX); + configuration.dexed[instance_id].pb_range = constrain(sysex[5], PB_RANGE_MIN, PB_RANGE_MAX); MicroDexed[instance_id]->controllers.values_[kControllerPitchRange] = configuration.dexed[instance_id].pb_range; break; case 66: - configuration.dexed[instance_id].pb_step = constrain(sysex[4], PB_STEP_MIN, PB_STEP_MAX); + configuration.dexed[instance_id].pb_step = constrain(sysex[5], PB_STEP_MIN, PB_STEP_MAX); MicroDexed[instance_id]->controllers.values_[kControllerPitchStep] = configuration.dexed[instance_id].pb_step; break; case 67: - configuration.dexed[instance_id].portamento_mode = constrain(sysex[4], PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); + configuration.dexed[instance_id].portamento_mode = constrain(sysex[5], PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); break; case 68: - configuration.dexed[instance_id].portamento_glissando = constrain(sysex[4], PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); + configuration.dexed[instance_id].portamento_glissando = constrain(sysex[5], PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); break; case 69: - configuration.dexed[instance_id].portamento_time = constrain(sysex[4], PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); + configuration.dexed[instance_id].portamento_time = constrain(sysex[5], PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); break; case 70: - configuration.dexed[instance_id].mw_range = constrain(sysex[4], MW_RANGE_MIN, MW_RANGE_MAX); + configuration.dexed[instance_id].mw_range = constrain(sysex[5], MW_RANGE_MIN, MW_RANGE_MAX); MicroDexed[instance_id]->controllers.wheel.setRange(configuration.dexed[instance_id].mw_range); break; case 71: - configuration.dexed[instance_id].mw_assign = constrain(sysex[4], MW_ASSIGN_MIN, MW_ASSIGN_MAX); + configuration.dexed[instance_id].mw_assign = constrain(sysex[5], MW_ASSIGN_MIN, MW_ASSIGN_MAX); MicroDexed[instance_id]->controllers.wheel.setTarget(configuration.dexed[instance_id].mw_assign); break; case 72: - configuration.dexed[instance_id].fc_range = constrain(sysex[4], FC_RANGE_MIN, FC_RANGE_MAX); + configuration.dexed[instance_id].fc_range = constrain(sysex[5], FC_RANGE_MIN, FC_RANGE_MAX); MicroDexed[instance_id]->controllers.foot.setRange(configuration.dexed[instance_id].fc_range); break; case 73: - configuration.dexed[instance_id].fc_assign = constrain(sysex[4], FC_ASSIGN_MIN, FC_ASSIGN_MAX); + configuration.dexed[instance_id].fc_assign = constrain(sysex[5], FC_ASSIGN_MIN, FC_ASSIGN_MAX); MicroDexed[instance_id]->controllers.foot.setTarget(configuration.dexed[instance_id].fc_assign); break; case 74: - configuration.dexed[instance_id].bc_range = constrain(sysex[4], BC_RANGE_MIN, BC_RANGE_MAX); + configuration.dexed[instance_id].bc_range = constrain(sysex[5], BC_RANGE_MIN, BC_RANGE_MAX); MicroDexed[instance_id]->controllers.breath.setRange(configuration.dexed[instance_id].bc_range); break; case 75: - configuration.dexed[instance_id].bc_assign = constrain(sysex[4], BC_ASSIGN_MIN, BC_ASSIGN_MAX); + configuration.dexed[instance_id].bc_assign = constrain(sysex[5], BC_ASSIGN_MIN, BC_ASSIGN_MAX); MicroDexed[instance_id]->controllers.breath.setTarget(configuration.dexed[instance_id].bc_assign); break; case 76: - configuration.dexed[instance_id].at_range = constrain(sysex[4], AT_RANGE_MIN, AT_RANGE_MAX); + configuration.dexed[instance_id].at_range = constrain(sysex[5], AT_RANGE_MIN, AT_RANGE_MAX); MicroDexed[instance_id]->controllers.at.setRange(configuration.dexed[instance_id].at_range); break; case 77: - configuration.dexed[instance_id].at_assign = constrain(sysex[4], AT_ASSIGN_MIN, AT_ASSIGN_MAX); + configuration.dexed[instance_id].at_assign = constrain(sysex[5], AT_ASSIGN_MIN, AT_ASSIGN_MAX); MicroDexed[instance_id]->controllers.at.setTarget(configuration.dexed[instance_id].at_assign); break; default: @@ -1051,18 +1062,9 @@ void handleSystemExclusive(byte * sysex, uint len) MicroDexed[instance_id]->controllers.refresh(); } #ifdef DEBUG - Serial.print(F("SysEx")); - if (((sysex[3] & 0x7c) >> 2) == 0) - { - Serial.println(F(" voice:")); - show_patch(instance_id); - } else { - Serial.print(F(" function: ")); - Serial.print(sysex[4], DEC); - Serial.print(F(" = ")); - Serial.println(sysex[5], DEC); + Serial.println(F("E: Unknown SysEx voce or function.")); } #endif } diff --git a/UI.hpp b/UI.hpp index c86c5ab..d0d172b 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1536,7 +1536,7 @@ void UI_func_tune(uint8_t param) inside_menu = true; lcd_special_chars(METERBAR); - lcd_display_meter_int("Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, true); + lcd_display_meter_int("Fine Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, true); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1552,7 +1552,7 @@ void UI_func_tune(uint8_t param) else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune - ENCODER[ENC_R].speed(), TUNE_MIN, TUNE_MAX); - lcd_display_meter_int("Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, false); + lcd_display_meter_int("Fine Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, false); MicroDexed[instance_id]->controllers.masterTune = (int((configuration.dexed[instance_id].tune - 100) / 100.0 * 0x4000) << 11) * (1.0 / 12); MicroDexed[instance_id]->doRefreshVoice(); @@ -1735,7 +1735,7 @@ void UI_func_sound_intensity(uint8_t param) inside_menu = true; lcd_special_chars(BLOCKBAR); - lcd_display_bar_float("Volume", float(configuration.dexed[instance_id].sound_intensity), 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, 0, false, false, false, true); + lcd_display_bar_float("Voice Level", float(configuration.dexed[instance_id].sound_intensity), 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, 0, false, false, false, true); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1751,7 +1751,7 @@ void UI_func_sound_intensity(uint8_t param) else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity - ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); - lcd_display_bar_float("Volume", float(configuration.dexed[instance_id].sound_intensity), 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, 0, false, false, false, false); + lcd_display_bar_float("Voice Level", float(configuration.dexed[instance_id].sound_intensity), 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, 0, false, false, false, false); dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); } @@ -2335,13 +2335,13 @@ void UI_func_mw_mode(uint8_t param) switch (configuration.dexed[instance_id].mw_mode) { case 0: - lcd.print(F("[DIRECT ]")); + lcd.print(F("[LINEAR ]")); break; case 1: - lcd.print(F("[LINEAR ]")); + lcd.print(F("[REVERSE LINEAR]")); break; case 2: - lcd.print(F("[REVERSE]")); + lcd.print(F("[DIRECT ]")); break; } } @@ -2506,13 +2506,13 @@ void UI_func_fc_mode(uint8_t param) switch (configuration.dexed[instance_id].fc_mode) { case 0: - lcd.print(F("[DIRECT ]")); + lcd.print(F("[LINEAR ]")); break; case 1: - lcd.print(F("[LINEAR]")); + lcd.print(F("[REVERSE LINEAR]")); break; case 2: - lcd.print(F("[REVERSE]")); + lcd.print(F("[DIRECT ]")); break; } } diff --git a/UI_1_FX.h b/UI_1_FX.h index 30340c1..282b4a7 100644 --- a/UI_1_FX.h +++ b/UI_1_FX.h @@ -28,7 +28,7 @@ LCDML_add(0, LCDML_0, 1, "Voice", NULL); LCDML_add(1, LCDML_0_1, 1, "Patch", UI_func_voice_select); LCDML_add(2, LCDML_0_1, 2, "Audio", NULL); -LCDML_add(3, LCDML_0_1_2, 1, "Volume", UI_func_sound_intensity); +LCDML_add(3, LCDML_0_1_2, 1, "Voice Level", UI_func_sound_intensity); LCDML_add(4, LCDML_0_1_2, 2, "Panorama", UI_func_panorama); LCDML_add(5, LCDML_0_1_2, 3, "Effect Send", NULL); LCDML_add(6, LCDML_0_1_2_3, 1, "Reverb Send", UI_func_reverb_send); @@ -37,30 +37,30 @@ LCDML_add(8, LCDML_0_1_2_3, 3, "Delay Send", UI_func_delay_send); LCDML_add(9, LCDML_0_1_2, 4, "Filter", NULL); LCDML_add(10, LCDML_0_1_2_4, 1, "Cutoff", UI_func_filter_cutoff); LCDML_add(11, LCDML_0_1_2_4, 2, "Resonance", UI_func_filter_resonance); -LCDML_add(12, LCDML_0_1, 3, "MIDI", NULL); -LCDML_add(13, LCDML_0_1_3, 1, "MIDI Channel", UI_func_midi_channel); -LCDML_add(14, LCDML_0_1_3, 2, "Lowest Note", UI_func_lowest_note); -LCDML_add(15, LCDML_0_1_3, 3, "Highest Note", UI_func_highest_note); -LCDML_add(16, LCDML_0_1, 4, "Controller", NULL); -LCDML_add(17, LCDML_0_1_4, 1, "Pitchbend", NULL); -LCDML_add(18, LCDML_0_1_4_1, 1, "PB Range", UI_func_pb_range); -LCDML_add(19, LCDML_0_1_4_1, 2, "PB Step", UI_func_pb_step); -LCDML_add(20, LCDML_0_1_4, 2, "Mod Wheel", NULL); -LCDML_add(21, LCDML_0_1_4_2, 1, "MW Range", UI_func_mw_range); -LCDML_add(22, LCDML_0_1_4_2, 2, "MW Assign", UI_func_mw_assign); -LCDML_add(23, LCDML_0_1_4_2, 3, "MW Mode", UI_func_mw_mode); -LCDML_add(24, LCDML_0_1_4, 3, "Aftertouch", NULL); -LCDML_add(25, LCDML_0_1_4_3, 1, "AT Range", UI_func_at_range); -LCDML_add(26, LCDML_0_1_4_3, 2, "AT Assign", UI_func_at_assign); -LCDML_add(27, LCDML_0_1_4_3, 3, "AT Mode", UI_func_at_mode); -LCDML_add(28, LCDML_0_1_4, 4, "Foot Ctrl", NULL); -LCDML_add(29, LCDML_0_1_4_4, 1, "FC Range", UI_func_fc_range); -LCDML_add(30, LCDML_0_1_4_4, 2, "FC Assign", UI_func_fc_assign); -LCDML_add(31, LCDML_0_1_4_4, 3, "FC Mode", UI_func_fc_mode); -LCDML_add(32, LCDML_0_1_4, 5, "Breath Ctrl", NULL); -LCDML_add(33, LCDML_0_1_4_5, 1, "BC Range", UI_func_bc_range); -LCDML_add(34, LCDML_0_1_4_5, 2, "BC Assign", UI_func_bc_assign); -LCDML_add(35, LCDML_0_1_4_5, 3, "BC Mode", UI_func_bc_mode); +LCDML_add(12, LCDML_0_1, 3, "Controller", NULL); +LCDML_add(13, LCDML_0_1_3, 1, "Pitchbend", NULL); +LCDML_add(14, LCDML_0_1_3_1, 1, "PB Range", UI_func_pb_range); +LCDML_add(15, LCDML_0_1_3_1, 2, "PB Step", UI_func_pb_step); +LCDML_add(16, LCDML_0_1_3, 2, "Mod Wheel", NULL); +LCDML_add(17, LCDML_0_1_3_2, 1, "MW Range", UI_func_mw_range); +LCDML_add(18, LCDML_0_1_3_2, 2, "MW Assign", UI_func_mw_assign); +LCDML_add(19, LCDML_0_1_3_2, 3, "MW Mode", UI_func_mw_mode); +LCDML_add(20, LCDML_0_1_3, 3, "Aftertouch", NULL); +LCDML_add(21, LCDML_0_1_3_3, 1, "AT Range", UI_func_at_range); +LCDML_add(22, LCDML_0_1_3_3, 2, "AT Assign", UI_func_at_assign); +LCDML_add(23, LCDML_0_1_3_3, 3, "AT Mode", UI_func_at_mode); +LCDML_add(24, LCDML_0_1_3, 4, "Foot Ctrl", NULL); +LCDML_add(25, LCDML_0_1_3_4, 1, "FC Range", UI_func_fc_range); +LCDML_add(26, LCDML_0_1_3_4, 2, "FC Assign", UI_func_fc_assign); +LCDML_add(27, LCDML_0_1_3_4, 3, "FC Mode", UI_func_fc_mode); +LCDML_add(28, LCDML_0_1_3, 5, "Breath Ctrl", NULL); +LCDML_add(29, LCDML_0_1_3_5, 1, "BC Range", UI_func_bc_range); +LCDML_add(30, LCDML_0_1_3_5, 2, "BC Assign", UI_func_bc_assign); +LCDML_add(31, LCDML_0_1_3_5, 3, "BC Mode", UI_func_bc_mode); +LCDML_add(32, LCDML_0_1, 4, "MIDI", NULL); +LCDML_add(33, LCDML_0_1_4, 1, "MIDI Channel", UI_func_midi_channel); +LCDML_add(34, LCDML_0_1_4, 2, "Lowest Note", UI_func_lowest_note); +LCDML_add(35, LCDML_0_1_4, 3, "Highest Note", UI_func_highest_note); LCDML_add(36, LCDML_0_1, 5, "Setup", NULL); LCDML_add(37, LCDML_0_1_5, 1, "Portamento", NULL); LCDML_add(38, LCDML_0_1_5_1, 1, "Port. Mode", UI_func_portamento_mode); @@ -68,7 +68,7 @@ LCDML_add(39, LCDML_0_1_5_1, 2, "Port. Gliss", UI_func_portamento_glissando); LCDML_add(40, LCDML_0_1_5_1, 3, "Port. Time", UI_func_portamento_time); LCDML_add(41, LCDML_0_1_5, 2, "Polyphony", UI_func_polyphony); LCDML_add(42, LCDML_0_1_5, 3, "Transpose", UI_func_transpose); -LCDML_add(43, LCDML_0_1_5, 4, "Tune", UI_func_tune); +LCDML_add(43, LCDML_0_1_5, 4, "Fine Tune", UI_func_tune); LCDML_add(44, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); LCDML_add(45, LCDML_0_1, 6, "Internal", NULL); LCDML_add(46, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); diff --git a/config.h b/config.h index ff52a63..b9fea24 100644 --- a/config.h +++ b/config.h @@ -100,13 +100,13 @@ //* AUDIO SOFTWARE SETTINGS //************************************************************************************************* #ifndef TEENSY_AUDIO_BOARD +#define REDUCE_LOUDNESS 0 #if AUDIO_BLOCK_SAMPLES == 64 #define AUDIO_MEM 512 #else #define AUDIO_MEM 384 #endif #define REDUCE_LOUDNESS 0 -//#define REDUCE_LOUDNESS_FACTOR 1.0 #else // IF TEENSY_AUDIO_BOARD /* 13: 3.16 Volts p-p @@ -129,13 +129,12 @@ 30: 1.22 Volts p-p 31: 1.16 Volts p-p */ -#define SGTL5000_LINEOUT_LEVEL 29 +#define SGTL5000_LINEOUT_LEVEL 16 #if AUDIO_BLOCK_SAMPLES == 64 #define AUDIO_MEM 512 #else #define AUDIO_MEM 384 #endif -#define REDUCE_LOUDNESS 2 #endif #define DELAY_MAX_TIME 500 #define SAMPLE_RATE 44100 @@ -390,7 +389,7 @@ enum { DEXED, CHORUS, DELAY, REVERB}; #define SOUND_INTENSITY_MIN 0 #define SOUND_INTENSITY_MAX 100 #define SOUND_INTENSITY_DEFAULT 100 -#define SOUND_INTENSITY_AMP_MAX 1.3 +#define SOUND_INTENSITY_AMP_MAX 1.15 #define POLYPHONY_MIN 1 #define POLYPHONY_MAX MAX_NOTES @@ -445,11 +444,11 @@ enum { DEXED, CHORUS, DELAY, REVERB}; #define BC_RANGE_DEFAULT 50 #define BC_ASSIGN_MIN 0 -#define BC_ASSIGN_MAX 7 +#define BC_ASSIGN_MAX 0 #define BC_ASSIGN_DEFAULT 2 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias #define BC_MODE_MIN 0 -#define BC_MODE_MAX MIDI_CONTROLLER_MODE_MAX +#define BC_MODE_MAX 0 #define BC_MODE_DEFAULT 0 #define AT_RANGE_MIN 0 @@ -457,11 +456,11 @@ enum { DEXED, CHORUS, DELAY, REVERB}; #define AT_RANGE_DEFAULT 50 #define AT_ASSIGN_MIN 0 -#define AT_ASSIGN_MAX 7 +#define AT_ASSIGN_MAX 0 #define AT_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias #define AT_MODE_MIN 0 -#define AT_MODE_MAX MIDI_CONTROLLER_MODE_MAX +#define AT_MODE_MAX 0 #define AT_MODE_DEFAULT 1 #define OP_ENABLED_MIN 0 diff --git a/controllers.h b/controllers.h index 1caa07f..b263871 100644 --- a/controllers.h +++ b/controllers.h @@ -77,13 +77,13 @@ class Controllers { switch (mod.ctrl_mode) { case 0: - total = uint8_t(range * float(cc) + (1.0 - range) * 127.0); // DIRECT BC mode by Thierry (opus.quatre) + total = uint8_t(float(cc) * range); // LINEAR mode break; case 1: - total = uint8_t(float(cc) * range); // LINEAR mode + total = uint8_t(127.0 * range - (float(cc) * range)); // REVERSE mode break; case 2: - total = uint8_t(127.0 * range - (float(cc) * range)); // REVERSE mode + total = uint8_t(range * float(cc) + (1.0 - range) * 127.0); // DIRECT BC mode by Thierry (opus.quatre) break; }