From 0e14e4b51004ef7d458ad8207343be237fb90b4d Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 21 Nov 2019 11:07:23 +0100 Subject: [PATCH] Better handling of some SYSEX function changes. Small fix for master tune. --- MicroDexed.ino | 84 ++++++++++++++++++++++++++++++++++++++------- dexed.cpp | 2 +- doc/sysex-hints.txt | 17 +++++++++ 3 files changed, 89 insertions(+), 14 deletions(-) create mode 100644 doc/sysex-hints.txt diff --git a/MicroDexed.ino b/MicroDexed.ino index 9bc4b97..6083b1e 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -827,19 +827,77 @@ void handleSystemExclusive(byte * sysex, uint len) } else { - MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4]] = sysex[5]; // set function parameter - MicroDexed[instance_id]->controllers.values_[kControllerPitchRange] = MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE]; - MicroDexed[instance_id]->controllers.values_[kControllerPitchStep] = MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP]; - MicroDexed[instance_id]->controllers.wheel.setRange(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE]); - MicroDexed[instance_id]->controllers.wheel.setTarget(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN]); - MicroDexed[instance_id]->controllers.foot.setRange(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE]); - MicroDexed[instance_id]->controllers.foot.setTarget(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN]); - MicroDexed[instance_id]->controllers.breath.setRange(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE]); - MicroDexed[instance_id]->controllers.breath.setTarget(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]); - MicroDexed[instance_id]->controllers.at.setRange(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]); - MicroDexed[instance_id]->controllers.at.setTarget(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]); - MicroDexed[instance_id]->controllers.masterTune = (MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] / 10 * 0x4000 << 11) * (1.0 / 12); - MicroDexed[instance_id]->setPortamentoMode(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_MODE], MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_GLISSANDO], MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_TIME]); + switch (sysex[4]) + { + case 65: + configuration.dexed[instance_id].pb_range = constrain(sysex[4], PB_RANGE_MIN, PB_RANGE_MAX); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE] = configuration.dexed[instance_id].pb_range; + MicroDexed[instance_id]->controllers.values_[kControllerPitchRange] = MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE]; + break; + case 66: + configuration.dexed[instance_id].pb_step = constrain(sysex[4], PB_STEP_MIN, PB_STEP_MAX); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP] = configuration.dexed[instance_id].pb_step; + MicroDexed[instance_id]->controllers.values_[kControllerPitchStep] = MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP]; + break; + case 67: + configuration.dexed[instance_id].portamento_mode = constrain(sysex[4], PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_MODE] = configuration.dexed[instance_id].portamento_mode; + MicroDexed[instance_id]->setPortamentoMode(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_MODE], MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_GLISSANDO], MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_TIME]); + break; + case 68: + configuration.dexed[instance_id].portamento_glissando = constrain(sysex[4], PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_GLISSANDO] = configuration.dexed[instance_id].portamento_glissando; + MicroDexed[instance_id]->setPortamentoMode(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_MODE], MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_GLISSANDO], MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_TIME]); + break; + case 69: + configuration.dexed[instance_id].portamento_time = constrain(sysex[4], PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_TIME] = configuration.dexed[instance_id].portamento_time; + MicroDexed[instance_id]->setPortamentoMode(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_MODE], MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_GLISSANDO], MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_TIME]); + break; + case 70: + configuration.dexed[instance_id].mw_range = constrain(sysex[4], MW_RANGE_MIN, MW_RANGE_MIN); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE] = configuration.dexed[instance_id].mw_range; + MicroDexed[instance_id]->controllers.wheel.setRange(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE]); + break; + case 71: + configuration.dexed[instance_id].mw_assign = constrain(sysex[4], MW_ASSIGN_MIN, MW_ASSIGN_MIN); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN] = configuration.dexed[instance_id].mw_assign; + MicroDexed[instance_id]->controllers.wheel.setTarget(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN]); + break; + case 72: + configuration.dexed[instance_id].fc_range = constrain(sysex[4], FC_RANGE_MIN, FC_RANGE_MIN); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE] = configuration.dexed[instance_id].fc_range; + MicroDexed[instance_id]->controllers.foot.setRange(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE]); + break; + case 73: + configuration.dexed[instance_id].fc_assign = constrain(sysex[4], FC_ASSIGN_MIN, FC_ASSIGN_MIN); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN] = configuration.dexed[instance_id].fc_assign; + MicroDexed[instance_id]->controllers.foot.setTarget(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN]); + break; + case 74: + configuration.dexed[instance_id].bc_range = constrain(sysex[4], BC_RANGE_MIN, BC_RANGE_MIN); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE] = configuration.dexed[instance_id].bc_range; + MicroDexed[instance_id]->controllers.breath.setRange(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE]); + break; + case 75: + configuration.dexed[instance_id].bc_assign = constrain(sysex[4], BC_ASSIGN_MIN, BC_ASSIGN_MIN); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN] = configuration.dexed[instance_id].bc_assign; + MicroDexed[instance_id]->controllers.breath.setTarget(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]); + break; + case 76: + configuration.dexed[instance_id].at_range = constrain(sysex[4], AT_RANGE_MIN, AT_RANGE_MIN); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE] = configuration.dexed[instance_id].at_range; + MicroDexed[instance_id]->controllers.at.setRange(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]); + break; + case 77: + configuration.dexed[instance_id].at_assign = constrain(sysex[4], AT_ASSIGN_MIN, AT_ASSIGN_MIN); + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN] = configuration.dexed[instance_id].at_assign; + MicroDexed[instance_id]->controllers.at.setTarget(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]); + break; + default: + MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4]] = sysex[5]; // set function parameter + break; + } MicroDexed[instance_id]->controllers.refresh(); data_index = DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4]; } diff --git a/dexed.cpp b/dexed.cpp index d3706dc..4c6db8c 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -564,7 +564,7 @@ bool Dexed::loadGlobalParameters(uint8_t* new_data) controllers.breath.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]); controllers.at.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]); controllers.at.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]); - controllers.masterTune = (new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] / 10 * 0x4000 << 11) * (1.0 / 12); + controllers.masterTune = (int(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] / 100.0) * 0x4000 << 11) * (1.0 / 12); controllers.refresh(); setOPs((*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP1_ENABLE) << 5) | diff --git a/doc/sysex-hints.txt b/doc/sysex-hints.txt new file mode 100644 index 0000000..928dec3 --- /dev/null +++ b/doc/sysex-hints.txt @@ -0,0 +1,17 @@ +From: https://yamahadx.yahoogroups.narkive.com/cCCZDQNe/dx7-and-tx816-master-tune-editing-via-sysex + +Switch to Function Mode: +F0 43 10 08 27 7F F7 +F0 43 10 08 27 00 F7 + +Select Switch 1 = Master Tune: +F0 43 10 08 00 7F F7 +F0 43 10 08 00 00 F7 + +Change value down with repeating pressing of No switch: +F0 43 10 08 28 7F F7 +F0 43 10 08 28 00 F7 + +or up with Yes switch: +F0 43 10 08 29 7F F7 +F0 43 10 08 29 00 F7