From 7605dde2e70e4c2cd0ab58d678ae135f38edfbda Mon Sep 17 00:00:00 2001 From: positionhigh Date: Sun, 1 Aug 2021 21:25:40 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI.hpp | 198 ++++++++++++++++++++++++++++++++++++++++++++++++-- UI_FX.h | 17 +++-- UI_FX_T4.h | 17 +++-- sequencer.cpp | 17 ++--- sequencer.h | 28 ++++++- 5 files changed, 243 insertions(+), 34 deletions(-) diff --git a/UI.hpp b/UI.hpp index b4f6a7b..f3e43e3 100644 --- a/UI.hpp +++ b/UI.hpp @@ -65,6 +65,7 @@ extern float pseudo_log_curve(float value); extern uint8_t selected_instance_id; extern char receive_bank_filename[FILENAME_LEN]; extern uint8_t seq_data[4][16]; +extern uint8_t seq_patternchain[4][4]; extern uint8_t seq_step_timer; extern bool seq_running; extern bool seq_recording; @@ -74,6 +75,9 @@ extern uint8_t seq_active_track; extern elapsedMillis seq_millis_timer; extern uint8_t seq_menu; extern bool seq_button_r; +extern uint8_t seq_chain_select_menu; +extern uint8_t seq_chain_active_menu; +extern uint8_t seq_chain_active_chainstep; #if NUM_DRUMS > 0 #include "drums.h" #endif @@ -250,6 +254,7 @@ void UI_func_portamento_time(uint8_t param); void UI_handle_OP(uint8_t param); void UI_func_information(uint8_t param); void UI_func_sequencer(uint8_t param); +void UI_func_seq_pat_chain(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); @@ -3545,7 +3550,7 @@ const char* seq_find_shortname(uint8_t sstep) if (seq_active_track < 3) { for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++) { - if (seq_data[seq_active_track][sstep] == drum_config[d].midinote) + if (seq_data[ seq_patternchain[0][seq_active_track] ][sstep] == drum_config[d].midinote) { shortname = drum_config[d].shortname; found = true; @@ -3564,8 +3569,8 @@ const char* seq_find_shortname(uint8_t sstep) // deactivated for now since audio library seems not like to change reverb settings at runtime (and is skipping notes) //void seq_set_rev_for_single_instr_per_step(uint8_t track, uint8_t note) -//{ -// +//{ +// // if (track < 3) { // for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++) // { @@ -3574,8 +3579,8 @@ const char* seq_find_shortname(uint8_t sstep) // drum_config[d].reverb_send = float(seq_reverb[track][seq_step_timer]) / float(100); // break; // } -// } -// } +// } +// } //} void UI_func_sequencer(uint8_t param) @@ -3805,6 +3810,189 @@ void UI_func_sequencer(uint8_t param) } } +void UI_func_seq_pat_chain(uint8_t param) +{ + + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + seq_button_r = false; + + lcd.setCursor( 12, 0); + lcd.print(seq_chain_active_chainstep + 1); + lcd.setCursor( 13, 0); + lcd.print("/4"); + + lcd.setCursor(0 , 0); + lcd.print("D"); + lcd.setCursor(2 , 0); + lcd.print( seq_patternchain[seq_chain_active_chainstep][0]); + + lcd.setCursor(0 , 1); + lcd.print("D"); + lcd.setCursor(2 , 1); + lcd.print( seq_patternchain[seq_chain_active_chainstep][1]); + + lcd.setCursor(6 , 0); + lcd.print("D"); + lcd.setCursor(8 , 0); + lcd.print( seq_patternchain[seq_chain_active_chainstep][2]); + + lcd.setCursor(6 , 1); + lcd.print("I"); + lcd.setCursor(8 , 1); + lcd.print( seq_patternchain[seq_chain_active_chainstep][3]); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (seq_chain_active_menu == 99) { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + { + if (LCDML.BT_checkDown()) + seq_chain_select_menu = constrain(seq_chain_select_menu + 1, 0, 4); + else if (LCDML.BT_checkUp()) + seq_chain_select_menu = constrain(seq_chain_select_menu - 1, 0, 4); + } + } else if (seq_chain_active_menu == 4) { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + { + if (LCDML.BT_checkDown()) + seq_chain_active_chainstep = constrain(seq_chain_active_chainstep + 1, 0, 3); + else if (LCDML.BT_checkUp()) + seq_chain_active_chainstep = constrain(seq_chain_active_chainstep - 1, 0, 3); + } + } + else if (seq_chain_active_menu < 4) { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + { + if (LCDML.BT_checkDown()) + seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] + 1, 0, 9); + else if (LCDML.BT_checkUp()) + seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] - 1, 0, 9); + } + } + if (seq_chain_select_menu == 0 && seq_chain_active_menu == 99) // Drum 0 + { + lcd.setCursor(1 , 0); + lcd.print("["); + lcd.setCursor(3 , 0); + lcd.print("]"); + lcd.setCursor(1 , 1); + lcd.print(" "); + lcd.setCursor(3 , 1); + lcd.print(" "); + } else if (seq_chain_select_menu == 1 && seq_chain_active_menu == 99) // Drum 1 + { + lcd.setCursor(1 , 0); + lcd.print(" "); + lcd.setCursor(3 , 0); + lcd.print(" "); + lcd.setCursor(7 , 0); + lcd.print(" "); + lcd.setCursor(9 , 0); + lcd.print(" "); + lcd.setCursor(1 , 1); + lcd.print("["); + lcd.setCursor(3 , 1); + lcd.print("]"); + } else if (seq_chain_select_menu == 2 && seq_chain_active_menu == 99) // Drum 2 + { + lcd.setCursor(7 , 0); + lcd.print("["); + lcd.setCursor(9 , 0); + lcd.print("]"); + lcd.setCursor(1 , 1); + lcd.print(" "); + lcd.setCursor(3 , 1); + lcd.print(" "); + lcd.setCursor(7 , 1); + lcd.print(" "); + lcd.setCursor(9 , 1); + lcd.print(" "); + } else if (seq_chain_select_menu == 3 && seq_chain_active_menu == 99) // Inst + { + lcd.setCursor(7 , 0); + lcd.print(" "); + lcd.setCursor(9 , 0); + lcd.print(" "); + lcd.setCursor(7 , 1); + lcd.print("["); + lcd.setCursor(9 , 1); + lcd.print("]"); + lcd.setCursor( 11, 0); + lcd.print(" "); + lcd.setCursor( 15, 0); + lcd.print(" "); + } else if (seq_chain_select_menu == 4 && seq_chain_active_menu == 99) // Chainselect + { + lcd.setCursor(7 , 1); + lcd.print(" "); + lcd.setCursor(9 , 1); + lcd.print(" "); + + lcd.setCursor( 11, 0); + lcd.print("["); + lcd.setCursor( 12, 0); + lcd.print(seq_chain_active_chainstep + 1); + lcd.setCursor( 13, 0); + lcd.print("/4]"); + } else if (seq_chain_select_menu == 4 && seq_chain_active_menu == 4) // Chainselect modify + { + lcd.setCursor( 11, 0); + lcd.print("["); + lcd.setCursor( 12, 0); + lcd.print(seq_chain_active_chainstep + 1); + lcd.setCursor( 13, 0); + lcd.print("/4]"); + + lcd.setCursor(2 , 0); + lcd.print( seq_patternchain[seq_chain_active_chainstep][0]); + + lcd.setCursor(2 , 1); + lcd.print( seq_patternchain[seq_chain_active_chainstep][1]); + + lcd.setCursor(8 , 0); + lcd.print( seq_patternchain[seq_chain_active_chainstep][2]); + + lcd.setCursor(8 , 1); + lcd.print( seq_patternchain[seq_chain_active_chainstep][3]); + } else if (seq_chain_select_menu == 0 && seq_chain_active_menu == 0) // Drum 0 modify + { + lcd.setCursor(2 , 0); + lcd.print( seq_patternchain[seq_chain_active_chainstep][0]); + } else if (seq_chain_select_menu == 1 && seq_chain_active_menu == 1) // Drum 1 modify + { + lcd.setCursor(2 , 1); + lcd.print( seq_patternchain[seq_chain_active_chainstep][1]); + } else if (seq_chain_select_menu == 2 && seq_chain_active_menu == 2) // Drum 2 modify + { + lcd.setCursor(8 , 0); + lcd.print( seq_patternchain[seq_chain_active_chainstep][2]); + } else if (seq_chain_select_menu == 3 && seq_chain_active_menu == 3) // Inst modify + { + lcd.setCursor(8 , 1); + lcd.print( seq_patternchain[seq_chain_active_chainstep][3]); + } + + if (seq_button_r) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + { + seq_button_r = false; + if (seq_chain_active_menu == seq_chain_select_menu) { + seq_chain_active_menu = 99; + } else + { + seq_chain_active_menu = seq_chain_select_menu; + } + } + } + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } +} + + void UI_func_information(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* diff --git a/UI_FX.h b/UI_FX.h index 872384f..f584a8b 100644 --- a/UI_FX.h +++ b/UI_FX.h @@ -110,12 +110,13 @@ LCDML_add(76, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); LCDML_add(77, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); LCDML_add(78, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); LCDML_add(79, LCDML_0, 4, "Sequencer", UI_func_sequencer); -LCDML_add(80, LCDML_0, 5, "System", NULL); -LCDML_add(81, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(82, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(83, LCDML_0_5, 3, "Favorites", UI_func_favorites); -LCDML_add(84, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(85, LCDML_0, 6, "Info", UI_func_information); -LCDML_addAdvanced(86, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 86 +LCDML_add(80, LCDML_0, 5, "Pattern Chain", UI_func_seq_pat_chain); +LCDML_add(81, LCDML_0, 6, "System", NULL); +LCDML_add(82, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(83, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(84, LCDML_0_6, 3, "Favorites", UI_func_favorites); +LCDML_add(85, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(86, LCDML_0, 6, "Info", UI_func_information); +LCDML_addAdvanced(87, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 87 #endif diff --git a/UI_FX_T4.h b/UI_FX_T4.h index 51b4b6d..93de88d 100644 --- a/UI_FX_T4.h +++ b/UI_FX_T4.h @@ -113,12 +113,13 @@ LCDML_add(79, LCDML_0_3_5, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); LCDML_add(80, LCDML_0_3_5, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); LCDML_add(81, LCDML_0_3_5, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); LCDML_add(82, LCDML_0, 4, "Sequencer", UI_func_sequencer); -LCDML_add(83, LCDML_0, 5, "System", NULL); -LCDML_add(84, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(85, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(86, LCDML_0_5, 3, "Favorites", UI_func_favorites); -LCDML_add(87, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset); -LCDML_add(88, LCDML_0, 6, "Info", UI_func_information); -LCDML_addAdvanced(89, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 89 +LCDML_add(83, LCDML_0, 5, "Pattern Chain", UI_func_seq_pat_chain); +LCDML_add(84, LCDML_0, 6, "System", NULL); +LCDML_add(85, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(86, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(87, LCDML_0_6, 3, "Favorites", UI_func_favorites); +LCDML_add(88, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset); +LCDML_add(89, LCDML_0, 7, "Info", UI_func_information); +LCDML_addAdvanced(90, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 90 #endif diff --git a/sequencer.cpp b/sequencer.cpp index 87a0ee0..b1adb9d 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -11,7 +11,6 @@ extern void handleNoteOn(byte , byte , byte ); extern void handleNoteOff(byte , byte , byte ); extern void UI_func_sequencer(uint8_t); extern const char* seq_find_shortname(uint8_t); -extern void seq_set_rev_for_single_instr_per_step(byte, byte); void sequencer() { @@ -59,16 +58,16 @@ void sequencer() for (uint8_t d = 0; d < 3; d++) { - if (seq_data[d][seq_step_timer] > 0 && seq_vel[d][seq_step_timer] > 0) + if (seq_data[ seq_patternchain[0][d] ][seq_step_timer] > 0 && seq_vel[ seq_patternchain[0][d] ][seq_step_timer] > 0) { - handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[d][seq_step_timer] , seq_vel[d][seq_step_timer]); + handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[ seq_patternchain[0][d] ][seq_step_timer] , seq_vel[ seq_patternchain[0][d] ][seq_step_timer]); } } // instrument track - if (seq_data[3][seq_step_timer] > 0) //test instrument sequencer Instance=0 + if (seq_data[ seq_patternchain[0][3] ][seq_step_timer] > 0) //test instrument sequencer Instance=0 { - handleNoteOn(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , seq_vel[3][seq_step_timer]); + handleNoteOn(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[0][3] ][seq_step_timer] + seq_transpose , seq_vel[ seq_patternchain[0][3] ][seq_step_timer]); } seq_noteoffsent = false; @@ -84,16 +83,16 @@ void sequencer() { if (seq_step_timer > 0) { - if (seq_data[3][seq_step_timer - 1] > 0) //test instrument sequencer Instance=0 + if (seq_data[ seq_patternchain[0][3] ][seq_step_timer - 1] > 0) //test instrument sequencer Instance=0 { - handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer - 1] + seq_transpose , 0); + handleNoteOff(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[0][3] ][seq_step_timer - 1] + seq_transpose , 0); } } else { if (seq_step_timer == 0) { - if (seq_data[3][15] > 0) //test instrument sequencer Instance=0 + if (seq_data[ seq_patternchain[0][3] ][15] > 0) //test instrument sequencer Instance=0 { - handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][15] + seq_transpose , 0); + handleNoteOff(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[0][3] ][15] + seq_transpose , 0); ; } diff --git a/sequencer.h b/sequencer.h index 5d3c4ed..3423fcf 100644 --- a/sequencer.h +++ b/sequencer.h @@ -11,20 +11,40 @@ bool seq_recording = false; uint8_t seq_note_in; uint8_t seq_note_in_velocity; int seq_transpose; -uint8_t seq_data[4][16] = {72, 0, 0, 0, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 0, +uint8_t seq_chain_select_menu; +uint8_t seq_chain_active_menu = 99; +uint8_t seq_chain_active_chainstep; +uint8_t seq_lenght=1; // 1=16 steps, 2=32 Steps, 3=46 Steps, 4=64 Steps + +uint8_t seq_data[9][16] = {72, 0, 0, 0, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 45, 45, 57, 57, 45, 45, 57, 57, 45, 45, 57, 57, 45, 45, 57, 57, - + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t seq_vel[4][16] = {128, 0, 0, 0, 108, 0, 0, 33, 117, 0, 0, 0, 109, 0, 0, 0, +uint8_t seq_vel[9][16] = {128, 0, 0, 0, 108, 0, 0, 33, 117, 0, 0, 0, 109, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 78, 58, 88, 48, 78, 38, 78, 78, 68, 48, 68, 48, 88, 48, 78, 48, 85, 45, 87, 27, 2, 6, 5, 37, 7, 45, 33, 37, 5, 35, 2, 27, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128 }; //uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -//}; +// }; + +uint8_t seq_patternchain[4][4] = { 0, 1, 2, 3, + 0, 4, 2, 5, + 0, 1, 2, 7, + 0, 1, 3, 6 + };