diff --git a/UI.hpp b/UI.hpp index 3377a2d..c853110 100644 --- a/UI.hpp +++ b/UI.hpp @@ -848,7 +848,8 @@ void callback_velocity_sense_function() void callback_effect_function() { #ifdef DEBUG - Serial.println(F("callback_effect_function")); + Serial.print(F("callback_effect_function, focus position: ")); + Serial.println(menu_position[EFFECTS]); #endif menu_system.change_menu(effects_menu); menu_system.set_focusPosition(Position::LEFT); @@ -1229,32 +1230,36 @@ void encoder_switch_focus(uint8_t encoder_last, uint8_t encoder_value) } } -void goto_main_menu(void) +void goto_main_menu(uint8_t menu_number) { + menu_position[menu_number] = enc[RIGHT_ENCODER].read(); menu_system.change_menu(main_menu); menu_system.set_focusPosition(Position::LEFT); encoder_value[RIGHT_ENCODER] = menu_position[MAIN]; enc[RIGHT_ENCODER].write(menu_position[MAIN], 0, NUM_MAIN_MENUS - 1); } -void goto_edit_sound_menu(void) +void goto_edit_sound_menu(uint8_t menu_number) { + menu_position[menu_number] = enc[RIGHT_ENCODER].read(); menu_system.change_menu(edit_sound_menu); menu_system.set_focusPosition(Position::LEFT); encoder_value[RIGHT_ENCODER] = menu_position[EDIT_SOUND]; enc[RIGHT_ENCODER].write(menu_position[EDIT_SOUND], 0, NUM_EDIT_SOUND_MENUS - 1); } -void goto_effects_menu(void) +void goto_effects_menu(uint8_t menu_number) { + menu_position[menu_number] = enc[RIGHT_ENCODER].read(); menu_system.change_menu(effects_menu); menu_system.set_focusPosition(Position::LEFT); encoder_value[RIGHT_ENCODER] = menu_position[EFFECTS]; enc[RIGHT_ENCODER].write(menu_position[EFFECTS], 0, NUM_EFFECTS_MENUS - 1); } -void goto_system_menu(void) +void goto_system_menu(uint8_t menu_number) { + menu_position[menu_number] = enc[RIGHT_ENCODER].read(); menu_system.change_menu(system_menu); menu_system.set_focusPosition(Position::LEFT); encoder_value[RIGHT_ENCODER] = menu_position[SYSTEM]; @@ -2075,7 +2080,7 @@ void handle_ui(void) #ifdef DEBUG Serial.println(F("from master_volume to main")); #endif - goto_main_menu(); + goto_main_menu(MASTER_VOLUME); } } @@ -2527,14 +2532,14 @@ void handle_ui(void) #ifdef DEBUG Serial.println(F("from load_sound to main")); #endif - goto_main_menu(); + goto_main_menu(LOAD_SOUND); } else if (menu_system.get_currentScreen() == &edit_sound_screen) // sound menu { #ifdef DEBUG Serial.println(F("from load_sound to main")); #endif - goto_main_menu(); + goto_main_menu(EDIT_SOUND); } else if (menu_system.get_currentScreen() == &decay_screen) // decay menu @@ -2542,252 +2547,252 @@ void handle_ui(void) #ifdef DEBUG Serial.println(F("from decay to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(DECAY); } else if (menu_system.get_currentScreen() == &release_screen) // release menu { #ifdef DEBUG Serial.println(F("from release to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(RELEASE); } else if (menu_system.get_currentScreen() == &hardness_screen) // hardness menu { #ifdef DEBUG Serial.println(F("from hardness to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(HARDNESS); } else if (menu_system.get_currentScreen() == &treble_screen) // treble menu { #ifdef DEBUG Serial.println(F("from treble to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(TREBLE); } else if (menu_system.get_currentScreen() == &stereo_screen) // stereo menu { #ifdef DEBUG Serial.println(F("from stereo to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(STEREO_LEVEL); } else if (menu_system.get_currentScreen() == &transpose_screen) // transpose menu { #ifdef DEBUG Serial.println(F("from transpose to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(TRANSPOSE); } else if (menu_system.get_currentScreen() == &tune_screen) // tune menu { #ifdef DEBUG Serial.println(F("from tune to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(TUNE); } else if (menu_system.get_currentScreen() == &detune_screen) // detune menu { #ifdef DEBUG Serial.println(F("from detune to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(DETUNE); } else if (menu_system.get_currentScreen() == &velocity_sense_screen) // velocity_sense menu { #ifdef DEBUG Serial.println(F("from velocity_sense to edit_sound")); #endif - goto_edit_sound_menu(); + goto_edit_sound_menu(VELOCITY_SENSE); } else if (menu_system.get_currentScreen() == &effects_screen) // effect menu { #ifdef DEBUG Serial.println(F("from effect to main")); #endif - goto_main_menu(); + goto_main_menu(EFFECTS); } else if (menu_system.get_currentScreen() == &pan_trem_frequency_screen) //pan_trem_frequency menu { #ifdef DEBUG Serial.println(F("from pan_trem_frequency to effects")); #endif - goto_effects_menu(); + goto_effects_menu(PAN_TREM_FREQUENCY); } else if (menu_system.get_currentScreen() == &pan_trem_level_screen) // pan_trem_level menu { #ifdef DEBUG Serial.println(F("from pan_trem_level to effects")); #endif - goto_effects_menu(); + goto_effects_menu(PAN_TREM_LEVEL); } else if (menu_system.get_currentScreen() == &overdrive_screen) // overdrive menu { #ifdef DEBUG Serial.println(F("from overdrive to effects")); #endif - goto_effects_menu(); + goto_effects_menu(OVERDRIVE); } else if (menu_system.get_currentScreen() == &comp_gain_screen) // comp_gain menu { #ifdef DEBUG Serial.println(F("from comp_gain to effects")); #endif - goto_effects_menu(); + goto_effects_menu(COMP_GAIN); } else if (menu_system.get_currentScreen() == &comp_response_screen) // comp_response menu { #ifdef DEBUG Serial.println(F("from comp_response to effects")); #endif - goto_effects_menu(); + goto_effects_menu(COMP_RESPONSE); } else if (menu_system.get_currentScreen() == &comp_limit_screen) // comp_limit menu { #ifdef DEBUG Serial.println(F("from comp_limit to effects")); #endif - goto_effects_menu(); + goto_effects_menu(COMP_LIMIT); } else if (menu_system.get_currentScreen() == &comp_threshold_screen) // comp_threshold menu { #ifdef DEBUG Serial.println(F("from comp_threshold to effects")); #endif - goto_effects_menu(); + goto_effects_menu(COMP_THRESHOLD); } else if (menu_system.get_currentScreen() == &comp_attack_screen) // comp_attack menu { #ifdef DEBUG Serial.println(F("from comp_attack to effects")); #endif - goto_effects_menu(); + goto_effects_menu(COMP_ATTACK); } else if (menu_system.get_currentScreen() == &comp_decay_screen) // comp_decay menu { #ifdef DEBUG Serial.println(F("from comp_decay to effects")); #endif - goto_effects_menu(); + goto_effects_menu(COMP_DECAY); } else if (menu_system.get_currentScreen() == &reverb_roomsize_screen) // reverb_roomsize menu { #ifdef DEBUG Serial.println(F("from reverb_roomsize to effects")); #endif - goto_effects_menu(); + goto_effects_menu(REV_ROOMSIZE); } else if (menu_system.get_currentScreen() == &reverb_damping_screen) // reverb_damping menu { #ifdef DEBUG Serial.println(F("from reverb_damping to effects")); #endif - goto_effects_menu(); + goto_effects_menu(REV_DAMPING); } else if (menu_system.get_currentScreen() == &reverb_level_screen) // reverb_level menu { #ifdef DEBUG Serial.println(F("from reverb_level to effects")); #endif - goto_effects_menu(); + goto_effects_menu(REV_LEVEL); } else if (menu_system.get_currentScreen() == &chorus_frequency_screen) // chorus_frequency menu { #ifdef DEBUG Serial.println(F("from chorus_frequency to effects")); #endif - goto_effects_menu(); + goto_effects_menu(CHORUS_FREQ); } else if (menu_system.get_currentScreen() == &chorus_delay_screen) // chorus_delay menu { #ifdef DEBUG Serial.println(F("from chorus_delay to effects")); #endif - goto_effects_menu(); + goto_effects_menu(CHORUS_DELAY); } else if (menu_system.get_currentScreen() == &chorus_level_screen) // chorus_level menu { #ifdef DEBUG Serial.println(F("from chorus_level to effects")); #endif - goto_effects_menu(); + goto_effects_menu(CHORUS_LEVEL); } else if (menu_system.get_currentScreen() == &bass_lr_level_screen) // bass_lr_level menu { #ifdef DEBUG Serial.println(F("from bass_lr_level to effects")); #endif - goto_effects_menu(); + goto_effects_menu(BASS_LR_LEVEL); } else if (menu_system.get_currentScreen() == &bass_mono_level_screen) // bass_mono_level menu { #ifdef DEBUG Serial.println(F("from bass_mono_level to effects")); #endif - goto_effects_menu(); + goto_effects_menu(BASS_MONO_LEVEL); } else if (menu_system.get_currentScreen() == &eq_bass_screen) // eq_bass menu { #ifdef DEBUG Serial.println(F("from eq_bass to effects")); #endif - goto_effects_menu(); + goto_effects_menu(EQ_BASS); } else if (menu_system.get_currentScreen() == &eq_treble_screen) // eq_treble menu { #ifdef DEBUG Serial.println(F("from eq_treble to main")); #endif - goto_effects_menu(); + goto_effects_menu(EQ_TREBLE); } else if (menu_system.get_currentScreen() == &save_sound_screen) // save_sound menu { #ifdef DEBUG Serial.println(F("from save_sound to main")); #endif - goto_main_menu(); + goto_main_menu(SAVE_SOUND); } else if (menu_system.get_currentScreen() == &system_screen) // system menu { #ifdef DEBUG Serial.println(F("from system to main")); #endif - goto_main_menu(); + goto_main_menu(SYSTEM); } else if (menu_system.get_currentScreen() == &loudness_screen) // loudness menu { #ifdef DEBUG Serial.println(F("from loudness to system")); #endif - goto_system_menu(); + goto_system_menu(LOUDNESS); } else if (menu_system.get_currentScreen() == &midi_channel_screen) // midi_channel menu { #ifdef DEBUG Serial.println(F("from midi_channel to system")); #endif - goto_system_menu(); + goto_system_menu(MIDI_CHANNEL); } else if (menu_system.get_currentScreen() == &midi_soft_thru_screen) // midi_soft_thru menu { #ifdef DEBUG Serial.println(F("from midi_soft_thru to system")); #endif - goto_system_menu(); + goto_system_menu(MIDI_SOFT_THRU); } else if (menu_system.get_currentScreen() == &max_poly_screen) // max_poly menu { #ifdef DEBUG Serial.println(F("from max_poly to system")); #endif - goto_system_menu(); + goto_system_menu(MAX_POLY); } else if (menu_system.get_currentScreen() == &info_screen) // info menu { #ifdef DEBUG Serial.println(F("from info to main")); #endif - goto_main_menu(); + goto_main_menu(INFO); } } }