From 9b1960e8986f7709ce0fccf2ddb3ebc43b39dd93 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 27 Sep 2019 14:24:08 +0200 Subject: [PATCH] Small fixes. Added menu for master panorama. --- UI.hpp | 82 +++++++++++++++++++++++++++++++++++++++++++++++++------- config.h | 6 ++--- 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/UI.hpp b/UI.hpp index 9e7a31f..a84f399 100644 --- a/UI.hpp +++ b/UI.hpp @@ -28,7 +28,7 @@ const uint8_t MAX_VARIABLES = 5; ///< @note Default: 5 /// Configures the number of available functions per line. - const uint8_t MAX_FUNCTIONS = 41; ///< @note Default: 8 + const uint8_t MAX_FUNCTIONS = 42; ///< @note Default: 8 /// Configures the number of available lines per screen. const uint8_t MAX_LINES = 20; ///< @note Default: 12 @@ -37,7 +37,7 @@ const uint8_t MAX_SCREENS = 2; ///< @note Default: 14 /// Configures the number of available menus per menus system. - const uint8_t MAX_MENUS = 44; ///< @note Default: 8 + const uint8_t MAX_MENUS = 45; ///< @note Default: 8 */ @@ -103,10 +103,11 @@ elapsedMillis back_to_main; #define MIDI_SOFT_THRU 38 #define MAX_POLY 39 #define MONO 40 +#define PANORAMA 41 /*************************************/ -#define STORE_QUESTION 41 +#define STORE_QUESTION 42 /*************************************/ -#define MASTER_VOLUME 42 +#define MASTER_VOLUME 43 /*************************************/ int8_t menu_position[NUM_MENUS]; @@ -708,17 +709,19 @@ LiquidMenu save_sound_menu(lcd); /****************************************** SYSTEM MENU ******************************************/ -#define NUM_SYSTEM_MENUS 5 +#define NUM_SYSTEM_MENUS 6 const char system_text1[] PROGMEM = "Loudness"; const char system_text2[] PROGMEM = "MIDI Channel"; const char system_text3[] PROGMEM = "MIDI Soft-Thru"; const char system_text4[] PROGMEM = "Max. Polyphony"; const char system_text5[] PROGMEM = "Mono/Stereo"; +const char system_text6[] PROGMEM = "Panorama"; LiquidLine system_line1(1, 0, system_text1); LiquidLine system_line2(1, 1, system_text2); LiquidLine system_line3(1, 1, system_text3); LiquidLine system_line4(1, 1, system_text4); LiquidLine system_line5(1, 1, system_text5); +LiquidLine system_line6(1, 1, system_text6); LiquidScreen system_screen; LiquidMenu system_menu(lcd); @@ -772,6 +775,16 @@ LiquidLine mono_line2(1, 1, get_mono_value_text); LiquidScreen mono_screen; LiquidMenu mono_menu(lcd); +/****************************************** + PANORAMA MENU + ******************************************/ +#define NUM_PANORAMA_MENUS 1 +const char panorama_text1[] PROGMEM = "Panorama"; +LiquidLine panorama_line1(1, 0, panorama_text1); +LiquidLine panorama_line2(1, 1, configuration.pan); +LiquidScreen panorama_screen; +LiquidMenu panorama_menu(lcd); + /****************************************** INFO MENU ******************************************/ @@ -1335,6 +1348,18 @@ void callback_mono_function(void) menu_system.update(); } +void callback_panorama_function(void) +{ +#ifdef SHOW_DEBUG + Serial.println(F("callback_panorama_function")); +#endif + menu_system.change_menu(panorama_menu); + menu_position[SYSTEM] = encoder_value[RIGHT_ENCODER]; + encoder_value[RIGHT_ENCODER] = configuration.mono; + enc[RIGHT_ENCODER].write(configuration.mono, ENC_MASTER_PAN_MIN, ENC_MASTER_PAN_MAX); + menu_system.update(); +} + /****************************************** INFO MENU CALLBACKS ******************************************/ @@ -1717,12 +1742,13 @@ void init_menus(void) store_question_screen.set_displayLineCount(2); store_question_menu.add_screen(store_question_screen); - // setup effects menu + // setup system menu system_screen.add_line(system_line1); system_screen.add_line(system_line2); system_screen.add_line(system_line3); system_screen.add_line(system_line4); system_screen.add_line(system_line5); + system_screen.add_line(system_line6); system_screen.set_displayLineCount(2); system_menu.add_screen(system_screen); @@ -1731,6 +1757,7 @@ void init_menus(void) system_line3.attach_function(MIDI_SOFT_THRU, callback_midi_soft_thru_function); system_line4.attach_function(MAX_POLY, callback_max_poly_function); system_line5.attach_function(MONO, callback_mono_function); + system_line6.attach_function(PANORAMA, callback_panorama_function); // setup loudness loudness_screen.add_line(loudness_line1); @@ -1762,6 +1789,12 @@ void init_menus(void) mono_screen.set_displayLineCount(2); mono_menu.add_screen(mono_screen); + // setup panorama + panorama_screen.add_line(panorama_line1); + panorama_screen.add_line(panorama_line2); + panorama_screen.set_displayLineCount(2); + panorama_menu.add_screen(panorama_screen); + // setup info menu info_screen.add_line(info_line1); info_screen.add_line(info_line2); @@ -1817,6 +1850,7 @@ void init_menus(void) menu_system.add_menu(midi_soft_thru_menu); menu_system.add_menu(max_poly_menu); menu_system.add_menu(mono_menu); + menu_system.add_menu(panorama_menu); menu_system.add_menu(info_menu); menu_system.add_menu(master_volume_menu); @@ -1977,7 +2011,7 @@ void set_velocity_sense(uint8_t value) configuration.velocity_sense = value; } -void set_pan_trem_frequency(uint8_t value) +void set_pan_trem_frequency(int8_t value) { if (value > ENC_PAN_TREM_FREQUENCY_MAX) value = ENC_PAN_TREM_FREQUENCY_MAX; @@ -2292,8 +2326,8 @@ void set_midi_soft_thru(uint8_t value) void set_max_poly(uint8_t value) { - if (value > ENC_MAX_POLY_DEFAULT) - value = ENC_MAX_POLY_DEFAULT; + if (value > ENC_MAX_POLY_MAX) + value = ENC_MAX_POLY_MAX; #ifdef SHOW_DEBUG Serial.print(F("Set MAX_POLY ")); Serial.println(value); @@ -2325,6 +2359,19 @@ void set_mono(uint8_t mode) } } +void set_panorama(uint8_t value) +{ + if (value < ENC_MASTER_PAN_MIN) + value = ENC_MASTER_PAN_MIN; + if (value > ENC_MASTER_PAN_MAX) +#ifdef SHOW_DEBUG + Serial.print(F("Set MASTER_PANORAMA ")); + Serial.println(value); +#endif + configuration.pan = value; + set_master_volume(master_volume); +} + void set_complete_configuration(void) { set_decay(configuration.decay); @@ -2360,6 +2407,7 @@ void set_complete_configuration(void) set_midi_soft_thru(configuration.midi_soft_thru); set_max_poly(configuration.max_poly); set_mono(configuration.mono); + set_panorama(configuration.pan); } //********************************************************************************************+ @@ -2721,6 +2769,15 @@ void handle_ui(void) menu_system.update(); } } + else if (menu_system.get_currentScreen() == &panorama_screen) + { + if (encoder_tmp != encoder_value[RIGHT_ENCODER]) + { + // value up/down + set_panorama(encoder_tmp); + menu_system.update(); + } + } else { // Move menu focus @@ -3148,6 +3205,13 @@ void handle_ui(void) #endif goto_system_menu(MONO); } + else if (menu_system.get_currentScreen() == &panorama_screen) // panorama menu + { +#ifdef SHOW_DEBUG + Serial.println(F("from panorama to system")); +#endif + goto_system_menu(PANORAMA); + } else if (menu_system.get_currentScreen() == &info_screen) // info menu { #ifdef SHOW_DEBUG diff --git a/config.h b/config.h index fec77c8..6665d2a 100644 --- a/config.h +++ b/config.h @@ -63,7 +63,7 @@ #define USE_XFADE_DATA 1 // CHORUS parameters -#define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 10.0 ms delay buffer. +#define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 20.0 ms delay buffer. #define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE #define MOD_FILTER_OUTPUT MOD_LINKWITZ_RILEY_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT #define MOD_FILTER_CUTOFF_HZ 3000 @@ -106,7 +106,7 @@ 30: 1.22 Volts p-p 31: 1.16 Volts p-p */ -#define SGTL5000_LINEOUT_LEVEL 21 +#define SGTL5000_LINEOUT_LEVEL 17 //#define SDCARD_CS_PIN 10 //#define SDCARD_MOSI_PIN 7 //#define SDCARD_SCK_PIN 14 @@ -179,7 +179,7 @@ //* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!! //************************************************************************************************* -#define MICRO_MDAEPIANO_VERSION "0.9.9" +#define MICRO_MDAEPIANO_VERSION "1.0.0 alpha" /* HELPER MACROS */ #define TIME_MS2SAMPLES(x) floor(uint32_t(x) * AUDIO_SAMPLE_RATE / 1000)