From 054758b42647a37999b0d2e3f8f493af00bff293 Mon Sep 17 00:00:00 2001 From: positionhigh Date: Fri, 30 Jul 2021 16:01:32 +0200 Subject: [PATCH 1/4] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MicroDexed.ino | 59 +---------------------------- UI.hpp | 64 +++++++++++++++++++------------ sequencer.cpp | 101 +++++++++++++++++++++++++++++++++++++++++++++++++ sequencer.h | 17 +++++++++ 4 files changed, 159 insertions(+), 82 deletions(-) create mode 100644 sequencer.cpp create mode 100644 sequencer.h diff --git a/MicroDexed.ino b/MicroDexed.ino index e103a6e..b77fb0d 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -283,7 +283,6 @@ int16_t _midi_bpm = -1; elapsedMillis midi_bpm_timer; elapsedMillis long_button_pressed; elapsedMillis control_rate; -elapsedMillis sequencer_timer; uint8_t active_voices[NUM_DEXED]; uint8_t midi_voices[NUM_DEXED]; #ifdef SHOW_CPU_LOAD_MSEC @@ -304,17 +303,6 @@ char g_voice_name[NUM_DEXED][VOICE_NAME_LEN]; char g_bank_name[NUM_DEXED][BANK_NAME_LEN]; char receive_bank_filename[FILENAME_LEN]; uint8_t selected_instance_id = 0; -uint8_t seqsteptimer = 0; -uint32_t seqtimer_old = 0; -bool seq_running = false; -bool seq_recording = false; -uint8_t seq_note_in; -//uint8_t seqdata[1][16]={48,48,54,48,49,54,54,48,54,54,48,54,49,54,54,54}; -//uint8_t seqdata[1][16]={72,72,78,72,75,78,78,72,78,78,72,78,75,78,78,78}; -uint8_t seqdata[3][16] = {72, 72, 0, 72, 75, 0, 0, 72, 0, 0, 72, 0, 75, 0, 0, 0, - 73, 73, 0, 73, 0, 0, 73, 73, 0, 0, 73, 73, 0, 0, 0, 0, - 78, 0, 0, 78, 0, 0, 78, 0, 78, 78, 0, 0, 0, 0, 0, 0 - }; #ifdef TEENSY4 #if NUM_DEXED>1 int8_t midi_decay[NUM_DEXED] = { -1, -1}; @@ -340,6 +328,7 @@ int16_t delayline[NUM_DEXED][MOD_DELAY_SAMPLE_BUFFER]; extern uint8_t drum_counter; extern uint8_t drum_type[NUM_DRUMS]; extern drum_config_t drum_config[NUM_DRUMCONFIG]; +extern void sequencer(void); #endif #ifdef ENABLE_LCD_UI @@ -628,51 +617,7 @@ void loop() ENCODER[ENC_R].update(); if (seq_running) { - - if (sequencer_timer > seqtimer_old + 125) - - { - seqtimer_old = sequencer_timer; - - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) { - - - //write to sequencer if in sequencer menu (step recording and live recording) - if (seq_note_in > 0 && seq_recording == true) { - seqdata[active_seq_track][seqsteptimer] = seq_note_in; - seq_note_in = 0; - } - lcd.setCursor(seqsteptimer, 1); - lcd.print("X"); - if (seqsteptimer == 0) { - lcd.setCursor(15, 1); - lcd.print(seq_find_shortname(15)); - } - else - { - lcd.setCursor(seqsteptimer - 1, 1); - lcd.print(seq_find_shortname(seqsteptimer - 1)); - } - } - if (seqdata[0][seqsteptimer] > 0) - { - handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[0][seqsteptimer] , 99); - } - if (seqdata[1][seqsteptimer] > 0) - { - handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[1][seqsteptimer] , 99); - } - if (seqdata[2][seqsteptimer] > 0) - { - handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[2][seqsteptimer] , 99); - } - seqsteptimer++; - - if (seqsteptimer > 15) { - seqsteptimer = 0; - } - - } + sequencer(); } #ifdef ENABLE_LCD_UI LCDML.loop(); diff --git a/UI.hpp b/UI.hpp index 42ee64e..0426ce0 100644 --- a/UI.hpp +++ b/UI.hpp @@ -28,6 +28,7 @@ #include "config.h" #include "disp_plus.h" + #include "effect_modulated_delay.h" #include "effect_stereo_mono.h" #ifdef USE_PLATEREVERB @@ -63,12 +64,16 @@ extern void eeprom_update_dexed(uint8_t instance_id); extern float pseudo_log_curve(float value); extern uint8_t selected_instance_id; extern char receive_bank_filename[FILENAME_LEN]; -extern uint8_t seqdata[3][16]; -extern uint8_t seqsteptimer; +extern uint8_t seq_data[4][16]; +extern uint8_t seq_step_timer; extern bool seq_running; extern bool seq_recording; uint8_t seq_active_function = 99; uint8_t activesample; +extern uint8_t seq_active_track; +extern elapsedMillis seq_millis_timer; +extern uint8_t seq_menu; +extern bool seq_button_r; #if NUM_DRUMS > 0 #include "drums.h" #endif @@ -115,6 +120,7 @@ extern int perform_release_mod[NUM_DEXED]; extern float midi_ticks_factor[10]; extern uint8_t midi_bpm; + /*********************************************************************** GLOBAL ************************************************************************/ @@ -124,9 +130,6 @@ const char accepted_chars[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-abcdefghijk uint8_t active_perform_page = 1; uint8_t orig_attack_values[2][7]; uint8_t orig_release_values[2][7]; -uint8_t active_seq_track = 0; -uint8_t seq_menu; -bool seq_button_r = false; #ifdef I2C_DISPLAY #include @@ -3535,21 +3538,28 @@ void UI_handle_OP(uint8_t param) } -const char* seq_find_shortname(uint8_t seqstep) +const char* seq_find_shortname(uint8_t sstep) { const char* shortname = " "; bool found = false; - for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++) - { - if (seqdata[active_seq_track][seqstep] == drum_config[d].midinote) + + if (seq_active_track < 3) { + for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++) { - shortname = drum_config[d].shortname; - found = true; - break; + if (seq_data[seq_active_track][sstep] == drum_config[d].midinote) + { + shortname = drum_config[d].shortname; + found = true; + break; + } } - } - if (found == false) shortname = "-"; + if (found == false) shortname = "-"; + } else + { + if (seq_data[seq_active_track][sstep] > 0) shortname = "*"; else shortname = "-"; + + } return shortname; } @@ -3557,7 +3567,7 @@ const char* seq_find_shortname(uint8_t seqstep) void UI_func_sequencer(uint8_t param) { - char displayname[9]; + char displayname[7]; if (LCDML.FUNC_setup()) // ****** SETUP ********* { @@ -3582,8 +3592,7 @@ void UI_func_sequencer(uint8_t param) lcd.print("STP"); } lcd.setCursor(14, 0); - lcd.print(active_seq_track + 1); - lcd.setCursor(10, 0); + lcd.print(seq_active_track + 1); for (int i = 0; i < 16; i++) { lcd.setCursor(i, 1); lcd.print(seq_find_shortname(i) ); @@ -3612,9 +3621,9 @@ void UI_func_sequencer(uint8_t param) if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) - active_seq_track = constrain(active_seq_track + 1, 0, 2); + seq_active_track = constrain(seq_active_track + 1, 0, 3); else if (LCDML.BT_checkUp()) - active_seq_track = constrain(active_seq_track - 1, 0, 2); + seq_active_track = constrain(seq_active_track - 1, 0, 3); } } if (seq_button_r) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -3626,16 +3635,16 @@ void UI_func_sequencer(uint8_t param) } else if ( seq_menu == 0 && seq_active_function == 0) { if (activesample == NUM_DRUMCONFIG + 2) { - memset(seqdata[0], 0, sizeof(seqdata[0])); - memset(seqdata[1], 0, sizeof(seqdata[1])); - memset(seqdata[2], 0, sizeof(seqdata[2])); + memset(seq_data[0], 0, sizeof(seq_data[0])); + memset(seq_data[1], 0, sizeof(seq_data[1])); + memset(seq_data[2], 0, sizeof(seq_data[2])); for (int i = 0; i < 16; i++) { lcd.setCursor(i, 1); lcd.print(seq_find_shortname(i) ); } } else if (activesample == NUM_DRUMCONFIG + 1) { - memset(seqdata[active_seq_track], 0, sizeof(seqdata[active_seq_track])); + memset(seq_data[seq_active_track], 0, sizeof(seq_data[seq_active_track])); for (int i = 0; i < 16; i++) { lcd.setCursor(i, 1); lcd.print(seq_find_shortname(i) ); @@ -3665,6 +3674,7 @@ void UI_func_sequencer(uint8_t param) seq_recording = false; seq_note_in = 0; lcd.print("PLY"); + MicroDexed[0]->panic(); } } else if ( seq_menu == 2) @@ -3673,7 +3683,7 @@ void UI_func_sequencer(uint8_t param) } else if (seq_menu > 2) { if (seq_active_function == 99) { - seqdata[active_seq_track][seq_menu - 3] = drum_config[activesample].midinote; + seq_data[seq_active_track][seq_menu - 3] = drum_config[activesample].midinote; } else seq_active_function = 99; @@ -3741,7 +3751,7 @@ void UI_func_sequencer(uint8_t param) lcd.setCursor(13, 0); lcd.print("["); lcd.setCursor(14, 0); - lcd.print(active_seq_track + 1); + lcd.print(seq_active_track + 1); lcd.setCursor(15, 0); lcd.print("]"); lcd.setCursor(0, 1); @@ -3773,6 +3783,10 @@ void UI_func_sequencer(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); + seq_running = false; + seq_recording = false; + seq_note_in = 0; + MicroDexed[0]->panic(); } } diff --git a/sequencer.cpp b/sequencer.cpp new file mode 100644 index 0000000..a0dbfd8 --- /dev/null +++ b/sequencer.cpp @@ -0,0 +1,101 @@ + +#include "config.h" +#include "sequencer.h" +#include +#include + +extern LCDMenuLib2 LCDML; +extern LiquidCrystal_I2C lcd; +extern config_t configuration; +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); + +void sequencer() +{ + bool seq_noteoffsent = false; + + if (seq_note_in > 0 && seq_recording == false && seq_active_track == 3 && seq_note_in < 71) { + handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 0); + handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer - 1] + seq_transpose , 0); + + seq_transpose = seq_note_in - 6 * 12 + 3; + seq_note_in = 0; + } + + if (seq_millis_timer > seq_timer_previous + 136) + + { + seq_timer_previous = seq_millis_timer; + + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) { + + //write to sequencer if in sequencer menu (step recording and live recording) + if (seq_note_in > 0 && seq_recording == true) { + + if (seq_active_track == 3) handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 0); + + seq_data[seq_active_track][seq_step_timer] = seq_note_in; + seq_note_in = 0; + } + lcd.setCursor(seq_step_timer, 1); + lcd.print("X"); + if (seq_step_timer == 0) { + lcd.setCursor(15, 1); + lcd.print(seq_find_shortname(15)); + } + else + { + lcd.setCursor(seq_step_timer - 1, 1); + lcd.print(seq_find_shortname(seq_step_timer - 1)); + } + } + if (seq_data[0][seq_step_timer] > 0) + { + handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[0][seq_step_timer] , 99); + } + if (seq_data[1][seq_step_timer] > 0) + { + handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[1][seq_step_timer] , 99); + } + if (seq_data[2][seq_step_timer] > 0) + { + handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[2][seq_step_timer] , 99); + } + if (seq_data[3][seq_step_timer] > 0) //test instrument sequencer Instance=2 + { + handleNoteOn(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 99); + } + + seq_noteoffsent = false; + seq_step_timer++; + + if (seq_step_timer > 15) { + seq_step_timer = 0; + } + + } + + if (seq_millis_timer > seq_timer_previous + 80 && seq_noteoffsent == false) + + { + if (seq_step_timer > 0) { + if (seq_data[3][seq_step_timer - 1] > 0) //test instrument sequencer Instance=2 + { + handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer - 1] + seq_transpose , 0); + } + } else + { + if (seq_step_timer == 0) { + if (seq_data[3][15] > 0) //test instrument sequencer Instance=2 + { + handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][15] + seq_transpose , 0); + ; + } + + } + } + seq_noteoffsent = true; + } +} diff --git a/sequencer.h b/sequencer.h new file mode 100644 index 0000000..4a2bab3 --- /dev/null +++ b/sequencer.h @@ -0,0 +1,17 @@ + +uint8_t seq_active_track = 0; +uint8_t seq_menu; +bool seq_button_r = false; +bool seq_noteoffsent = false; +elapsedMillis seq_millis_timer; +uint8_t seq_step_timer = 0; +uint32_t seq_timer_previous = 0; +bool seq_running = false; +bool seq_recording = false; +uint8_t seq_note_in; +int seq_transpose; +uint8_t seq_data[4][16] = {72, 0, 0, 0, 72, 0, 0, 0, 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, + }; From 362cec9db31fe77b2245c14f0d68841500c58db2 Mon Sep 17 00:00:00 2001 From: positionhigh Date: Sat, 31 Jul 2021 17:26:36 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added Velocity Input+Output to Sequencer --- UI.hpp | 17 +++++++++++++++++ drums.h | 2 +- midi_devices.hpp | 3 +++ sequencer.cpp | 35 +++++++++++++++++++---------------- sequencer.h | 15 ++++++++++++++- 5 files changed, 54 insertions(+), 18 deletions(-) diff --git a/UI.hpp b/UI.hpp index 0426ce0..2c7ccd7 100644 --- a/UI.hpp +++ b/UI.hpp @@ -74,6 +74,7 @@ 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_reverb[4][16]; #if NUM_DRUMS > 0 #include "drums.h" #endif @@ -3563,6 +3564,21 @@ const char* seq_find_shortname(uint8_t sstep) return shortname; } +// 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++) +// { +// if (seq_data[track][seq_step_timer] == drum_config[d].midinote) +// { +// drum_config[d].reverb_send = float(seq_reverb[track][seq_step_timer]) / float(100); +// break; +// } +// } +// } +//} void UI_func_sequencer(uint8_t param) { @@ -3638,6 +3654,7 @@ void UI_func_sequencer(uint8_t param) memset(seq_data[0], 0, sizeof(seq_data[0])); memset(seq_data[1], 0, sizeof(seq_data[1])); memset(seq_data[2], 0, sizeof(seq_data[2])); + memset(seq_data[3], 0, sizeof(seq_data[3])); for (int i = 0; i < 16; i++) { lcd.setCursor(i, 1); lcd.print(seq_find_shortname(i) ); diff --git a/drums.h b/drums.h index 0fb91cc..4f9c8ea 100644 --- a/drums.h +++ b/drums.h @@ -164,7 +164,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { 1.0, 0.9, 0.0, - 0.4 + 0.1 }, { DRUM_SNARE, diff --git a/midi_devices.hpp b/midi_devices.hpp index e2f2928..07b0c4f 100644 --- a/midi_devices.hpp +++ b/midi_devices.hpp @@ -28,6 +28,7 @@ extern config_t configuration; extern uint8_t seq_note_in; +extern uint8_t seq_note_in_velocity; /* #if defined(MIDI_DEVICE_USB) #include #endif */ @@ -84,6 +85,7 @@ void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity { handleNoteOn(inChannel, inNumber, inVelocity); seq_note_in=inNumber; + seq_note_in_velocity=inVelocity; #ifdef DEBUG Serial.print(F("[MIDI_DIN] NoteOn")); #endif @@ -584,6 +586,7 @@ void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVel { handleNoteOn(inChannel, inNumber, inVelocity); seq_note_in=inNumber; + seq_note_in_velocity=inVelocity; #ifdef DEBUG Serial.print(F("[MIDI_USB_HOST] NoteOn")); #endif diff --git a/sequencer.cpp b/sequencer.cpp index a0dbfd8..87a0ee0 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -11,6 +11,7 @@ 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() { @@ -31,13 +32,15 @@ void sequencer() if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) { - //write to sequencer if in sequencer menu (step recording and live recording) + //write to sequencer if in sequencer menu if (seq_note_in > 0 && seq_recording == true) { if (seq_active_track == 3) handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 0); seq_data[seq_active_track][seq_step_timer] = seq_note_in; + seq_vel[seq_active_track][seq_step_timer] = seq_note_in_velocity; seq_note_in = 0; + seq_note_in_velocity=0; } lcd.setCursor(seq_step_timer, 1); lcd.print("X"); @@ -51,21 +54,21 @@ void sequencer() lcd.print(seq_find_shortname(seq_step_timer - 1)); } } - if (seq_data[0][seq_step_timer] > 0) - { - handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[0][seq_step_timer] , 99); - } - if (seq_data[1][seq_step_timer] > 0) - { - handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[1][seq_step_timer] , 99); - } - if (seq_data[2][seq_step_timer] > 0) + + //loop for drum track 0-2 + + for (uint8_t d = 0; d < 3; d++) { - handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[2][seq_step_timer] , 99); + if (seq_data[d][seq_step_timer] > 0 && seq_vel[d][seq_step_timer] > 0) + { + handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[d][seq_step_timer] , seq_vel[d][seq_step_timer]); + } } - if (seq_data[3][seq_step_timer] > 0) //test instrument sequencer Instance=2 + + // instrument track + if (seq_data[3][seq_step_timer] > 0) //test instrument sequencer Instance=0 { - handleNoteOn(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , 99); + handleNoteOn(configuration.dexed[0].midi_channel, seq_data[3][seq_step_timer] + seq_transpose , seq_vel[3][seq_step_timer]); } seq_noteoffsent = false; @@ -77,18 +80,18 @@ void sequencer() } - if (seq_millis_timer > seq_timer_previous + 80 && seq_noteoffsent == false) + if (seq_millis_timer > seq_timer_previous + 80 && seq_noteoffsent == false) { if (seq_step_timer > 0) { - if (seq_data[3][seq_step_timer - 1] > 0) //test instrument sequencer Instance=2 + if (seq_data[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); } } else { if (seq_step_timer == 0) { - if (seq_data[3][15] > 0) //test instrument sequencer Instance=2 + if (seq_data[3][15] > 0) //test instrument sequencer Instance=0 { handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][15] + seq_transpose , 0); ; diff --git a/sequencer.h b/sequencer.h index 4a2bab3..5d3c4ed 100644 --- a/sequencer.h +++ b/sequencer.h @@ -9,9 +9,22 @@ uint32_t seq_timer_previous = 0; bool seq_running = false; 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, 0, 72, 0, 0, 0, 72, 0, 0, 0, +uint8_t seq_data[4][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, + }; +uint8_t seq_vel[4][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, + }; + +//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 +//}; From 4c2659b64a665d8cda4bb290cd1b79b720383d42 Mon Sep 17 00:00:00 2001 From: positionhigh Date: Sat, 31 Jul 2021 17:30:22 +0200 Subject: [PATCH 3/4] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/UI.hpp b/UI.hpp index 2c7ccd7..b4f6a7b 100644 --- a/UI.hpp +++ b/UI.hpp @@ -74,12 +74,10 @@ 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_reverb[4][16]; #if NUM_DRUMS > 0 #include "drums.h" #endif - #ifdef DISPLAY_LCD_SPI extern void change_disp_sd(bool d); #endif From 7605dde2e70e4c2cd0ab58d678ae135f38edfbda Mon Sep 17 00:00:00 2001 From: positionhigh Date: Sun, 1 Aug 2021 21:25:40 +0200 Subject: [PATCH 4/4] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E?= =?UTF-8?q?=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 + };