From 9c263f106a281cfee98e558a60c39d6d9a831e47 Mon Sep 17 00:00:00 2001 From: positionhigh Date: Mon, 2 Aug 2021 20:31:14 +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 | 20 ++++++++++---------- sequencer.cpp | 38 ++++++++++++++++---------------------- sequencer.h | 39 +++++++++++++++++++++------------------ 3 files changed, 47 insertions(+), 50 deletions(-) diff --git a/UI.hpp b/UI.hpp index f3e43e3..6b6a4dd 100644 --- a/UI.hpp +++ b/UI.hpp @@ -77,7 +77,8 @@ 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; +extern uint8_t seq_chain_active_chainstep; //for editor +extern uint8_t seq_chain_active_step; #if NUM_DRUMS > 0 #include "drums.h" #endif @@ -3550,7 +3551,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_patternchain[0][seq_active_track] ][sstep] == drum_config[d].midinote) + if (seq_data[ seq_patternchain[seq_chain_active_step][seq_active_track] ][sstep] == drum_config[d].midinote) { shortname = drum_config[d].shortname; found = true; @@ -3561,7 +3562,7 @@ const char* seq_find_shortname(uint8_t sstep) } else { - if (seq_data[seq_active_track][sstep] > 0) shortname = "*"; else shortname = "-"; + if (seq_data[ seq_patternchain[seq_chain_active_step][seq_active_track] ][sstep] > 0) shortname = "*"; else shortname = "-"; } return shortname; @@ -3586,7 +3587,7 @@ const char* seq_find_shortname(uint8_t sstep) void UI_func_sequencer(uint8_t param) { - char displayname[7]; + char displayname[7]={0,0,0,0,0,0}; if (LCDML.FUNC_setup()) // ****** SETUP ********* { @@ -3640,9 +3641,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()) - seq_active_track = constrain(seq_active_track + 1, 0, 3); + seq_active_track = constrain(seq_active_track + 1, 0, 8); else if (LCDML.BT_checkUp()) - seq_active_track = constrain(seq_active_track - 1, 0, 3); + seq_active_track = constrain(seq_active_track - 1, 0, 8); } } if (seq_button_r) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -3654,10 +3655,9 @@ void UI_func_sequencer(uint8_t param) } else if ( seq_menu == 0 && seq_active_function == 0) { if (activesample == NUM_DRUMCONFIG + 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])); - memset(seq_data[3], 0, sizeof(seq_data[3])); + for (int i = 0; i < 10; i++) { + memset(seq_data[i], 0, sizeof(seq_data[i])); + } for (int i = 0; i < 16; i++) { lcd.setCursor(i, 1); lcd.print(seq_find_shortname(i) ); diff --git a/sequencer.cpp b/sequencer.cpp index b1adb9d..871c3ca 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -58,16 +58,17 @@ void sequencer() for (uint8_t d = 0; d < 3; d++) { - if (seq_data[ seq_patternchain[0][d] ][seq_step_timer] > 0 && seq_vel[ seq_patternchain[0][d] ][seq_step_timer] > 0) + if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step_timer] > 0 && seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step_timer] > 0) { - handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[ seq_patternchain[0][d] ][seq_step_timer] , seq_vel[ seq_patternchain[0][d] ][seq_step_timer]); + handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step_timer] , seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step_timer]); } } // instrument track - if (seq_data[ seq_patternchain[0][3] ][seq_step_timer] > 0) //test instrument sequencer Instance=0 + if (seq_data[ seq_patternchain[seq_chain_active_step][3] ][seq_step_timer] > 0) //test instrument sequencer Instance=0 { - 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]); + handleNoteOn(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][3] ][seq_step_timer] + seq_transpose , seq_vel[ seq_patternchain[seq_chain_active_step][3] ][seq_step_timer]); + seq_prev_note=seq_data[ seq_patternchain[seq_chain_active_step][3] ][seq_step_timer] + seq_transpose; } seq_noteoffsent = false; @@ -75,29 +76,22 @@ void sequencer() if (seq_step_timer > 15) { seq_step_timer = 0; - } - + if (seq_chain_lenght>0){ + seq_chain_active_step++; + if (seq_chain_active_step>seq_chain_lenght) + { + seq_chain_active_step=0; + } + } + } } if (seq_millis_timer > seq_timer_previous + 80 && seq_noteoffsent == false) - { - if (seq_step_timer > 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[ seq_patternchain[0][3] ][seq_step_timer - 1] + seq_transpose , 0); - } - } else - { - if (seq_step_timer == 0) { - if (seq_data[ seq_patternchain[0][3] ][15] > 0) //test instrument sequencer Instance=0 + if ( seq_prev_note > 0) //test instrument sequencer Instance=0 { - handleNoteOff(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[0][3] ][15] + seq_transpose , 0); - ; - } - - } - } + handleNoteOff(configuration.dexed[0].midi_channel, seq_prev_note , 0); + } seq_noteoffsent = true; } } diff --git a/sequencer.h b/sequencer.h index 3423fcf..202c136 100644 --- a/sequencer.h +++ b/sequencer.h @@ -14,27 +14,30 @@ int seq_transpose; 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, +uint8_t seq_chain_lenght=3; // 0=16 steps, 1=32 Steps, 2=46 Steps, 3=64 Steps +uint8_t seq_chain_active_step=0; +uint8_t seq_prev_note; +uint8_t seq_data[10][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 + 41, 41+12, 53, 53, 41+12, 41, 53, 53, 41, 41+12, 53, 53, 41, 41, 53, 53, + 43+12, 43, 55, 55, 43, 43, 55+12, 55, 43, 43, 55, 55, 43, 43, 55, 55, + 45, 45, 57, 57, 45, 45, 57, 57, 45, 45, 57, 57, 45, 45, 57, 57, + 72, 72, 72, 72, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 0, + 50, 50, 0, 0, 75, 0, 0, 50, 50, 50, 50, 50, 75, 75, 75, 75, + 72, 0, 0, 0, 72, 0, 0, 72, 72, 0, 0, 0, 72, 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, +uint8_t seq_vel[10][16] = {80, 0, 0, 0, 80, 0, 0, 33, 80, 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 + 55, 45, 87, 27, 2, 6, 5, 37, 7, 45, 33, 37, 5, 35, 2, 27, + 55, 45, 77, 27, 12, 6, 15, 37, 7, 45, 43, 27, 15, 35, 2, 17, + 55, 75, 87, 27, 2, 16, 5, 37, 7, 45, 33, 37, 5, 35, 2, 27, + 65, 75, 87, 27, 2, 16, 5, 37, 7, 45, 33, 37, 5, 35, 2, 27, + 44,55,66,55,80,90,90,77,80,90,90,90,80,128,128,128, + 55,33,128,55,55,128,11,11,22,33,44,55,55,44,33,22, + 80, 0, 0, 0, 80, 0, 0, 33, 80, 0, 0, 0, 80, 0, 0, 0 }; //uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -44,7 +47,7 @@ uint8_t seq_vel[9][16] = {128, 0, 0, 0, 108, 0, 0, 33, 117, 0, 0, 0, 109, 0, // }; uint8_t seq_patternchain[4][4] = { 0, 1, 2, 3, - 0, 4, 2, 5, - 0, 1, 2, 7, - 0, 1, 3, 6 + 0, 1, 2, 6, + 0, 1, 2, 4, + 7, 8, 2, 5 };