diff --git a/MicroDexed.ino b/MicroDexed.ino index 4c5b6f5..e6804d1 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -213,7 +213,7 @@ void setup() Serial.println(i, DEC); MicroDexed[i] = new AudioSourceMicroDexed(SAMPLE_RATE); if (MicroDexed[i] == NULL) { - Serial.print(F("Unable to create MicroDexed engine!")); + Serial.print(F("Unable to create MicroDexed engine!")); } create_audio_connections(*MicroDexed[i]); } @@ -1203,28 +1203,48 @@ void show_configuration(void) { Serial.println(); Serial.println(F("CONFIGURATION:")); - Serial.print(F("Checksum 0x")); Serial.println(configuration.checksum, HEX); - Serial.print(F("Bank ")); Serial.println(configuration.bank[0], DEC); - Serial.print(F("Voice ")); Serial.println(configuration.voice[0], DEC); - Serial.print(F("Volume ")); Serial.println(configuration.vol, DEC); - Serial.print(F("Panorama ")); Serial.println(configuration.pan[0], DEC); - Serial.print(F("Mono ")); Serial.println(configuration.mono, DEC); - Serial.print(F("MIDI-Channel ")); Serial.println(configuration.midi_channel[0], DEC); - Serial.print(F("Reverb Roomsize ")); Serial.println(configuration.reverb_roomsize, DEC); - Serial.print(F("Reverb Damping ")); Serial.println(configuration.reverb_damping, DEC); - Serial.print(F("Reverb Level ")); Serial.println(configuration.reverb_level[0], DEC); - Serial.print(F("Chorus Frequency ")); Serial.println(configuration.chorus_frequency, DEC); - Serial.print(F("Chorus Waveform ")); Serial.println(configuration.chorus_waveform, DEC); - Serial.print(F("Chorus Depth ")); Serial.println(configuration.chorus_depth, DEC); - Serial.print(F("Chorus Level ")); Serial.println(configuration.chorus_level[0], DEC); - Serial.print(F("Delay Time ")); Serial.println(configuration.delay_time, DEC); - Serial.print(F("Delay Feedback ")); Serial.println(configuration.delay_feedback, DEC); - Serial.print(F("Delay Level ")); Serial.println(configuration.delay_level[0], DEC); - Serial.print(F("Filter Cutoff ")); Serial.println(configuration.filter_cutoff[0], DEC); - Serial.print(F("Filter Resonance ")); Serial.println(configuration.filter_resonance[0], DEC); - Serial.print(F("Loudness ")); Serial.println(configuration.loudness[0], DEC); - Serial.print(F("Polyphony ")); Serial.println(configuration.polyphony[0], DEC); - Serial.print(F("Engine ")); Serial.println(configuration.engine[0], DEC); + Serial.print(F("Checksum 0x")); Serial.println(configuration.checksum, HEX); + + Serial.print(F("Volume ")); Serial.println(configuration.vol, DEC); + Serial.print(F("Panorama ")); Serial.println(configuration.pan[0], DEC); + Serial.print(F("Mono ")); Serial.println(configuration.mono, DEC); + Serial.print(F("Reverb Roomsize ")); Serial.println(configuration.reverb_roomsize, DEC); + Serial.print(F("Reverb Damping ")); Serial.println(configuration.reverb_damping, DEC); + Serial.print(F("Chorus Frequency ")); Serial.println(configuration.chorus_frequency, DEC); + Serial.print(F("Chorus Waveform ")); Serial.println(configuration.chorus_waveform, DEC); + Serial.print(F("Chorus Depth ")); Serial.println(configuration.chorus_depth, DEC); + Serial.print(F("Chorus Level ")); Serial.println(configuration.chorus_level[0], DEC); + Serial.print(F("Delay Time ")); Serial.println(configuration.delay_time, DEC); + Serial.print(F("Delay Feedback ")); Serial.println(configuration.delay_feedback, DEC); + Serial.print(F("MIDI-Channel ")); Serial.println(configuration.midi_channel[0], DEC); + + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + Serial.print(F("DEXED Instance ")); + Serial.println(i, DEC); + Serial.print(F(" Bank ")); Serial.println(configuration.bank[i], DEC); + Serial.print(F(" Voice ")); Serial.println(configuration.voice[i], DEC); + Serial.print(F(" Panorama ")); Serial.println(configuration.pan[i], DEC); + Serial.print(F(" Chorus Level ")); Serial.println(configuration.chorus_level[i], DEC); + Serial.print(F(" Reverb Level ")); Serial.println(configuration.reverb_level[i], DEC); + Serial.print(F(" Delay Level ")); Serial.println(configuration.delay_level[i], DEC); + Serial.print(F(" Filter Cutoff ")); Serial.println(configuration.filter_cutoff[i], DEC); + Serial.print(F(" Filter Resonance ")); Serial.println(configuration.filter_resonance[i], DEC); + Serial.print(F(" Loudness ")); Serial.println(configuration.loudness[i], DEC); + Serial.print(F(" Polyphony ")); Serial.println(configuration.polyphony[i], DEC); + Serial.print(F(" Engine ")); Serial.println(configuration.engine[i], DEC); + Serial.print(F(" Mono/Pol ")); Serial.println(configuration.monopoly[i], DEC); + Serial.print(F(" Pitchbend Range ")); Serial.println(configuration.pb_range[i], DEC); + Serial.print(F(" Pitchbend Step ")); Serial.println(configuration.pb_step[i], DEC); + Serial.print(F(" Modwheel Range ")); Serial.println(configuration.mw_range[i], DEC); + Serial.print(F(" Modwheel Assign ")); Serial.println(configuration.mw_assign[i], DEC); + Serial.print(F(" Footctrl Range ")); Serial.println(configuration.fc_range[i], DEC); + Serial.print(F(" Footctrl Assign ")); Serial.println(configuration.fc_assign[i], DEC); + Serial.print(F(" BreathCtrl Range ")); Serial.println(configuration.bc_range[i], DEC); + Serial.print(F(" Breathctrl Assign ")); Serial.println(configuration.bc_assign[i], DEC); + Serial.print(F(" Aftertouch Range ")); Serial.println(configuration.at_range[i], DEC); + Serial.print(F(" Aftertouch Assign ")); Serial.println(configuration.at_assign[i], DEC); + } Serial.println(); } diff --git a/UI.hpp b/UI.hpp index 6e87878..6c47ff7 100644 --- a/UI.hpp +++ b/UI.hpp @@ -145,6 +145,14 @@ void UI_func_stereo_mono(uint8_t param); void UI_func_polyphony(uint8_t param); void UI_func_engine(uint8_t param); void UI_func_mono_poly(uint8_t param); +void UI_func_pb_range(uint8_t param); +void UI_func_pb_step(uint8_t param); +void UI_func_mw_range(uint8_t param); +void UI_func_mw_step(uint8_t param); +void UI_func_fc_range(uint8_t param); +void UI_func_fc_step(uint8_t param); +void UI_func_at_range(uint8_t param); +void UI_func_at_step(uint8_t param); void UI_func_information(uint8_t param); void UI_func_voice_selection(uint8_t param); void UI_func_volume(uint8_t param); @@ -172,8 +180,8 @@ LCDML_add(9, LCDML_0_1_2, 7, "Polyphony 1", UI_func_polyphony); LCDML_add(10, LCDML_0_1_2, 8, "Engine 1", UI_func_engine); LCDML_add(11, LCDML_0_1_2, 9, "Mono/Poly 1", UI_func_mono_poly); LCDML_add(12, LCDML_0_1_2, 10, "Pitchbend 1", NULL); -LCDML_add(13, LCDML_0_1_2_7, 1, "PB Range 1", UI_function_not_implemented); -LCDML_add(14, LCDML_0_1_2_7, 2, "PB Step 1", UI_function_not_implemented); +LCDML_add(13, LCDML_0_1_2_7, 1, "PB Range 1", UI_func_pb_range); +LCDML_add(14, LCDML_0_1_2_7, 2, "PB Step 1", UI_func_pb_step); LCDML_add(15, LCDML_0_1_2, 11, "Mod Wheel 1", NULL); LCDML_add(16, LCDML_0_1_2_8, 1, "MW Range 1", UI_function_not_implemented); LCDML_add(17, LCDML_0_1_2_8, 2, "MW Assign 1", UI_function_not_implemented); @@ -208,8 +216,8 @@ LCDML_add(45, LCDML_0_1_3, 7, "Polyphony 2", UI_func_polyphony); LCDML_add(46, LCDML_0_1_3, 8, "Engine 2", UI_func_engine); LCDML_add(47, LCDML_0_1_3, 9, "Mono/Poly 2", UI_func_mono_poly); LCDML_add(48, LCDML_0_1_3, 10, "Pitchbend 2", NULL); -LCDML_add(49, LCDML_0_1_3_7, 1, "PB Range 2", UI_function_not_implemented); -LCDML_add(50, LCDML_0_1_3_7, 2, "PB Step 2", UI_function_not_implemented); +LCDML_add(49, LCDML_0_1_3_7, 1, "PB Range 2", UI_func_pb_range); +LCDML_add(50, LCDML_0_1_3_7, 2, "PB Step 2", UI_func_pb_step); LCDML_add(51, LCDML_0_1_3, 11, "Mod Wheel 2", NULL); LCDML_add(52, LCDML_0_1_3_8, 1, "MW Range 2", UI_function_not_implemented); LCDML_add(53, LCDML_0_1_3_8, 2, "MW Assign 2", UI_function_not_implemented); @@ -266,31 +274,31 @@ LCDML_add(8, LCDML_0_1_2, 7, "Polyphony", UI_func_polyphony); LCDML_add(9, LCDML_0_1_2, 8, "Engine", UI_func_engine); LCDML_add(10, LCDML_0_1_2, 9, "Mono/Poly", UI_func_mono_poly); LCDML_add(11, LCDML_0_1_2, 10, "Pitchbend", NULL); -LCDML_add(12, LCDML_0_1_2_7, 1, "PB Range", UI_function_not_implemented); -LCDML_add(13, LCDML_0_1_2_7, 2, "PB Step", UI_function_not_implemented); +LCDML_add(12, LCDML_0_1_2_10, 1, "PB Range", UI_func_pb_range); +LCDML_add(13, LCDML_0_1_2_10, 2, "PB Step", UI_func_pb_step); LCDML_add(14, LCDML_0_1_2, 11, "Mod Wheel", NULL); -LCDML_add(15, LCDML_0_1_2_8, 1, "MW Range", UI_function_not_implemented); -LCDML_add(16, LCDML_0_1_2_8, 2, "MW Assign", UI_function_not_implemented); +LCDML_add(15, LCDML_0_1_2_11, 1, "MW Range", UI_function_not_implemented); +LCDML_add(16, LCDML_0_1_2_11, 2, "MW Assign", UI_function_not_implemented); LCDML_add(17, LCDML_0_1_2, 12, "Foot Ctrl", NULL); -LCDML_add(18, LCDML_0_1_2_9, 1, "FC Range", UI_function_not_implemented); -LCDML_add(19, LCDML_0_1_2_9, 2, "FC Assign", UI_function_not_implemented); +LCDML_add(18, LCDML_0_1_2_12, 1, "FC Range", UI_function_not_implemented); +LCDML_add(19, LCDML_0_1_2_12, 2, "FC Assign", UI_function_not_implemented); LCDML_add(20, LCDML_0_1_2, 13, "Breath Ctrl", NULL); -LCDML_add(21, LCDML_0_1_2_10, 1, "BC Range", UI_function_not_implemented); -LCDML_add(22, LCDML_0_1_2_10, 2, "BC Assign", UI_function_not_implemented); +LCDML_add(21, LCDML_0_1_2_13, 1, "BC Range", UI_function_not_implemented); +LCDML_add(22, LCDML_0_1_2_13, 2, "BC Assign", UI_function_not_implemented); LCDML_add(23, LCDML_0_1_2, 14, "Aftertouch", NULL); -LCDML_add(24, LCDML_0_1_2_11, 1, "AT Range", UI_function_not_implemented); -LCDML_add(25, LCDML_0_1_2_11, 2, "AT Assign", UI_function_not_implemented); +LCDML_add(24, LCDML_0_1_2_14, 1, "AT Range", UI_function_not_implemented); +LCDML_add(25, LCDML_0_1_2_14, 2, "AT Assign", UI_function_not_implemented); LCDML_add(26, LCDML_0_1_2, 15, "Portamento", NULL); -LCDML_add(27, LCDML_0_1_2_12, 1, "Port. Mode", UI_function_not_enabled); -LCDML_add(28, LCDML_0_1_2_12, 2, "Port. Gliss", UI_function_not_enabled); -LCDML_add(29, LCDML_0_1_2_12, 3, "Port. Time", UI_function_not_enabled); +LCDML_add(27, LCDML_0_1_2_15, 1, "Port. Mode", UI_function_not_enabled); +LCDML_add(28, LCDML_0_1_2_15, 2, "Port. Gliss", UI_function_not_enabled); +LCDML_add(29, LCDML_0_1_2_15, 3, "Port. Time", UI_function_not_enabled); LCDML_add(30, LCDML_0_1_2, 16, "Operator", NULL); -LCDML_add(31, LCDML_0_1_2_13, 1, "OP1", UI_function_not_implemented); -LCDML_add(32, LCDML_0_1_2_13, 2, "OP2", UI_function_not_implemented); -LCDML_add(33, LCDML_0_1_2_13, 3, "OP3", UI_function_not_implemented); -LCDML_add(34, LCDML_0_1_2_13, 4, "OP4", UI_function_not_implemented); -LCDML_add(35, LCDML_0_1_2_13, 5, "OP5", UI_function_not_implemented); -LCDML_add(36, LCDML_0_1_2_13, 6, "OP6", UI_function_not_implemented); +LCDML_add(31, LCDML_0_1_2_16, 1, "OP1", UI_function_not_implemented); +LCDML_add(32, LCDML_0_1_2_16, 2, "OP2", UI_function_not_implemented); +LCDML_add(33, LCDML_0_1_2_16, 3, "OP3", UI_function_not_implemented); +LCDML_add(34, LCDML_0_1_2_16, 4, "OP4", UI_function_not_implemented); +LCDML_add(35, LCDML_0_1_2_16, 5, "OP5", UI_function_not_implemented); +LCDML_add(36, LCDML_0_1_2_16, 6, "OP6", UI_function_not_implemented); LCDML_add(37, LCDML_0, 2, "Effect", NULL); LCDML_add(38, LCDML_0_2, 1, "Reverb", NULL); LCDML_add(39, LCDML_0_2_1, 1, "Roomsize", UI_func_reverb_roomsize); @@ -530,7 +538,7 @@ void encoder_right_up(void) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; switch (menu_state) @@ -592,7 +600,7 @@ void encoder_right_down(void) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; switch (menu_state) @@ -986,7 +994,7 @@ void UI_func_reverb_level(uint8_t param) #ifdef USE_REVERB uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1181,7 +1189,7 @@ void UI_func_chorus_level(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1318,7 +1326,7 @@ void UI_func_delay_level(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1367,7 +1375,7 @@ void UI_func_filter_cutoff(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1401,10 +1409,7 @@ void UI_func_filter_cutoff(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.filter_cutoff[instance_id], 3, true, true, false); - for (uint8_t i = 0; i < NUM_DEXED; i++) - { - MicroDexed[i]->fx.Cutoff = configuration.filter_cutoff[i] / 100.0; - } + MicroDexed[instance_id]->fx.Cutoff = configuration.filter_cutoff[instance_id] / 100.0; } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1418,7 +1423,7 @@ void UI_func_filter_resonance(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1452,10 +1457,7 @@ void UI_func_filter_resonance(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.filter_resonance[instance_id], 3, true, true, false); - for (uint8_t i = 0; i < NUM_DEXED; i++) - { - MicroDexed[i]->fx.Reso = configuration.filter_resonance[i] / 100.0; - } + MicroDexed[instance_id]->fx.Reso = configuration.filter_resonance[instance_id] / 100.0; } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1469,7 +1471,7 @@ void UI_func_midi_channel(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1522,7 +1524,7 @@ void UI_func_loudness(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1556,10 +1558,7 @@ void UI_func_loudness(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.loudness[instance_id], 3, true, true, false); - for (uint8_t i = 0; i < NUM_DEXED; i++) - { - MicroDexed[i]->fx.Gain = configuration.loudness[instance_id] / 100.0; - } + MicroDexed[instance_id]->fx.Gain = configuration.loudness[instance_id] / 100.0; } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1573,7 +1572,7 @@ void UI_func_panorama(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1629,7 +1628,7 @@ void UI_func_stereo_mono(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1693,7 +1692,7 @@ void UI_func_polyphony(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1727,10 +1726,7 @@ void UI_func_polyphony(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.polyphony[instance_id], 2, false, true, false); - for (uint8_t i = 0; i < NUM_DEXED; i++) - { - MicroDexed[i]->setMaxNotes(configuration.polyphony[instance_id]); - } + MicroDexed[instance_id]->setMaxNotes(configuration.polyphony[instance_id]); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1744,7 +1740,7 @@ void UI_func_engine(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1789,10 +1785,7 @@ void UI_func_engine(uint8_t param) break; } - for (uint8_t i = 0; i < NUM_DEXED; i++) - { - MicroDexed[i]->setEngineType(configuration.engine[instance_id]); - } + MicroDexed[instance_id]->setEngineType(configuration.engine[instance_id]); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1806,7 +1799,7 @@ void UI_func_mono_poly(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1858,6 +1851,132 @@ void UI_func_mono_poly(uint8_t param) } } +void UI_func_pb_range(uint8_t param) +{ + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("PB Range")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.pb_range[instance_id] < PB_RANGE_MAX) + { + configuration.pb_range[instance_id]++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.pb_range[instance_id] > PB_RANGE_MIN) + { + configuration.pb_range[instance_id]--; + } + } + + lcd.setCursor(0, 1); + lcd_display_int(configuration.pb_range[instance_id], 2, false, true, false); + + MicroDexed[instance_id]->setControllers(configuration.pb_range[instance_id], configuration.pb_step[instance_id], configuration.mw_range[instance_id], configuration.mw_assign[instance_id], configuration.fc_range[instance_id], configuration.fc_assign[instance_id], configuration.bc_range[instance_id], configuration.bc_assign[instance_id], configuration.at_range[instance_id], configuration.at_assign[instance_id]); + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + eeprom_write(); + } +} + +void UI_func_pb_step(uint8_t param) +{ + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("PB Step")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.pb_step[instance_id] < PB_STEP_MAX) + { + configuration.pb_step[instance_id]++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.pb_step[instance_id] > PB_STEP_MIN) + { + configuration.pb_step[instance_id]--; + } + } + + lcd.setCursor(0, 1); + lcd_display_int(configuration.pb_step[instance_id], 2, false, true, false); + + MicroDexed[instance_id]->setControllers(configuration.pb_range[instance_id], configuration.pb_step[instance_id], configuration.mw_range[instance_id], configuration.mw_assign[instance_id], configuration.fc_range[instance_id], configuration.fc_assign[instance_id], configuration.bc_range[instance_id], configuration.bc_assign[instance_id], configuration.at_range[instance_id], configuration.at_assign[instance_id]); + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + eeprom_write(); + } +} + +void UI_func_mw_range(uint8_t param) +{ + +} + +void UI_func_mw_step(uint8_t param) +{ + +} + +void UI_func_fc_range(uint8_t param) +{ + +} + +void UI_func_fc_step(uint8_t param) +{ + +} + +void UI_func_at_range(uint8_t param) +{ + +} + +void UI_func_at_step(uint8_t param) +{ + +} + void UI_func_information(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -1889,7 +2008,7 @@ void UI_func_voice_selection(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; #ifdef DEBUG @@ -1956,7 +2075,7 @@ void UI_func_volume(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; #ifdef DEBUG diff --git a/config.h b/config.h index d954ae6..776634c 100644 --- a/config.h +++ b/config.h @@ -346,6 +346,58 @@ enum { DEXED, REVERB, DELAY, CHORUS }; #define MONOPOLY_MAX 1 #define MONOPOLY_DEFAULT 1 +#define PB_RANGE_MIN 0 +#define PB_RANGE_MAX 12 +#define PB_RANGE_DEFAULT 1 + +#define PB_STEP_MIN 0 +#define PB_STEP_MAX 12 +#define PB_STEP_DEFAULT 1 + +#define MW_RANGE_MIN 0 +#define MW_RANGE_MAX 12 +#define MW_RANGE_DEFAULT 12 + +#define MW_ASIGN_MIN 0 +#define MW_ASSIGN_MAX 7 +#define MW_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias + +#define FC_RANGE_MIN 0 +#define FC_RANGE_MAX 99 +#define FC_RANGE_DEFAULT 50 + +#define FC_ASSIGN_MIN 0 +#define FC_ASSIGN_MAX 7 +#define FC_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias + +#define BC_RANGE_MIN 0 +#define BC_RANGE_MAX 99 +#define BC_RANGE_DEFAULT 50 + +#define BC_ASSIGN_MIN 0 +#define BC_ASSIGN_MAX 7 +#define BC_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias + +#define AT_RANGE_MIN 0 +#define AT_RANGE_MAX 99 +#define AT_RANGE_DEFAULT 50 + +#define AT_ASSIGN_MIN 0 +#define AT_ASSIGN_MAX 7 +#define AT_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias + +#define PORTAMENTO_MODE_MIN 0 +#define PORTAMENTO_MODE_MAX 1 +#define PORTAMENTO_MODE_DEFAULT 0 // 0: Retain, 1: Follow + +#define PORTAMENTO_GLISS_MIN 0 +#define PORTAMENTO_GLISS_MAX 1 +#define PORTAMENTO_GLISS_DEFAULT 0 + +#define PORTAMENTO_TIME_MIN 0 +#define PORTAMENTO_TIME_MAX 99 +#define PORTAMENTO_TIME_DEFAULT 50 + // struct for holding the current configuration struct config_t { uint32_t checksum; @@ -371,6 +423,16 @@ struct config_t { uint8_t polyphony[NUM_DEXED]; uint8_t engine[NUM_DEXED]; uint8_t monopoly[NUM_DEXED]; + uint8_t pb_range[NUM_DEXED]; + uint8_t pb_step[NUM_DEXED]; + uint8_t mw_range[NUM_DEXED]; + uint8_t mw_assign[NUM_DEXED]; + uint8_t fc_range[NUM_DEXED]; + uint8_t fc_assign[NUM_DEXED]; + uint8_t bc_range[NUM_DEXED]; + uint8_t bc_assign[NUM_DEXED]; + uint8_t at_range[NUM_DEXED]; + uint8_t at_assign[NUM_DEXED]; }; inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max) diff --git a/dexed.cpp b/dexed.cpp index 31617af..34e9fe9 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -591,3 +591,34 @@ bool Dexed::initGlobalParameters(void) return (true); } + +void Dexed::setControllers(uint8_t pb_range, uint8_t pb_step, uint8_t mw_range, uint8_t mw_assign, uint8_t fc_range, uint8_t fc_assign, uint8_t bc_range, uint8_t bc_assign, uint8_t at_range, uint8_t at_assign) +{ + pb_range %= PB_RANGE_MAX; + pb_step %= PB_STEP_MAX; + mw_range %= MW_RANGE_MAX; + mw_assign %= MW_ASSIGN_MAX; + fc_range %= FC_RANGE_MAX; + fc_assign %= FC_ASSIGN_MAX; + bc_range %= BC_RANGE_MAX; + bc_assign %= BC_ASSIGN_MAX; + at_range %= AT_RANGE_MAX; + at_assign %= AT_ASSIGN_MAX; + + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE] = controllers.values_[kControllerPitchRange] = pb_range; + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP] = controllers.values_[kControllerPitchStep] = pb_step; + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE] = mw_range; + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN] = mw_assign; + controllers.wheel.setTarget(mw_assign); + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE] = fc_range; + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN] = fc_assign; + controllers.foot.setTarget(fc_assign); + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE] = bc_range; + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN] = bc_assign; + controllers.breath.setTarget(bc_assign); + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE] = at_range; + data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN] = at_assign; + controllers.at.setTarget(at_assign); + + controllers.refresh(); +} diff --git a/dexed.h b/dexed.h index 24f69fb..6e039e2 100644 --- a/dexed.h +++ b/dexed.h @@ -164,6 +164,7 @@ class Dexed void setSustain(bool sustain); bool getSustain(void); uint8_t getNumNotesPlaying(void); + void setControllers(uint8_t pb_range, uint8_t pb_Step, uint8_t mw_range, uint8_t mw_assign, uint8_t fc_range, uint8_t fw_assign, uint8_t bc_range, uint8_t bc_assign, uint8_t at_range, uint8_t at_assign); ProcessorVoice voices[MAX_NOTES]; Controllers controllers; @@ -187,7 +188,7 @@ class Dexed 16 // number of voices }; // FM-Piano - uint32_t overload = 0; + uint32_t overload = 0; protected: static const uint8_t MAX_ACTIVE_NOTES = MAX_NOTES; uint8_t max_notes = MAX_ACTIVE_NOTES;