|
|
|
@ -139,7 +139,7 @@ extern bool save_sys_flag; |
|
|
|
|
elapsedMillis back_from_volume; |
|
|
|
|
uint8_t instance_num[8][8]; |
|
|
|
|
const char accepted_chars[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-abcdefghijklmnopqrstuvwxyz"; |
|
|
|
|
const char noteNames[12][3] = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }; |
|
|
|
|
//const char noteNames[12][3] = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
|
|
|
|
|
uint8_t active_perform_page = 1; |
|
|
|
|
uint8_t orig_attack_values[2][7]; |
|
|
|
|
uint8_t orig_release_values[2][7]; |
|
|
|
@ -746,14 +746,19 @@ void lcdml_menu_control(void) { |
|
|
|
|
LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); |
|
|
|
|
} else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note) && ask_before_quit == false) { |
|
|
|
|
ask_before_quit = true; |
|
|
|
|
Serial.printf("ask_before_quit = %d\n", ask_before_quit); |
|
|
|
|
encoderDir[ENC_L].reset(); |
|
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
|
LCDML.OTHER_updateFunc(); |
|
|
|
|
} else |
|
|
|
|
LCDML.loop_menu(); |
|
|
|
|
} else { |
|
|
|
|
ask_before_quit = false; |
|
|
|
|
Serial.printf("ask_before_quit = %d\n", ask_before_quit); |
|
|
|
|
LCDML.BT_quit(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (encoderDir[ENC_L].ButtonPressed() == true && (millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= LONG_BUTTON_PRESS) { |
|
|
|
|
#ifdef DEBUG |
|
|
|
@ -3860,10 +3865,10 @@ void _check_yes_no_back(uint8_t state) { |
|
|
|
|
if (state == 0) { // BACK
|
|
|
|
|
display.setCursor(0, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(3, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(4, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(5, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(8, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(9, 1); |
|
|
|
@ -3873,9 +3878,9 @@ void _check_yes_no_back(uint8_t state) { |
|
|
|
|
} else if (state == 1) { // NO
|
|
|
|
|
display.setCursor(0, 1); |
|
|
|
|
display.print(F("[")); |
|
|
|
|
display.setCursor(3, 1); |
|
|
|
|
display.print(F("]")); |
|
|
|
|
display.setCursor(4, 1); |
|
|
|
|
display.print(F("]")); |
|
|
|
|
display.setCursor(5, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(8, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
@ -3886,9 +3891,9 @@ void _check_yes_no_back(uint8_t state) { |
|
|
|
|
} else { // YES
|
|
|
|
|
display.setCursor(0, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(3, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(4, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(5, 1); |
|
|
|
|
display.print(F("[")); |
|
|
|
|
display.setCursor(8, 1); |
|
|
|
|
display.print(F("]")); |
|
|
|
@ -3904,7 +3909,7 @@ void _check_display_name(bool display_name, uint8_t digits) { |
|
|
|
|
display.setCursor(0, 1); |
|
|
|
|
display.print(F("[")); |
|
|
|
|
display.setCursor(9, 1); |
|
|
|
|
display.print(F("]")); |
|
|
|
|
display.print(F("] ")); |
|
|
|
|
display.setCursor(LCD_cols - digits - 2, 1); |
|
|
|
|
display.print(F(" ")); |
|
|
|
|
display.setCursor(LCD_cols - 1, 1); |
|
|
|
@ -4433,7 +4438,7 @@ void UI_func_drum_midi_note(uint8_t param) { |
|
|
|
|
midinote_old[i] = configuration.drums.midinote[i]; |
|
|
|
|
|
|
|
|
|
if (!display_name) |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_NOTE; |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_DRUM_NOTE; |
|
|
|
|
else |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_ON; |
|
|
|
|
|
|
|
|
@ -4448,15 +4453,17 @@ void UI_func_drum_midi_note(uint8_t param) { |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
|
{ |
|
|
|
|
if (ask_before_quit == true && ask_before_quit_mode == false) { |
|
|
|
|
if (ask_before_quit == true && ask_before_quit_mode <= 0) { |
|
|
|
|
uint8_t num_changes = 0; |
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++) { |
|
|
|
|
if (midinote_old[i] != configuration.drums.midinote[i]) |
|
|
|
|
num_changes++; |
|
|
|
|
} |
|
|
|
|
if (num_changes > 0) { |
|
|
|
|
ask_before_quit_mode = 0; |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_OFF; |
|
|
|
|
display.show(0, 0, 16, "Use this setup?"); |
|
|
|
|
display.show(1, 0, 16, " YES NO [BACK]"); |
|
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
|
} else { |
|
|
|
|
ask_before_quit = false; |
|
|
|
@ -4465,46 +4472,69 @@ void UI_func_drum_midi_note(uint8_t param) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (midi_learn_mode >= DRUMS_MIDI_NOTE_MIN) |
|
|
|
|
configuration.drums.midinote[active_sample] = midi_learn_mode; |
|
|
|
|
configuration.drums.midinote[active_sample] = midi_learn_mode & 0x7f; |
|
|
|
|
|
|
|
|
|
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()) { |
|
|
|
|
if (display_name == true) { |
|
|
|
|
if (active_sample < NUM_DRUMSET_CONFIG - 2) |
|
|
|
|
active_sample++; |
|
|
|
|
} else if (ask_before_quit_mode >= 0) { |
|
|
|
|
if (ask_before_quit_mode >= 0) { |
|
|
|
|
++ask_before_quit_mode %= 3; |
|
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
|
LCDML.OTHER_updateFunc(); |
|
|
|
|
LCDML.loop_menu(); |
|
|
|
|
} else { |
|
|
|
|
if (display_name == true) { |
|
|
|
|
if (active_sample < NUM_DRUMSET_CONFIG - 2) |
|
|
|
|
active_sample++; |
|
|
|
|
} else |
|
|
|
|
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] + ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX); |
|
|
|
|
} |
|
|
|
|
} else if (LCDML.BT_checkUp()) { |
|
|
|
|
if (ask_before_quit_mode >= 0) { |
|
|
|
|
if (ask_before_quit_mode > 0) |
|
|
|
|
ask_before_quit_mode--; |
|
|
|
|
else |
|
|
|
|
ask_before_quit_mode = 2; |
|
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
|
LCDML.OTHER_updateFunc(); |
|
|
|
|
LCDML.loop_menu(); |
|
|
|
|
} else { |
|
|
|
|
if (display_name == true) { |
|
|
|
|
if (active_sample > 0) |
|
|
|
|
active_sample--; |
|
|
|
|
} else if (ask_before_quit_mode >= 0) { |
|
|
|
|
--ask_before_quit_mode %= 3; |
|
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
|
} else { |
|
|
|
|
} else |
|
|
|
|
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] - ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX); |
|
|
|
|
} |
|
|
|
|
} else if (LCDML.BT_checkEnter()) { |
|
|
|
|
if (ask_before_quit_mode >= 0) { |
|
|
|
|
if (ask_before_quit_mode == 0) { // NO
|
|
|
|
|
if (ask_before_quit_mode == 2) { // NO
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++) |
|
|
|
|
configuration.drums.midinote[i] = midinote_old[i]; |
|
|
|
|
ask_before_quit = false; |
|
|
|
|
display.show(1, 0, 16, "Canceled."); |
|
|
|
|
delay(MESSAGE_WAIT_TIME); |
|
|
|
|
LCDML.FUNC_goBackToMenu(); |
|
|
|
|
} else if (ask_before_quit_mode == 1) { // YES
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++) |
|
|
|
|
configuration.drums.midinote[i] = midinote_old[i]; |
|
|
|
|
} else if (ask_before_quit_mode == 2) { // BACK
|
|
|
|
|
ask_before_quit = false; |
|
|
|
|
display.show(1, 0, 16, "Done."); |
|
|
|
|
delay(MESSAGE_WAIT_TIME); |
|
|
|
|
LCDML.FUNC_goBackToMenu(); |
|
|
|
|
} else if (ask_before_quit_mode == 0) { // BACK
|
|
|
|
|
ask_before_quit_mode = -1; |
|
|
|
|
ask_before_quit = false; |
|
|
|
|
LCDML.OTHER_updateFunc(); // TODO: Is this the right function for going back?
|
|
|
|
|
if (!display_name) |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_DRUM_NOTE; |
|
|
|
|
else |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_ON; |
|
|
|
|
LCDML.OTHER_updateFunc(); |
|
|
|
|
LCDML.loop_menu(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
display_name = !display_name; |
|
|
|
|
} |
|
|
|
|
} else display_name = !display_name; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (ask_before_quit_mode < 0) { |
|
|
|
|
getNoteName(tmp_val, configuration.drums.midinote[active_sample]); |
|
|
|
|
strlcpy(tmp_name, drum_config[active_sample].name, sizeof(drum_config[active_sample].name)); |
|
|
|
|
display.show(1, 1, 8, tmp_name); |
|
|
|
@ -4516,10 +4546,11 @@ void UI_func_drum_midi_note(uint8_t param) { |
|
|
|
|
|
|
|
|
|
_check_display_name(display_name, 3); |
|
|
|
|
if (!display_name) |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_NOTE; |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_DRUM_NOTE; |
|
|
|
|
else |
|
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_ON; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
|