diff --git a/MicroDexed.ino b/MicroDexed.ino index 7e52945..9d89070 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -412,7 +412,7 @@ void setup() // Filter for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0); + MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 1.0); MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); MicroDexed[instance_id]->doRefreshVoice(); @@ -618,8 +618,8 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #ifdef DEBUG Serial.println(F("VOLUME CC")); #endif - configuration.dexed[instance_id].loudness = map(inValue, 0, 0x7f, LOUDNESS_MIN, LOUDNESS_MAX); - MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX, 0.0, 1.0); + configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); + MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, 1.0); break; case 10: // Pan #ifdef DEBUG @@ -816,8 +816,6 @@ void handleSystemExclusive(byte * sysex, uint len) sysex[4] &= 0x7f; sysex[5] &= 0x7f; - uint8_t data_index = 0; - if (((sysex[3] & 0x7c) >> 2) == 0) { MicroDexed[instance_id]->notesOff(); @@ -831,75 +829,61 @@ void handleSystemExclusive(byte * sysex, uint len) { 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]; + 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); - 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]; + 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); - 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]); + 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); - 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]); + 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); - 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]); + 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_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]); + 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_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]); + 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_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]); + 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_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]); + 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_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]); + 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_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]); + 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_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]); + 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_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]); + MicroDexed[instance_id]->controllers.at.setTarget(configuration.dexed[instance_id].at_assign); break; default: - MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4]] = sysex[5]; // set function parameter + MicroDexed[instance_id]->data[sysex[4]] = sysex[5]; // set function parameter break; } MicroDexed[instance_id]->controllers.refresh(); - data_index = DEXED_GLOBAL_PARAMETER_OFFSET - 63 + sysex[4]; } #ifdef DEBUG Serial.print(F("SysEx")); @@ -913,9 +897,7 @@ void handleSystemExclusive(byte * sysex, uint len) Serial.print(F(" function: ")); Serial.print(sysex[4], DEC); Serial.print(F(" = ")); - Serial.print(sysex[5], DEC); - Serial.print(F(", data_index = ")); - Serial.println(data_index, DEC); + Serial.println(sysex[5], DEC); } #endif } @@ -1110,7 +1092,7 @@ void set_volume(uint8_t v, int8_t p, uint8_t m) uint16_t tmp = v / 100.0 * 1023.0 + 0.5; for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - tmp2 = mapfloat(configuration.pan, PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0); + tmp2 = mapfloat(configuration.pan - 20, PANORAMA_MIN, PANORAMA_MAX, 0.0, 1.0); } float tmp3 = (float)(tmp * (tmp + 2)) / (float)(1 << 20); @@ -1120,7 +1102,7 @@ void set_volume(uint8_t v, int8_t p, uint8_t m) Serial.print(F("[")); Serial.print(tmp3, 3); Serial.print(F("] PAN=")); - Serial.print(p, DEC); + Serial.print(p - 20, DEC); Serial.print(F("[")); Serial.print(tmp2, 3); Serial.print(F("] ")); @@ -1144,20 +1126,20 @@ void set_volume(uint8_t v, int8_t p, uint8_t m) stereomono1.stereo(false); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - configuration.pan = 0.5; + configuration.pan = PANORAMA_DEFAULT; } modchorus_inverter.gain(1.0); // stereo mode break; case 2: // mono right volume_l.gain(0.0); stereomono1.stereo(false); - configuration.pan = 0.5; + configuration.pan = PANORAMA_DEFAULT; modchorus_inverter.gain(1.0); // stereo mode break; case 3: // mono left volume_r.gain(0.0); stereomono1.stereo(false); - configuration.pan = 0.5; + configuration.pan = PANORAMA_DEFAULT; modchorus_inverter.gain(1.0); // stereo mode break; } @@ -1252,25 +1234,25 @@ void check_configuration(void) configuration.dexed[instance_id].delay_send = constrain(configuration.dexed[instance_id].delay_send, DELAY_SEND_MIN, DELAY_SEND_MAX); configuration.dexed[instance_id].filter_cutoff = constrain(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); configuration.dexed[instance_id].filter_resonance = constrain(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); - configuration.dexed[instance_id].loudness = constrain(configuration.dexed[instance_id].loudness, LOUDNESS_MIN, LOUDNESS_MAX); + configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose, TRANSPOSE_MIN, TRANSPOSE_MAX); - configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] = configuration.dexed[instance_id].tune; + configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX); configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX); configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine, ENGINE_MIN, ENGINE_MAX); configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly, MONOPOLY_MIN, MONOPOLY_MAX); - configuration.dexed[instance_id].pb_range = constrain(configuration.dexed[instance_id].pb_range, PB_RANGE_MIN, PB_RANGE_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE] = configuration.dexed[instance_id].pb_range; - configuration.dexed[instance_id].pb_step = constrain(configuration.dexed[instance_id].pb_step, PB_STEP_MIN, PB_STEP_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP] = configuration.dexed[instance_id].pb_step; - configuration.dexed[instance_id].mw_range = constrain(configuration.dexed[instance_id].mw_range, MW_RANGE_MIN, MW_RANGE_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE] = configuration.dexed[instance_id].mw_range; - configuration.dexed[instance_id].mw_assign = constrain(configuration.dexed[instance_id].mw_assign, MW_ASSIGN_MIN, MW_ASSIGN_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN] = configuration.dexed[instance_id].mw_assign; - configuration.dexed[instance_id].fc_range = constrain(configuration.dexed[instance_id].fc_range, FC_RANGE_MIN, FC_RANGE_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE] = configuration.dexed[instance_id].fc_range; - configuration.dexed[instance_id].fc_assign = constrain(configuration.dexed[instance_id].fc_assign, FC_ASSIGN_MIN, FC_ASSIGN_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN] = configuration.dexed[instance_id].fc_assign; - configuration.dexed[instance_id].bc_range = constrain(configuration.dexed[instance_id].bc_range, BC_RANGE_MIN, BC_RANGE_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE] = configuration.dexed[instance_id].bc_range; - configuration.dexed[instance_id].bc_assign = constrain(configuration.dexed[instance_id].bc_assign, BC_ASSIGN_MIN, BC_ASSIGN_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN] = configuration.dexed[instance_id].bc_assign; - configuration.dexed[instance_id].at_range = constrain(configuration.dexed[instance_id].at_range, AT_RANGE_MIN, AT_RANGE_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE] = configuration.dexed[instance_id].at_range; - configuration.dexed[instance_id].at_assign = constrain(configuration.dexed[instance_id].at_assign, AT_ASSIGN_MIN, AT_ASSIGN_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN] = configuration.dexed[instance_id].at_assign; - configuration.dexed[instance_id].portamento_mode = constrain(configuration.dexed[instance_id].portamento_mode, PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_MODE] = configuration.dexed[instance_id].portamento_mode; - configuration.dexed[instance_id].portamento_glissando = constrain(configuration.dexed[instance_id].portamento_glissando, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_GLISSANDO] = configuration.dexed[instance_id].portamento_glissando; - configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_TIME] = configuration.dexed[instance_id].portamento_time; + configuration.dexed[instance_id].pb_range = constrain(configuration.dexed[instance_id].pb_range, PB_RANGE_MIN, PB_RANGE_MAX); + configuration.dexed[instance_id].pb_step = constrain(configuration.dexed[instance_id].pb_step, PB_STEP_MIN, PB_STEP_MAX); + configuration.dexed[instance_id].mw_range = constrain(configuration.dexed[instance_id].mw_range, MW_RANGE_MIN, MW_RANGE_MAX); + configuration.dexed[instance_id].mw_assign = constrain(configuration.dexed[instance_id].mw_assign, MW_ASSIGN_MIN, MW_ASSIGN_MAX); + configuration.dexed[instance_id].fc_range = constrain(configuration.dexed[instance_id].fc_range, FC_RANGE_MIN, FC_RANGE_MAX); + configuration.dexed[instance_id].fc_assign = constrain(configuration.dexed[instance_id].fc_assign, FC_ASSIGN_MIN, FC_ASSIGN_MAX); + configuration.dexed[instance_id].bc_range = constrain(configuration.dexed[instance_id].bc_range, BC_RANGE_MIN, BC_RANGE_MAX); + configuration.dexed[instance_id].bc_assign = constrain(configuration.dexed[instance_id].bc_assign, BC_ASSIGN_MIN, BC_ASSIGN_MAX); + configuration.dexed[instance_id].at_range = constrain(configuration.dexed[instance_id].at_range, AT_RANGE_MIN, AT_RANGE_MAX); + configuration.dexed[instance_id].at_assign = constrain(configuration.dexed[instance_id].at_assign, AT_ASSIGN_MIN, AT_ASSIGN_MAX); + configuration.dexed[instance_id].portamento_mode = constrain(configuration.dexed[instance_id].portamento_mode, PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); + configuration.dexed[instance_id].portamento_glissando = constrain(configuration.dexed[instance_id].portamento_glissando, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); + configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); configuration.dexed[instance_id].op_enabled = constrain(configuration.dexed[instance_id].op_enabled, OP_ENABLED_MIN, OP_ENABLED_MAX); } } @@ -1305,7 +1287,7 @@ void init_configuration(void) configuration.dexed[instance_id].delay_send = DELAY_SEND_DEFAULT; configuration.dexed[instance_id].filter_cutoff = FILTER_CUTOFF_DEFAULT; configuration.dexed[instance_id].filter_resonance = FILTER_RESONANCE_DEFAULT; - configuration.dexed[instance_id].loudness = LOUDNESS_DEFAULT; + configuration.dexed[instance_id].sound_intensity = SOUND_INTENSITY_DEFAULT; configuration.dexed[instance_id].transpose = TRANSPOSE_DEFAULT; configuration.dexed[instance_id].tune = TUNE_DEFAULT; configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT; @@ -1445,7 +1427,7 @@ void show_configuration(void) Serial.print(F(" Delay Send ")); Serial.println(configuration.dexed[instance_id].delay_send, DEC); Serial.print(F(" Filter Cutoff ")); Serial.println(configuration.dexed[instance_id].filter_cutoff, DEC); Serial.print(F(" Filter Resonance ")); Serial.println(configuration.dexed[instance_id].filter_resonance, DEC); - Serial.print(F(" Loudness ")); Serial.println(configuration.dexed[instance_id].loudness, DEC); + Serial.print(F(" Loudness ")); Serial.println(configuration.dexed[instance_id].sound_intensity, DEC); Serial.print(F(" Transpose ")); Serial.println(configuration.dexed[instance_id].transpose, DEC); Serial.print(F(" Tune ")); Serial.println(configuration.dexed[instance_id].tune, DEC); Serial.print(F(" Polyphony ")); Serial.println(configuration.dexed[instance_id].polyphony, DEC); @@ -1564,13 +1546,5 @@ void show_patch(uint8_t instance_id) Serial.print(voicename); Serial.println(F("]")); Serial.flush(); - for (i = DEXED_GLOBAL_PARAMETER_OFFSET; i <= DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_TIME; i++) - { - Serial.print(i, DEC); - Serial.print(F(": ")); - Serial.println(MicroDexed[instance_id]->data[i]); - } - - Serial.println(); } #endif diff --git a/UI.hpp b/UI.hpp index 7072007..4970741 100644 --- a/UI.hpp +++ b/UI.hpp @@ -142,7 +142,7 @@ void UI_func_filter_resonance(uint8_t param); void UI_func_transpose(uint8_t param); void UI_func_tune(uint8_t param); void UI_func_midi_channel(uint8_t param); -void UI_func_loudness(uint8_t param); +void UI_func_sound_intensity(uint8_t param); void UI_func_panorama(uint8_t param); void UI_func_stereo_mono(uint8_t param); void UI_func_polyphony(uint8_t param); @@ -187,7 +187,7 @@ LCDML_add(1, LCDML_0_1, 1, "Instance 1", NULL); LCDML_add(2, LCDML_0_1_1, 1, "MIDI Channel 1", UI_func_midi_channel); LCDML_add(3, LCDML_0_1_1, 2, "Transpose 1", UI_func_transpose); LCDML_add(4, LCDML_0_1_1, 3, "Tune 1", UI_func_tune); -LCDML_add(5, LCDML_0_1_1, 4, "Loudness 1", UI_func_loudness); +LCDML_add(5, LCDML_0_1_1, 4, "Sound Intens. 1", UI_func_sound_intensity); LCDML_add(6, LCDML_0_1_1, 5, "Reverb Send 1", UI_func_reverb_send); LCDML_add(7, LCDML_0_1_1, 6, "Chorus Send 1", UI_func_chorus_send); LCDML_add(8, LCDML_0_1_1, 7, "Delay Send 1", UI_func_delay_send); @@ -226,7 +226,7 @@ LCDML_add(40, LCDML_0_1_1_19, 5, "OP5 1", UI_func_OP5); LCDML_add(41, LCDML_0_1_1_19, 6, "OP6 1", UI_func_OP6); LCDML_add(42, LCDML_0_1, 2, "Instance 2", NULL); LCDML_add(43, LCDML_0_1_2, 1, "MIDI Channel 2", UI_func_midi_channel); -LCDML_add(44, LCDML_0_1_2, 2, "Loudness 2", UI_func_loudness); +LCDML_add(44, LCDML_0_1_2, 2, "Sound Intens. 2", UI_func_sound_intensity); LCDML_add(45, LCDML_0_1_2, 3, "Transpose 2", UI_func_transpose); LCDML_add(46, LCDML_0_1_2, 4, "Tune 2", UI_func_tune); LCDML_add(47, LCDML_0_1_2, 5, "Reverb Send 2", UI_func_reverb_send); @@ -285,7 +285,7 @@ LCDML_add(97, LCDML_0, 5, "Info", UI_func_information); #else LCDML_add(0, LCDML_0, 1, "Setup", NULL); LCDML_add(1, LCDML_0_1, 1, "MIDI Channel", UI_func_midi_channel); -LCDML_add(2, LCDML_0_1, 2, "Loudness", UI_func_loudness); +LCDML_add(2, LCDML_0_1, 2, "Sound Intens.", UI_func_sound_intensity); LCDML_add(3, LCDML_0_1, 3, "Transpose", UI_func_transpose); LCDML_add(4, LCDML_0_1, 4, "Tune", UI_func_tune); LCDML_add(5, LCDML_0_1, 5, "Reverb Send", UI_func_reverb_send); @@ -1634,30 +1634,15 @@ void UI_func_tune(uint8_t param) if (LCDML.BT_checkDown()) { if (configuration.dexed[instance_id].tune < TUNE_MAX) - { - if (configuration.dexed[instance_id].tune == 99) - { - MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_TRANSPOSE]++; - configuration.dexed[instance_id].transpose++; - } configuration.dexed[instance_id].tune++; - } } else if (LCDML.BT_checkUp()) { if (configuration.dexed[instance_id].tune > TUNE_MIN) - { - if (configuration.dexed[instance_id].tune == 100) - { - MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_TRANSPOSE]--; - configuration.dexed[instance_id].transpose--; - } configuration.dexed[instance_id].tune--; - } } - MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] = configuration.dexed[instance_id].tune; - MicroDexed[instance_id]->controllers.masterTune = (int(MicroDexed[instance_id]->data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] % 100 / 100.0 * 0x4000) << 11) * (1.0 / 12); + MicroDexed[instance_id]->controllers.masterTune = (int((configuration.dexed[instance_id].tune - 100) / 100.0 * 0x4000) << 11) * (1.0 / 12); MicroDexed[instance_id]->doRefreshVoice(); } @@ -1726,7 +1711,7 @@ void UI_func_midi_channel(uint8_t param) } } -void UI_func_loudness(uint8_t param) +void UI_func_sound_intensity(uint8_t param) { uint8_t instance_id = 0; @@ -1737,7 +1722,7 @@ void UI_func_loudness(uint8_t param) { // setup function lcd.setCursor(0, 0); - lcd.print(F("Loudness")); + lcd.print(F("Sound Intens.")); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1750,24 +1735,24 @@ void UI_func_loudness(uint8_t param) { if (LCDML.BT_checkDown()) { - if (configuration.dexed[instance_id].loudness < LOUDNESS_MAX) + if (configuration.dexed[instance_id].sound_intensity < SOUND_INTENSITY_MAX) { - configuration.dexed[instance_id].loudness++; + configuration.dexed[instance_id].sound_intensity++; } } else if (LCDML.BT_checkUp()) { - if (configuration.dexed[instance_id].loudness > LOUDNESS_MIN) + if (configuration.dexed[instance_id].sound_intensity > SOUND_INTENSITY_MIN) { - configuration.dexed[instance_id].loudness--; + configuration.dexed[instance_id].sound_intensity--; } } - MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].loudness / 100.0; + MicroDexed[instance_id]->fx.Gain = configuration.dexed[instance_id].sound_intensity / 100.0; } lcd.setCursor(0, 1); - lcd_display_int(configuration.dexed[instance_id].loudness, 3, true, true, false); + lcd_display_int(configuration.dexed[instance_id].sound_intensity, 3, true, true, false); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1815,7 +1800,7 @@ void UI_func_panorama(uint8_t param) if (configuration.mono == 0) { lcd.setCursor(0, 1); - lcd_display_int(configuration.pan, 2, false, true, true); + lcd_display_int(configuration.pan, 1, false, true, true); set_volume(configuration.vol, configuration.pan, configuration.mono); } diff --git a/config.h b/config.h index 90977ec..b2d3133 100644 --- a/config.h +++ b/config.h @@ -276,9 +276,9 @@ enum { DEXED, REVERB, DELAY, CHORUS }; #define VOLUME_DEFAULT 80 #define VOLUME_ENC_STEPS 5 -#define PANORAMA_MIN -20 -#define PANORAMA_MAX 20 -#define PANORAMA_DEFAULT 0 +#define PANORAMA_MIN 0 +#define PANORAMA_MAX 40 +#define PANORAMA_DEFAULT 20 #define MIDI_CHANNEL_MIN MIDI_CHANNEL_OMNI #define MIDI_CHANNEL_MAX 16 @@ -340,9 +340,9 @@ enum { DEXED, REVERB, DELAY, CHORUS }; #define TUNE_MAX 199 #define TUNE_DEFAULT 100 -#define LOUDNESS_MIN 0 -#define LOUDNESS_MAX 100 -#define LOUDNESS_DEFAULT 100 +#define SOUND_INTENSITY_MIN 0 +#define SOUND_INTENSITY_MAX 100 +#define SOUND_INTENSITY_DEFAULT 100 #define POLYPHONY_MIN 1 #define POLYPHONY_MAX MAX_NOTES @@ -436,7 +436,7 @@ typedef struct { uint8_t filter_resonance; uint8_t transpose; uint8_t tune; - uint8_t loudness; + uint8_t sound_intensity; uint8_t polyphony; uint8_t engine; uint8_t monopoly; @@ -463,7 +463,7 @@ typedef struct { uint8_t instance_mode; uint8_t instance_splitpoint; uint8_t vol; - int8_t pan; + uint8_t pan; uint8_t mono; uint8_t reverb_roomsize; uint8_t reverb_damping; diff --git a/dexed.cpp b/dexed.cpp index 4c6db8c..29b84d1 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -99,8 +99,8 @@ Dexed::~Dexed() void Dexed::activate(void) { panic(); - controllers.values_[kControllerPitchRange] = data[155]; - controllers.values_[kControllerPitchStep] = data[156]; + //controllers.values_[kControllerPitchRange] = data[155]; + //controllers.values_[kControllerPitchStep] = data[156]; controllers.refresh(); } @@ -183,7 +183,7 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer) //#endif } -void Dexed::keydown(uint8_t pitch, uint8_t velo) { +void Dexed::keydown(int16_t pitch, uint8_t velo) { if ( velo == 0 ) { keyup(pitch); return; @@ -248,7 +248,7 @@ void Dexed::keydown(uint8_t pitch, uint8_t velo) { voices[note].live = true; } -void Dexed::keyup(uint8_t pitch) { +void Dexed::keyup(int16_t pitch) { pitch += data[144] - TRANSPOSE_FIX; uint8_t note; @@ -265,8 +265,8 @@ void Dexed::keyup(uint8_t pitch) { } if ( monoMode ) { - int8_t highNote = -1; - int8_t target = 0; + int16_t highNote = -1; + uint8_t target = 0; for (int8_t i = 0; i < max_notes; i++) { if ( voices[i].keydown && voices[i].midi_note > highNote ) { target = i; @@ -550,8 +550,8 @@ bool Dexed::loadVoiceParameters(uint8_t* new_data) return (true); } -bool Dexed::loadGlobalParameters(uint8_t* new_data) -{ +/*bool Dexed::loadGlobalParameters(uint8_t* new_data) + { uint8_t* p_data = data; controllers.values_[kControllerPitchRange] = new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE]; @@ -572,7 +572,7 @@ bool Dexed::loadGlobalParameters(uint8_t* new_data) (*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP3_ENABLE) << 3) | (*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP4_ENABLE) << 2) | (*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP5_ENABLE) << 1) | - *(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP6_ENABLE )); + (p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP6_ENABLE )); setMaxNotes(*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MAX_NOTES)); setMaxNotes(*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MAX_NOTES)); @@ -581,19 +581,19 @@ bool Dexed::loadGlobalParameters(uint8_t* new_data) //activate(); -#ifdef DEBUG + #ifdef DEBUG Serial.println(F("Global parameters loaded.")); -#endif + #endif return (true); -} + }*/ -bool Dexed::initGlobalParameters(void) -{ +/*bool Dexed::initGlobalParameters(void) + { uint8_t init_data[18]; -#ifdef DEBUG + #ifdef DEBUG Serial.println(F("Initializing global parameters")); -#endif + #endif init_data[DEXED_PITCHBEND_RANGE] = 1; init_data[DEXED_PITCHBEND_STEP] = 1; init_data[DEXED_MODWHEEL_RANGE] = 99; @@ -616,7 +616,7 @@ bool Dexed::initGlobalParameters(void) loadGlobalParameters(init_data); return (true); -} + }*/ void Dexed::setPBController(uint8_t pb_range, uint8_t pb_step) { @@ -634,9 +634,7 @@ void Dexed::setPBController(uint8_t pb_range, uint8_t pb_step) Serial.println(pb_step, DEC); #endif - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE] = pb_range; controllers.values_[kControllerPitchRange] = pb_range; - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP] = pb_step; controllers.values_[kControllerPitchStep] = pb_step; //controllers.refresh(); @@ -658,9 +656,7 @@ void Dexed::setMWController(uint8_t mw_range, uint8_t mw_assign) Serial.println(mw_assign, DEC); #endif - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE] = mw_range; controllers.wheel.setRange(mw_range); - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN] = mw_assign; controllers.wheel.setTarget(mw_assign); controllers.refresh(); @@ -682,9 +678,7 @@ void Dexed::setFCController(uint8_t fc_range, uint8_t fc_assign) Serial.println(fc_assign, DEC); #endif - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE] = fc_range; controllers.foot.setRange(fc_range); - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN] = fc_assign; controllers.foot.setTarget(fc_assign); controllers.refresh(); @@ -706,9 +700,7 @@ void Dexed::setBCController(uint8_t bc_range, uint8_t bc_assign) Serial.println(bc_assign, DEC); #endif - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE] = bc_range; controllers.breath.setRange(bc_range); - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN] = bc_assign; controllers.breath.setTarget(bc_assign); controllers.refresh(); @@ -730,9 +722,7 @@ void Dexed::setATController(uint8_t at_range, uint8_t at_assign) Serial.println(at_assign, DEC); #endif - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE] = at_range; controllers.at.setRange(at_range); - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN] = at_assign; controllers.at.setTarget(at_assign); controllers.refresh(); @@ -740,9 +730,6 @@ void Dexed::setATController(uint8_t at_range, uint8_t at_assign) void Dexed::setPortamentoMode(uint8_t portamento_mode, uint8_t portamento_glissando, uint8_t portamento_time) { - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_MODE] = portamento_mode; - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_GLISSANDO] = portamento_glissando; - data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PORTAMENTO_TIME] = portamento_time; controllers.portamento_cc = portamento_time; if (portamento_time > 0) diff --git a/dexed.h b/dexed.h index 3cbac74..a598f7a 100644 --- a/dexed.h +++ b/dexed.h @@ -46,7 +46,7 @@ extern float vol_right; extern float vol_left; struct ProcessorVoice { - uint8_t midi_note; + int16_t midi_note; uint8_t velocity; bool keydown; bool sustained; @@ -108,8 +108,8 @@ enum DexedVoiceParameters { DEXED_NAME // 19 }; -#define DEXED_GLOBAL_PARAMETER_OFFSET 155 -enum DexedGlobalParameters { +/* #define DEXED_GLOBAL_PARAMETER_OFFSET 155 + enum DexedGlobalParameters { DEXED_PITCHBEND_RANGE, // 0 DEXED_PITCHBEND_STEP, // 1 DEXED_MODWHEEL_RANGE, // 2 @@ -131,7 +131,7 @@ enum DexedGlobalParameters { DEXED_PORTAMENTO_MODE, // 18 DEXED_PORTAMENTO_GLISSANDO, // 19 DEXED_PORTAMENTO_TIME, // 20 -}; + }; */ // GLOBALS @@ -160,8 +160,8 @@ class Dexed bool loadVoiceParameters(uint8_t* data); bool loadGlobalParameters(uint8_t* data); bool initGlobalParameters(void); - void keyup(uint8_t pitch); - void keydown(uint8_t pitch, uint8_t velo); + void keyup(int16_t pitch); + void keydown(int16_t pitch, uint8_t velo); void setSustain(bool sustain); bool getSustain(void); uint8_t getNumNotesPlaying(void); @@ -176,23 +176,18 @@ class Dexed Controllers controllers; PluginFx fx; - uint8_t data[176] = { + uint8_t data[156] = { 95, 29, 20, 50, 99, 95, 00, 00, 41, 00, 19, 00, 00, 03, 00, 06, 79, 00, 01, 00, 14, // OP6 eg_rate_1-4, level_1-4, kbd_lev_scl_brk_pt, kbd_lev_scl_lft_depth, kbd_lev_scl_rht_depth, kbd_lev_scl_lft_curve, kbd_lev_scl_rht_curve, kbd_rate_scaling, amp_mod_sensitivity, key_vel_sensitivity, operator_output_level, osc_mode, osc_freq_coarse, osc_freq_fine, osc_detune 95, 20, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 00, 99, 00, 01, 00, 00, // OP5 95, 29, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 06, 89, 00, 01, 00, 07, // OP4 95, 20, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 02, 99, 00, 01, 00, 07, // OP3 95, 50, 35, 78, 99, 75, 00, 00, 00, 00, 00, 00, 00, 03, 00, 07, 58, 00, 14, 00, 07, // OP2 96, 25, 25, 67, 99, 75, 00, 00, 00, 00, 00, 00, 00, 03, 00, 02, 99, 00, 01, 00, 10, // OP1 - 94, 67, 95, 60, 50, 50, 50, 50, // 4 * pitch EG rates, 4 *pitch EG level + 94, 67, 95, 60, 50, 50, 50, 50, // 4 * pitch EG rates, 4 * pitch EG level 04, 06, 00, // algorithm, feedback, osc sync 34, 33, 00, 00, 00, 04, // lfo speed, lfo delay, lfo pitch_mod_depth, lfo_amp_mod_depth, lfo_sync, lfo_waveform 03, 24, // pitch_mod_sensitivity, transpose - 69, 68, 80, 56, 85, 76, 84, 00, 00, 00, // 10 * char for name ("DEFAULT ") - 01, 00, 99, 00, 99, 00, 99, 00, 99, 00, // pitch_bend_range, pitch_bend_step, mod_wheel_range, mod_wheel_assign, foot_ctrl_range, foot_ctrl_assign, breath_ctrl_range, breath_ctrl_assign, aftertouch_range, aftertouch_assign - 00, // master tune - 01, 01, 01, 01, 01, 01, // OP1-6 enable - 00, 00, 00, // portamento_mode, portamento_glissando, portamento_time - MAX_NOTES // number of voices + 69, 68, 80, 56, 85, 76, 84, 00, 00, 00 // 10 * char for name ("DEFAULT ") }; // FM-Piano uint32_t overload = 0; @@ -201,7 +196,7 @@ class Dexed protected: static const uint8_t MAX_ACTIVE_NOTES = MAX_NOTES; uint8_t max_notes = MAX_ACTIVE_NOTES; - uint8_t currentNote; + int16_t currentNote; bool sustain; bool monoMode; bool refreshVoice; diff --git a/dx7note.cpp b/dx7note.cpp index 03eab83..00edd9e 100644 --- a/dx7note.cpp +++ b/dx7note.cpp @@ -293,8 +293,7 @@ void Dx7Note::keyup() { pitchenv_.keydown(false); } -//void Dx7Note::update(const uint8_t patch[156], int midinote, int velocity) { -void Dx7Note::update(const uint8_t patch[173], int midinote, int velocity) { +void Dx7Note::update(const uint8_t patch[156], int midinote, int velocity) { int rates[4]; int levels[4]; for (int op = 0; op < 6; op++) {