diff --git a/UI.hpp b/UI.hpp index 2d7ebe1..a41ed8f 100644 --- a/UI.hpp +++ b/UI.hpp @@ -53,6 +53,7 @@ extern PeriodicTimer timer1; extern void sequencer(void); +extern bool check_sd_seq_exists(uint8_t); extern config_t configuration; extern void set_volume(uint8_t v, uint8_t m); @@ -78,6 +79,7 @@ extern uint8_t seq_patternchain[4][4]; extern uint8_t seq_content_type[10]; extern uint8_t seq_track_type[4]; extern uint8_t seq_step; +extern uint8_t seq_chord_key_ammount; extern int seq_tempo_ms; extern uint8_t seq_bpm; extern uint8_t seq_chain_lenght; @@ -97,9 +99,11 @@ extern uint8_t arp_step; extern uint8_t arp_note; extern uint8_t arp_chord; extern uint8_t arp_octave; -extern uint8_t arp_oct_usersetting; +extern uint8_t arp_lenght; extern uint8_t arp_style; extern uint8_t arp_speed; +extern uint8_t seq_element_shift; +extern int seq_oct_shift; extern char arp_style_names[4][3]; extern char seq_chord_names[7][4]; extern float drums_volume; @@ -284,6 +288,8 @@ void UI_func_information(uint8_t param); void UI_func_sequencer(uint8_t param); void UI_func_seq_vel_editor(uint8_t param); void UI_func_seq_live_transpose_oct(uint8_t param); +void UI_func_arp_shift(uint8_t param); +void UI_func_seq_chord_keys_ammount(uint8_t param); void UI_func_seq_lenght(uint8_t param); void UI_func_seq_tempo(uint8_t param); void UI_func_seq_pat_chain(uint8_t param); @@ -291,8 +297,8 @@ void UI_func_arpeggio(uint8_t param); void UI_func_seq_track_setup(uint8_t param); void UI_func_dexed_assign(uint8_t param); void UI_func_seq_display_style(uint8_t param); -void UI_func_seq_pattern_load(uint8_t param); -void UI_func_seq_pattern_save(uint8_t param); +void UI_func_seq_state_load(uint8_t param); +void UI_func_seq_state_save(uint8_t param); void UI_func_volume(uint8_t param); void UI_func_load_performance(uint8_t param); void UI_func_save_performance(uint8_t param); @@ -3808,6 +3814,88 @@ void UI_func_drum_volume(uint8_t param) } } +void UI_func_arp_shift(uint8_t param) +{ + char displayname[4] = {0, 0, 0, 0}; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + encoderDir[ENC_R].reset(); + lcd.setCursor(0, 0); + lcd.print("Arp/Chord Transp"); + lcd.setCursor(0, 1); + lcd.print("Oct"); + lcd.setCursor(4, 1); + sprintf(displayname, "%02d", seq_oct_shift); + lcd.print(displayname); + lcd.setCursor(8, 1); + lcd.print("Shift"); + lcd.setCursor(14, 1); + lcd.print(seq_element_shift); + } + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (menu_select_toggle == false) { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) + { + if (LCDML.BT_checkDown()) + { + seq_oct_shift = constrain(seq_oct_shift + ENCODER[ENC_R].speed(), -2, 2); + } + else if (LCDML.BT_checkUp()) + { + seq_oct_shift = constrain(seq_oct_shift - ENCODER[ENC_R].speed(), -2, 2); + } + } + } else { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) + { + if (LCDML.BT_checkDown()) + { + seq_element_shift = constrain(seq_element_shift + ENCODER[ENC_R].speed(), 0, 6); + } + else if (LCDML.BT_checkUp()) + { + seq_element_shift = constrain(seq_element_shift - ENCODER[ENC_R].speed(), 0, 6); + } + } + } + if (LCDML.BT_checkEnter()) + { + menu_select_toggle = !menu_select_toggle; + } + if (menu_select_toggle == false) + { lcd.setCursor(13, 1); + lcd.print(" "); + lcd.setCursor(15, 1); + lcd.print(" "); + lcd.setCursor(3, 1); + lcd.print("["); + lcd.setCursor(6, 1); + lcd.print("]"); + lcd.setCursor(4, 1); + sprintf(displayname, "%02d", seq_oct_shift); + lcd.print(displayname); + + } else { + lcd.setCursor(3, 1); + lcd.print(" "); + lcd.setCursor(6, 1); + lcd.print(" "); + lcd.setCursor(13, 1); + lcd.print("["); + lcd.setCursor(15, 1); + lcd.print("]"); + lcd.setCursor(14, 1); + lcd.print(seq_element_shift); + + } + } + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } +} + void UI_func_drum_pan(uint8_t param) { char displayname[8] = {0, 0, 0, 0, 0, 0, 0}; @@ -4092,6 +4180,38 @@ void UI_func_seq_live_transpose_oct(uint8_t param) } } +void UI_func_seq_chord_keys_ammount(uint8_t param) +{ + char displayname[4] = {0, 0, 0, 0}; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + encoderDir[ENC_R].reset(); + lcd.setCursor(0, 0); + lcd.print("ChordTrack Keys:"); + lcd.setCursor(8, 1); + lcd.print("Keys"); + } + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) + { + if (LCDML.BT_checkDown()) + seq_chord_key_ammount = constrain(seq_chord_key_ammount + ENCODER[ENC_R].speed(), 1, 7); + else if (LCDML.BT_checkUp()) + seq_chord_key_ammount = constrain(seq_chord_key_ammount - ENCODER[ENC_R].speed(), 1, 7); + } + lcd.setCursor(4, 1); + lcd.print("["); + sprintf(displayname, "%02d", seq_chord_key_ammount); + lcd.print(displayname); + lcd.print("]"); + } + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } +} + void UI_func_seq_lenght(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -4837,7 +4957,7 @@ void UI_func_arpeggio(uint8_t param) seq_temp_select_menu = 0; seq_temp_active_menu = 0; lcd.setCursor( 0, 0); - lcd.print("Oct"); + lcd.print("Len"); lcd.setCursor(7, 0); lcd.print( seq_chord_names[arp_chord][0]); lcd.print( seq_chord_names[arp_chord][1]); @@ -4859,12 +4979,13 @@ void UI_func_arpeggio(uint8_t param) seq_temp_select_menu = constrain(seq_temp_select_menu + ENCODER[ENC_R].speed(), 0, 3); else if (LCDML.BT_checkUp()) seq_temp_select_menu = constrain(seq_temp_select_menu - ENCODER[ENC_R].speed(), 0, 3); - } else if (seq_temp_active_menu == 1) // Octave setting + } + else if (seq_temp_active_menu == 1) // Octave setting { if (LCDML.BT_checkDown()) - arp_oct_usersetting = constrain(arp_oct_usersetting + ENCODER[ENC_R].speed(), 0, 3); + arp_lenght = constrain(arp_lenght + ENCODER[ENC_R].speed(), 0, 9); else if (LCDML.BT_checkUp()) - arp_oct_usersetting = constrain(arp_oct_usersetting - ENCODER[ENC_R].speed(), 0, 3); + arp_lenght = constrain(arp_lenght - ENCODER[ENC_R].speed(), 0, 9); } else if (seq_temp_active_menu == 2) // Style setting { @@ -4930,10 +5051,8 @@ void UI_func_arpeggio(uint8_t param) } } } - - lcd.setCursor( 4, 0); - lcd.print(arp_oct_usersetting); + lcd.print(arp_lenght); lcd.setCursor( 6, 1); lcd.print( arp_style_names[arp_style][0] ); lcd.print( arp_style_names[arp_style][1] ); @@ -4954,11 +5073,9 @@ void UI_func_arpeggio(uint8_t param) lcd.print(" "); lcd.setCursor( 15, 1); lcd.print(" "); - } else if (seq_temp_select_menu == 1) { - lcd.setCursor( 5, 1); lcd.print("["); lcd.setCursor( 9, 1); @@ -5002,7 +5119,6 @@ void UI_func_arpeggio(uint8_t param) lcd.setCursor( 5, 0); lcd.print(" "); } - } if (LCDML.FUNC_close()) // ****** STABLE END ********* { @@ -5430,7 +5546,7 @@ void UI_func_dexed_assign(uint8_t param) } } -void UI_func_seq_pattern_load(uint8_t param) +void UI_func_seq_state_load(uint8_t param) { static uint8_t mode; if (LCDML.FUNC_setup()) // ****** SETUP ********* @@ -5440,7 +5556,7 @@ void UI_func_seq_pattern_load(uint8_t param) mode = 0; encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); - lcd.print(F("Load Patterns")); + lcd.print(F("Load Seq. state ")); lcd.setCursor(0, 1); sprintf(tmp, "[%2d]", param); lcd.print(tmp); @@ -5471,11 +5587,18 @@ void UI_func_seq_pattern_load(uint8_t param) delay(MESSAGE_WAIT_TIME); LCDML.FUNC_goBackToMenu(); } - lcd.setCursor(0, 1); - char tmp[10]; - sprintf(tmp, "[%2d]", temp_int); - lcd.print(tmp); } + lcd.setCursor(0, 1); + char tmp[10]; + sprintf(tmp, "[%2d]", temp_int); + lcd.print(tmp); + lcd.setCursor(5, 1); + if (check_sd_seq_exists(temp_int)) + { + lcd.print("-- DATA --"); + } + else lcd.print(" "); + } if (LCDML.FUNC_close()) // ****** STABLE END ********* { @@ -5489,7 +5612,7 @@ void UI_func_seq_pattern_load(uint8_t param) } } -void UI_func_seq_pattern_save(uint8_t param) +void UI_func_seq_state_save(uint8_t param) { static bool overwrite; static bool yesno; @@ -5502,7 +5625,7 @@ void UI_func_seq_pattern_save(uint8_t param) mode = 0; encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); - lcd.print(F("Save Patterns to:")); + lcd.print(F("Save Seq. state:")); lcd.setCursor(0, 1); sprintf(tmp, "[%2d]", temp_int); lcd.print(tmp); @@ -5577,6 +5700,8 @@ void UI_func_seq_pattern_save(uint8_t param) lcd.setCursor(0, 1); sprintf(tmp, "[%2d]", temp_int); lcd.print(tmp); + lcd.setCursor(5, 1); + if (overwrite == false)lcd.print("-- empty --"); else lcd.print(" "); } else {