|
|
@ -139,7 +139,7 @@ extern bool save_sys_flag; |
|
|
|
elapsedMillis back_from_volume; |
|
|
|
elapsedMillis back_from_volume; |
|
|
|
uint8_t instance_num[8][8]; |
|
|
|
uint8_t instance_num[8][8]; |
|
|
|
const char accepted_chars[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-abcdefghijklmnopqrstuvwxyz"; |
|
|
|
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 active_perform_page = 1; |
|
|
|
uint8_t orig_attack_values[2][7]; |
|
|
|
uint8_t orig_attack_values[2][7]; |
|
|
|
uint8_t orig_release_values[2][7]; |
|
|
|
uint8_t orig_release_values[2][7]; |
|
|
@ -746,11 +746,16 @@ void lcdml_menu_control(void) { |
|
|
|
LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); |
|
|
|
LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); |
|
|
|
} else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note) && ask_before_quit == false) { |
|
|
|
} else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note) && ask_before_quit == false) { |
|
|
|
ask_before_quit = true; |
|
|
|
ask_before_quit = true; |
|
|
|
|
|
|
|
Serial.printf("ask_before_quit = %d\n", ask_before_quit); |
|
|
|
encoderDir[ENC_L].reset(); |
|
|
|
encoderDir[ENC_L].reset(); |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
LCDML.OTHER_updateFunc(); |
|
|
|
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(); |
|
|
|
LCDML.BT_quit(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -3860,10 +3865,10 @@ void _check_yes_no_back(uint8_t state) { |
|
|
|
if (state == 0) { // BACK
|
|
|
|
if (state == 0) { // BACK
|
|
|
|
display.setCursor(0, 1); |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(3, 1); |
|
|
|
|
|
|
|
display.print(F(" ")); |
|
|
|
|
|
|
|
display.setCursor(4, 1); |
|
|
|
display.setCursor(4, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
|
|
|
|
display.setCursor(5, 1); |
|
|
|
|
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(8, 1); |
|
|
|
display.setCursor(8, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(9, 1); |
|
|
|
display.setCursor(9, 1); |
|
|
@ -3873,9 +3878,9 @@ void _check_yes_no_back(uint8_t state) { |
|
|
|
} else if (state == 1) { // NO
|
|
|
|
} else if (state == 1) { // NO
|
|
|
|
display.setCursor(0, 1); |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.print(F("[")); |
|
|
|
display.print(F("[")); |
|
|
|
display.setCursor(3, 1); |
|
|
|
|
|
|
|
display.print(F("]")); |
|
|
|
|
|
|
|
display.setCursor(4, 1); |
|
|
|
display.setCursor(4, 1); |
|
|
|
|
|
|
|
display.print(F("]")); |
|
|
|
|
|
|
|
display.setCursor(5, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(8, 1); |
|
|
|
display.setCursor(8, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
@ -3886,9 +3891,9 @@ void _check_yes_no_back(uint8_t state) { |
|
|
|
} else { // YES
|
|
|
|
} else { // YES
|
|
|
|
display.setCursor(0, 1); |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(3, 1); |
|
|
|
|
|
|
|
display.print(F(" ")); |
|
|
|
|
|
|
|
display.setCursor(4, 1); |
|
|
|
display.setCursor(4, 1); |
|
|
|
|
|
|
|
display.print(F(" ")); |
|
|
|
|
|
|
|
display.setCursor(5, 1); |
|
|
|
display.print(F("[")); |
|
|
|
display.print(F("[")); |
|
|
|
display.setCursor(8, 1); |
|
|
|
display.setCursor(8, 1); |
|
|
|
display.print(F("]")); |
|
|
|
display.print(F("]")); |
|
|
@ -3904,7 +3909,7 @@ void _check_display_name(bool display_name, uint8_t digits) { |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.print(F("[")); |
|
|
|
display.print(F("[")); |
|
|
|
display.setCursor(9, 1); |
|
|
|
display.setCursor(9, 1); |
|
|
|
display.print(F("]")); |
|
|
|
display.print(F("] ")); |
|
|
|
display.setCursor(LCD_cols - digits - 2, 1); |
|
|
|
display.setCursor(LCD_cols - digits - 2, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(LCD_cols - 1, 1); |
|
|
|
display.setCursor(LCD_cols - 1, 1); |
|
|
@ -3913,7 +3918,7 @@ void _check_display_name(bool display_name, uint8_t digits) { |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(9, 1); |
|
|
|
display.setCursor(9, 1); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(LCD_cols - digits - 2, 1); |
|
|
|
display.setCursor(LCD_cols - digits - 2, 1); |
|
|
|
display.print(F("[")); |
|
|
|
display.print(F("[")); |
|
|
|
display.setCursor(LCD_cols - 1, 1); |
|
|
|
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]; |
|
|
|
midinote_old[i] = configuration.drums.midinote[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (!display_name) |
|
|
|
if (!display_name) |
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_NOTE; |
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_DRUM_NOTE; |
|
|
|
else |
|
|
|
else |
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_ON; |
|
|
|
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 (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; |
|
|
|
uint8_t num_changes = 0; |
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++) { |
|
|
|
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++) { |
|
|
|
if (midinote_old[i] != configuration.drums.midinote[i]) |
|
|
|
if (midinote_old[i] != configuration.drums.midinote[i]) |
|
|
|
num_changes++; |
|
|
|
num_changes++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (num_changes > 0) { |
|
|
|
if (num_changes > 0) { |
|
|
|
ask_before_quit_mode = 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); |
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ask_before_quit = false; |
|
|
|
ask_before_quit = false; |
|
|
@ -4465,60 +4472,84 @@ void UI_func_drum_midi_note(uint8_t param) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (midi_learn_mode >= DRUMS_MIDI_NOTE_MIN) |
|
|
|
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() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { |
|
|
|
if (LCDML.BT_checkDown()) { |
|
|
|
if (LCDML.BT_checkDown()) { |
|
|
|
if (display_name == true) { |
|
|
|
if (ask_before_quit_mode >= 0) { |
|
|
|
if (active_sample < NUM_DRUMSET_CONFIG - 2) |
|
|
|
|
|
|
|
active_sample++; |
|
|
|
|
|
|
|
} else if (ask_before_quit_mode >= 0) { |
|
|
|
|
|
|
|
++ask_before_quit_mode %= 3; |
|
|
|
++ask_before_quit_mode %= 3; |
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
|
|
|
|
LCDML.OTHER_updateFunc(); |
|
|
|
|
|
|
|
LCDML.loop_menu(); |
|
|
|
} 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); |
|
|
|
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()) { |
|
|
|
} else if (LCDML.BT_checkUp()) { |
|
|
|
if (display_name == true) { |
|
|
|
if (ask_before_quit_mode >= 0) { |
|
|
|
if (active_sample > 0) |
|
|
|
if (ask_before_quit_mode > 0) |
|
|
|
active_sample--; |
|
|
|
ask_before_quit_mode--; |
|
|
|
} else if (ask_before_quit_mode >= 0) { |
|
|
|
else |
|
|
|
--ask_before_quit_mode %= 3; |
|
|
|
ask_before_quit_mode = 2; |
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
_check_yes_no_back(ask_before_quit_mode); |
|
|
|
|
|
|
|
LCDML.OTHER_updateFunc(); |
|
|
|
|
|
|
|
LCDML.loop_menu(); |
|
|
|
} 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); |
|
|
|
if (display_name == true) { |
|
|
|
|
|
|
|
if (active_sample > 0) |
|
|
|
|
|
|
|
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_checkEnter()) { |
|
|
|
} else if (LCDML.BT_checkEnter()) { |
|
|
|
if (ask_before_quit_mode >= 0) { |
|
|
|
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; |
|
|
|
ask_before_quit = false; |
|
|
|
|
|
|
|
display.show(1, 0, 16, "Canceled."); |
|
|
|
|
|
|
|
delay(MESSAGE_WAIT_TIME); |
|
|
|
LCDML.FUNC_goBackToMenu(); |
|
|
|
LCDML.FUNC_goBackToMenu(); |
|
|
|
} else if (ask_before_quit_mode == 1) { // YES
|
|
|
|
} else if (ask_before_quit_mode == 1) { // YES
|
|
|
|
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++) |
|
|
|
ask_before_quit = false; |
|
|
|
configuration.drums.midinote[i] = midinote_old[i]; |
|
|
|
display.show(1, 0, 16, "Done."); |
|
|
|
} else if (ask_before_quit_mode == 2) { // BACK
|
|
|
|
delay(MESSAGE_WAIT_TIME); |
|
|
|
|
|
|
|
LCDML.FUNC_goBackToMenu(); |
|
|
|
|
|
|
|
} else if (ask_before_quit_mode == 0) { // BACK
|
|
|
|
ask_before_quit_mode = -1; |
|
|
|
ask_before_quit_mode = -1; |
|
|
|
ask_before_quit = false; |
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getNoteName(tmp_val, configuration.drums.midinote[active_sample]); |
|
|
|
if (ask_before_quit_mode < 0) { |
|
|
|
strlcpy(tmp_name, drum_config[active_sample].name, sizeof(drum_config[active_sample].name)); |
|
|
|
getNoteName(tmp_val, configuration.drums.midinote[active_sample]); |
|
|
|
display.show(1, 1, 8, tmp_name); |
|
|
|
strlcpy(tmp_name, drum_config[active_sample].name, sizeof(drum_config[active_sample].name)); |
|
|
|
display.show(1, LCD_cols - strlen(tmp_val) - 1, strlen(tmp_val), tmp_val); |
|
|
|
display.show(1, 1, 8, tmp_name); |
|
|
|
|
|
|
|
display.show(1, LCD_cols - strlen(tmp_val) - 1, strlen(tmp_val), tmp_val); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.printf("Drum midinote for active_sample=%d [%s]=%d (%s)\n", active_sample, drum_config[active_sample].name, configuration.drums.midinote[active_sample], tmp_val); |
|
|
|
Serial.printf("Drum midinote for active_sample=%d [%s]=%d (%s)\n", active_sample, drum_config[active_sample].name, configuration.drums.midinote[active_sample], tmp_val); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
_check_display_name(display_name, 3); |
|
|
|
_check_display_name(display_name, 3); |
|
|
|
if (!display_name) |
|
|
|
if (!display_name) |
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_NOTE; |
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_DRUM_NOTE; |
|
|
|
else |
|
|
|
else |
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_ON; |
|
|
|
midi_learn_mode = MIDI_LEARN_MODE_ON; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|