diff --git a/UI.hpp b/UI.hpp index bc2bab4..2e312fb 100644 --- a/UI.hpp +++ b/UI.hpp @@ -308,6 +308,7 @@ 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); void UI_func_arpeggio(uint8_t param); +void UI_func_seq_mute_matrix(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); @@ -4899,13 +4900,13 @@ void arp_refresh_display_play_status() } void seq_print_current_note() { - lcd.print(noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][0] ); - if (noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][1] != '\0' ) - { - lcd.print(noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][1] ); - } - lcd.print( (seq_data[seq_active_track][seq_menu - 3] / 12) - 1); - lcd.print(" "); + lcd.print(noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][0] ); + if (noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][1] != '\0' ) + { + lcd.print(noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][1] ); + } + lcd.print( (seq_data[seq_active_track][seq_menu - 3] / 12) - 1); + lcd.print(" "); } void UI_func_seq_pattern_editor(uint8_t param) { @@ -5402,9 +5403,9 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.print(temp_int); } else if (seq_menu == 0) { #ifdef TESTDISPLAY20x4 - lcd.setCursor(14, 0); + lcd.setCursor(13, 0); lcd.print(" "); - lcd.setCursor(16, 0); + lcd.setCursor(15, 0); lcd.print(" "); #else lcd.setCursor(9, 0); @@ -5489,7 +5490,7 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.setCursor(7, 0); lcd.print(" "); #ifdef TESTDISPLAY20x4 - lcd.setCursor(17, 0); + lcd.setCursor(16, 0); lcd.print(" "); lcd.setCursor(19, 0); lcd.print(" "); @@ -5500,10 +5501,10 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.print(" "); #endif #ifdef TESTDISPLAY20x4 - lcd.setCursor(14, 0); + lcd.setCursor(13, 0); lcd.print("["); seq_refresh_display_play_status(); - lcd.setCursor(16, 0); + lcd.setCursor(15, 0); lcd.print("]"); #else lcd.setCursor(9, 0); @@ -5515,9 +5516,9 @@ void UI_func_seq_pattern_editor(uint8_t param) } if (seq_menu == 2) { #ifdef TESTDISPLAY20x4 - lcd.setCursor(14, 0); + lcd.setCursor(13, 0); lcd.print(" "); - lcd.setCursor(16, 0); + lcd.setCursor(15, 0); lcd.print(" "); lcd.setCursor(16, 0); lcd.print("["); @@ -5554,7 +5555,7 @@ void UI_func_seq_pattern_editor(uint8_t param) } if (seq_menu == 3) { #ifdef TESTDISPLAY20x4 - lcd.setCursor(17, 0); + lcd.setCursor(16, 0); lcd.print(" "); lcd.setCursor(19, 0); lcd.print(" "); @@ -5592,17 +5593,27 @@ void UI_func_seq_pattern_editor(uint8_t param) { lcd.setCursor(0, 0); lcd.print("[EDIT "); - seq_print_current_note(); + seq_print_current_note(); lcd.setCursor(8, 0); lcd.print("?]"); } else - { - lcd.setCursor(0, 0); - lcd.print(" "); - lcd.show(0, 1, 6, basename(drum_config[activesample].name)); - lcd.print(" "); - } + //print current sample name on active step if not empty + if (seq_data[seq_active_track][seq_menu - 3] > 0) + { + lcd.setCursor(0, 0); + lcd.print(" "); + lcd.show(0, 1, 6, seq_find_drum_name_from_note( seq_data[seq_active_track][seq_menu - 3]) ); + lcd.print(" "); + } + else + { //if step empty, print selected, active sample + if (seq_data[seq_active_track][seq_menu - 3] == 0) + lcd.setCursor(0, 0); + lcd.print(" "); + lcd.show(0, 1, 6, basename(drum_config[activesample].name)); + lcd.print(" "); + } } else if (seq_active_function == 40 && activesample != NUM_DRUMSET_CONFIG - 1) { //is in pitch edit function 40 @@ -5952,6 +5963,250 @@ void UI_func_seq_pat_chain(uint8_t param) } } +#ifdef TESTDISPLAY20x4 +void UI_func_seq_mute_matrix(uint8_t param) // for test display 20x4 +{ + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + seq_temp_active_menu = 99; + seq_temp_select_menu = 1; + seq_menu = 0; + temp_int = 0; //y offset + lcd.setCursor( 0, 0); + } + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + uint8_t xscroll; + if (seq_temp_active_menu == 99) { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + { + if (LCDML.BT_checkDown()) + { + seq_temp_select_menu = constrain(seq_temp_select_menu + 1, 0, NUM_SEQ_TRACKS + 1); + if (seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int != 3) //next chain step + { + lcd.setCursor( 14 , temp_int); + lcd.print(" "); + lcd.setCursor( 18 , temp_int); + lcd.print(" "); + seq_temp_select_menu = 1; + if (temp_int < 3)temp_int++; + } + if (seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int == 3) + seq_temp_select_menu = NUM_SEQ_TRACKS; + } + else if (LCDML.BT_checkUp()) + { + seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS + 1); + if (seq_temp_select_menu == 0 && temp_int > 0) //prev chain step + { + lcd.setCursor( 2 , temp_int); + lcd.print(" "); + lcd.setCursor( 6 , temp_int); + lcd.print(" "); + seq_temp_select_menu = NUM_SEQ_TRACKS - 1 ; + if (temp_int >= 0)temp_int = temp_int - 1; + lcd.setCursor( 14 , temp_int); + lcd.print("["); + lcd.setCursor( 18 , temp_int); + lcd.print("]"); + } + else if (seq_temp_select_menu < 1 && temp_int == 0 ) + seq_temp_select_menu = 1; + } + } + } + if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + { + if (seq_patternchain[temp_int][seq_temp_select_menu - 1] < NUM_SEQ_PATTERN) + seq_patternchain[temp_int][seq_temp_select_menu - 1] = seq_patternchain[temp_int][seq_temp_select_menu - 1] + (NUM_SEQ_PATTERN + 10); + else if (seq_patternchain[temp_int][seq_temp_select_menu - 1] > NUM_SEQ_PATTERN && seq_patternchain[temp_int][seq_temp_select_menu - 1] != 99) + seq_patternchain[temp_int][seq_temp_select_menu - 1] = seq_patternchain[temp_int][seq_temp_select_menu - 1] - (NUM_SEQ_PATTERN + 10); + else if (seq_patternchain[temp_int][seq_temp_select_menu - 1] == 99) + seq_patternchain[temp_int][seq_temp_select_menu - 1] = NUM_SEQ_PATTERN - 1; + } + if (seq_temp_select_menu - 1 < 4)xscroll = 0; + else if (seq_temp_select_menu - 1 == 4)xscroll = 1; + else xscroll = 2; + for (uint8_t y = 0; y < 4; y++) + { + for (uint8_t x = 0; x < NUM_SEQ_TRACKS - 2; x++) + { + lcd.setCursor( x * 4 + 3, y); + if (seq_patternchain[y][x + xscroll] < NUM_SEQ_PATTERN ) + { + if (seq_track_type[x + xscroll ] == 0 ) lcd.print("D"); + else if (seq_track_type[x + xscroll ] == 1 ) lcd.print("I"); + else if (seq_track_type[x + xscroll ] == 2 ) lcd.print("C"); + else lcd.print("A"); + if (seq_patternchain[y][x + xscroll] < 10) + lcd.print("0"); + lcd.print( seq_patternchain[y][x + xscroll] ); + } + else + lcd.print("OFF"); + } + } + if (xscroll == 0) + { + //print cursor + lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 2, temp_int); + lcd.print("["); + lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 6, temp_int); + lcd.print("]"); + if ((seq_temp_select_menu - 1) > 0) { + lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 2 - 4 , temp_int); + lcd.print(" "); + } + if ((seq_temp_select_menu - 1) < 4) { + lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 6 + 4 , temp_int); + lcd.print(" "); + } + } + lcd.setCursor( 0, 0); + lcd.print("T"); + lcd.print(seq_temp_select_menu); + lcd.setCursor( 0, 1); + lcd.print("S"); + lcd.print(temp_int + 1); // Chain Step + } + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } +} + +#else + +void UI_func_seq_mute_matrix(uint8_t param) // for standard display 16x2 +{ + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + seq_temp_active_menu = 99; + seq_temp_select_menu = 1; + seq_menu = 0; + temp_int = 0; //y offset + lcd.setCursor( 0, 0); + } + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + uint8_t xscroll; + if (seq_temp_active_menu == 99) { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + { + if (LCDML.BT_checkDown()) + { + seq_temp_select_menu = constrain(seq_temp_select_menu + 1, 0, NUM_SEQ_TRACKS + 1); + if (seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int != 3) //next chain step + { + lcd.setCursor( 10 , 1); + lcd.print(" "); + lcd.setCursor( 14 , 1); + lcd.print(" "); + seq_temp_select_menu = 1; + if (temp_int < 3)temp_int++; + } + if (seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int == 3) + seq_temp_select_menu = NUM_SEQ_TRACKS; + } + else if (LCDML.BT_checkUp()) + { + seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS + 1); + if (seq_temp_select_menu == 0 && temp_int > 0) //prev chain step + { + lcd.setCursor( 2 , 1); + lcd.print(" "); + lcd.setCursor( 6 , 1); + lcd.print(" "); + seq_temp_select_menu = NUM_SEQ_TRACKS - 1 ; + if (temp_int >= 0)temp_int = temp_int - 1; + lcd.setCursor( 10 , 1); + lcd.print("["); + lcd.setCursor( 14 , 1); + lcd.print("]"); + } + else if (seq_temp_select_menu < 1 && temp_int == 0 ) + seq_temp_select_menu = 1; + } + } + } + if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + { + if (seq_patternchain[temp_int][seq_temp_select_menu - 1] < NUM_SEQ_PATTERN) + seq_patternchain[temp_int][seq_temp_select_menu - 1] = seq_patternchain[temp_int][seq_temp_select_menu - 1] + (NUM_SEQ_PATTERN + 10); + else if (seq_patternchain[temp_int][seq_temp_select_menu - 1] > NUM_SEQ_PATTERN && seq_patternchain[temp_int][seq_temp_select_menu - 1] != 99) + seq_patternchain[temp_int][seq_temp_select_menu - 1] = seq_patternchain[temp_int][seq_temp_select_menu - 1] - (NUM_SEQ_PATTERN + 10); + else if (seq_patternchain[temp_int][seq_temp_select_menu - 1] == 99) + seq_patternchain[temp_int][seq_temp_select_menu - 1] = NUM_SEQ_PATTERN - 1; + } + if (seq_temp_select_menu - 1 < 3)xscroll = 0; + else xscroll = seq_temp_select_menu - 3; + + if (xscroll == 0) + { + //print cursor + lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 2, 1); + lcd.print("["); + lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 6, 1); + lcd.print("]"); + if ((seq_temp_select_menu - 1) > 0) + { + lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 2 - 4 , 1); + lcd.print(" "); + } + if ((seq_temp_select_menu - 1) < 4) + { + lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 6 + 4 , 1); + lcd.print(" "); + } + lcd.setCursor( 3, 0); + lcd.print("T1"); + lcd.setCursor( 7, 0); + lcd.print("T2"); + lcd.setCursor( 11, 0); + lcd.print("T3"); + } + else + { + lcd.setCursor( 3, 0); + lcd.print("T"); + lcd.print(seq_temp_select_menu - 2); + lcd.setCursor( 7, 0); + lcd.print("T"); + lcd.print(seq_temp_select_menu - 2 + 1); + lcd.setCursor( 11, 0); + lcd.print("T"); + lcd.print(seq_temp_select_menu - 2 + 2); + } + for (uint8_t x = 0; x < NUM_SEQ_TRACKS - 3; x++) + { + lcd.setCursor( x * 4 + 3, 1); + if (seq_patternchain[temp_int][x + xscroll] < NUM_SEQ_PATTERN ) + { + if (seq_track_type[x + xscroll] == 0 ) lcd.print("D"); + else if (seq_track_type[x + xscroll ] == 1 ) lcd.print("I"); + else if (seq_track_type[x + xscroll ] == 2 ) lcd.print("C"); + else lcd.print("A"); + if (seq_patternchain[temp_int][x + xscroll] < 10) + lcd.print("0"); + lcd.print( seq_patternchain[temp_int][x + xscroll] ); + } + else + lcd.print("OFF"); + } + lcd.setCursor( 0, 1); + lcd.print("S"); + lcd.print(temp_int + 1); // Chain Step + } + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } +} +#endif + void UI_func_seq_track_setup(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP *********