diff --git a/MicroDexed.ino b/MicroDexed.ino index c18ba36..4c5b6f5 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -328,15 +328,15 @@ void setup() Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC); Serial.println(F(" samples")); #endif - master_mixer_r.gain(0, 1.0); - master_mixer_l.gain(0, 1.0); + master_mixer_r.gain(DEXED, 1.0); + master_mixer_l.gain(DEXED, 1.0); #ifdef USE_REVERB // INIT REVERB freeverbs1.roomsize(mapfloat(configuration.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 0.0, 1.0)); freeverbs1.damping(mapfloat(configuration.reverb_damping, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 0.0, 1.0)); - master_mixer_r.gain(1, mapfloat(configuration.reverb_level[0], REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); - master_mixer_l.gain(1, mapfloat(configuration.reverb_level[0], REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); + master_mixer_r.gain(REVERB, mapfloat(configuration.reverb_level[0], REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); + master_mixer_l.gain(REVERB, mapfloat(configuration.reverb_level[0], REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)); #endif // INIT DELAY @@ -345,8 +345,8 @@ void setup() //delay_fb_mixer.gain(0, 1.0 - (mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); // original signal delay_fb_mixer.gain(0, 1.0); // original signal delay_fb_mixer.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback - master_mixer_r.gain(2, mapfloat(configuration.delay_level[0], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); - master_mixer_l.gain(2, mapfloat(configuration.delay_level[0], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); + master_mixer_r.gain(DELAY, mapfloat(configuration.delay_level[0], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); + master_mixer_l.gain(DELAY, mapfloat(configuration.delay_level[0], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); // INIT CHORUS switch (configuration.chorus_waveform) @@ -377,8 +377,8 @@ void setup() modchorus_inverter.gain(-1.0); // stereo mode else modchorus_inverter.gain(1.0); // mono mode - master_mixer_r.gain(3, mapfloat(configuration.chorus_level[0], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); - master_mixer_l.gain(3, mapfloat(configuration.chorus_level[0], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); + master_mixer_r.gain(CHORUS, mapfloat(configuration.chorus_level[0], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); + master_mixer_l.gain(CHORUS, mapfloat(configuration.chorus_level[0], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); for (uint8_t i = 0; i < NUM_DEXED; i++) { @@ -658,7 +658,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) break; case 107: // CC 107: delay volume configuration.delay_level[0] = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); - master_mixer_r.gain(2, configuration.delay_level[0] / 100.0); + master_mixer_r.gain(DELAY, configuration.delay_level[0] / 100.0); master_mixer_l.gain(2, configuration.delay_level[0] / 100.0); break; case 120: diff --git a/UI.hpp b/UI.hpp index 11e45b8..dbebad4 100644 --- a/UI.hpp +++ b/UI.hpp @@ -144,6 +144,7 @@ void UI_func_panorama(uint8_t param); 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_information(uint8_t param); void UI_func_voice_selection(uint8_t param); void UI_func_volume(uint8_t param); @@ -157,6 +158,7 @@ LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control); // LCDML_add(id, prev_layer, new_num, lang_char_array, callback_function) +#if NUM_DEXED > 1 LCDML_add(0, LCDML_0, 1, "Setup", NULL); LCDML_add(1, LCDML_0_1, 1, "Instances", UI_function_not_implemented); LCDML_add(2, LCDML_0_1, 2, "Instance 1", NULL); @@ -168,7 +170,7 @@ LCDML_add(7, LCDML_0_1_2, 5, "Delay Level 1", UI_func_delay_level); LCDML_add(8, LCDML_0_1_2, 6, "Panorama 1", UI_func_panorama); 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_function_not_implemented); +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); @@ -204,7 +206,7 @@ LCDML_add(43, LCDML_0_1_3, 5, "Delay Level 2", UI_func_delay_level); LCDML_add(44, LCDML_0_1_3, 6, "Panorama 2", UI_func_panorama); 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_function_not_implemented); +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); @@ -251,7 +253,65 @@ LCDML_add(90, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(91, LCDML_0, 5, "Info", UI_func_information); #define _LCDML_DISP_cnt 91 #define MENU_ID_OF_INSTANCE_2 38 - +#else +LCDML_add(0, LCDML_0, 1, "Setup", NULL); +LCDML_add(1, LCDML_0_1, 2, "Instance 1", NULL); +LCDML_add(2, LCDML_0_1_2, 1, "MIDI Channel", UI_func_midi_channel); +LCDML_add(3, LCDML_0_1_2, 2, "Loudness", UI_func_loudness); +LCDML_add(4, LCDML_0_1_2, 3, "Reverb Level", UI_func_reverb_level); +LCDML_add(5, LCDML_0_1_2, 4, "Chorus Level", UI_func_chorus_level); +LCDML_add(6, LCDML_0_1_2, 5, "Delay Level", UI_func_delay_level); +LCDML_add(7, LCDML_0_1_2, 6, "Panorama", UI_func_panorama); +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(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(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(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(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(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(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(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); +LCDML_add(40, LCDML_0_2_1, 2, "Damping", UI_func_reverb_damping); +LCDML_add(41, LCDML_0_2, 2, "Chorus", NULL); +LCDML_add(42, LCDML_0_2_2, 1, "Frequency", UI_func_chorus_frequency); +LCDML_add(43, LCDML_0_2_2, 2, "Waveform", UI_func_chorus_waveform); +LCDML_add(44, LCDML_0_2_2, 3, "Depth", UI_func_chorus_depth); +LCDML_add(45, LCDML_0_2, 3, "Delay", NULL); +LCDML_add(46, LCDML_0_2_3, 1, "Time", UI_func_delay_time); +LCDML_add(47, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback); +LCDML_add(48, LCDML_0_2, 4, "Filter", NULL); +LCDML_add(49, LCDML_0_2_4, 1, "Cutoff", UI_func_filter_cutoff); +LCDML_add(50, LCDML_0_2_4, 2, "Resonance", UI_func_filter_resonance); +LCDML_add(51, LCDML_0, 3, "Store", NULL); +LCDML_add(52, LCDML_0, 4, "System", NULL); +LCDML_add(53, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(54, LCDML_0, 5, "Info", UI_func_information); +#define _LCDML_DISP_cnt 54 +#define MENU_ID_OF_INSTANCE_2 37 +#endif // create menu LCDML_createMenu(_LCDML_DISP_cnt); @@ -827,30 +887,6 @@ void lcdml_menu_display(void) /*********************************************************************** MENU ***********************************************************************/ -void UI_func_sound(uint8_t param) -{ - if (LCDML.FUNC_setup()) // ****** SETUP ********* - { - // setup function - lcd.setCursor(0, 0); - lcd.print(F("Sound")); - lcd.setCursor(0, 1); - lcd.print(F("not implemented")); - } - - if (LCDML.FUNC_loop()) // ****** LOOP ********* - { - if (LCDML.BT_checkEnter()) { // check if any button is pressed (enter, up, down, left, right) - // LCDML_goToMenu stops a running menu function and goes to the menu - LCDML.FUNC_goBackToMenu(); - } - } - - if (LCDML.FUNC_close()) // ****** STABLE END ********* - { - eeprom_write(); - } -} void UI_func_reverb_roomsize(uint8_t param) { @@ -986,8 +1022,8 @@ void UI_func_reverb_level(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.reverb_level[instance_id], 3, true, true, false); - master_mixer_r.gain(1, configuration.reverb_level[instance_id] / 100.0); - master_mixer_l.gain(1, configuration.reverb_level[instance_id] / 100.0); + master_mixer_r.gain(REVERB, configuration.reverb_level[instance_id] / 100.0); + master_mixer_l.gain(REVERB, configuration.reverb_level[instance_id] / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1180,8 +1216,8 @@ void UI_func_chorus_level(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.chorus_level[instance_id], 3, true, true, false); - master_mixer_r.gain(3, configuration.chorus_level[instance_id] / 100.0); - master_mixer_l.gain(3, configuration.chorus_level[instance_id] / 100.0); + master_mixer_r.gain(CHORUS, configuration.chorus_level[instance_id] / 100.0); + master_mixer_l.gain(CHORUS, configuration.chorus_level[instance_id] / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1317,8 +1353,8 @@ void UI_func_delay_level(uint8_t param) lcd.setCursor(0, 1); lcd_display_int(configuration.delay_level[instance_id], 3, true, true, false); - master_mixer_r.gain(2, configuration.delay_level[instance_id] / 100.0); - master_mixer_l.gain(2, configuration.delay_level[instance_id] / 100.0); + master_mixer_r.gain(DELAY, configuration.delay_level[instance_id] / 100.0); + master_mixer_l.gain(DELAY, configuration.delay_level[instance_id] / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1767,6 +1803,62 @@ void UI_func_engine(uint8_t param) } } +void UI_func_mono_poly(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("Mono/Polyphonic")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown()) + { + if (configuration.monopoly[instance_id] < MONOPOLY_MAX) + { + configuration.monopoly[instance_id]++; + } + } + else if (LCDML.BT_checkUp()) + { + if (configuration.monopoly[instance_id] > MONOPOLY_MIN) + { + configuration.monopoly[instance_id]--; + } + } + + lcd.setCursor(0, 1); + switch (configuration.monopoly[instance_id]) + { + case 0: + lcd.print(F("[MONOPHONIC]")); + break; + case 1: + lcd.print(F("[POLYPHONIC]")); + break; + } + + MicroDexed[instance_id]->setMonoMode(configuration.monopoly[instance_id]); + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + eeprom_write(); + } +} + void UI_func_information(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* diff --git a/config.h b/config.h index fc1a92f..d954ae6 100644 --- a/config.h +++ b/config.h @@ -212,6 +212,8 @@ //************************************************************************************************* #define NUM_DEXED 1 +enum { DEXED, REVERB, DELAY, CHORUS }; + // MIDI #ifdef MIDI_DEVICE_USB #define USBCON 1 @@ -340,6 +342,10 @@ #define ENGINE_MAX 2 #define ENGINE_DEFAULT 0 +#define MONOPOLY_MIN 0 +#define MONOPOLY_MAX 1 +#define MONOPOLY_DEFAULT 1 + // struct for holding the current configuration struct config_t { uint32_t checksum; @@ -364,6 +370,7 @@ struct config_t { uint8_t loudness[NUM_DEXED]; uint8_t polyphony[NUM_DEXED]; uint8_t engine[NUM_DEXED]; + uint8_t monopoly[NUM_DEXED]; }; inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)