Merge pull request 'Dateien hochladen nach „“' (#57) from positionhigh/MicroDexed:dev into dev

Reviewed-on: https://codeberg.org/dcoredump/MicroDexed/pulls/57
pull/58/head
Holger Wirtz 3 years ago
commit 7bc8a7f2b8
  1. 20
      UI.hpp
  2. 34
      sequencer.cpp
  3. 39
      sequencer.h

@ -77,7 +77,8 @@ extern uint8_t seq_menu;
extern bool seq_button_r; extern bool seq_button_r;
extern uint8_t seq_chain_select_menu; extern uint8_t seq_chain_select_menu;
extern uint8_t seq_chain_active_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 #if NUM_DRUMS > 0
#include "drums.h" #include "drums.h"
#endif #endif
@ -3550,7 +3551,7 @@ const char* seq_find_shortname(uint8_t sstep)
if (seq_active_track < 3) { if (seq_active_track < 3) {
for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++) 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; shortname = drum_config[d].shortname;
found = true; found = true;
@ -3561,7 +3562,7 @@ const char* seq_find_shortname(uint8_t sstep)
} else } 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; return shortname;
@ -3586,7 +3587,7 @@ const char* seq_find_shortname(uint8_t sstep)
void UI_func_sequencer(uint8_t param) void UI_func_sequencer(uint8_t param)
{ {
char displayname[7]; char displayname[7]={0,0,0,0,0,0};
if (LCDML.FUNC_setup()) // ****** SETUP ********* 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() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{ {
if (LCDML.BT_checkDown()) 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()) 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 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 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) } else if ( seq_menu == 0 && seq_active_function == 0)
{ {
if (activesample == NUM_DRUMCONFIG + 2) { if (activesample == NUM_DRUMCONFIG + 2) {
memset(seq_data[0], 0, sizeof(seq_data[0])); for (int i = 0; i < 10; i++) {
memset(seq_data[1], 0, sizeof(seq_data[1])); memset(seq_data[i], 0, sizeof(seq_data[i]));
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++) { for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1); lcd.setCursor(i, 1);
lcd.print(seq_find_shortname(i) ); lcd.print(seq_find_shortname(i) );

@ -58,16 +58,17 @@ void sequencer()
for (uint8_t d = 0; d < 3; d++) 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 // 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; seq_noteoffsent = false;
@ -75,28 +76,21 @@ void sequencer()
if (seq_step_timer > 15) { if (seq_step_timer > 15) {
seq_step_timer = 0; 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_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); if ( seq_prev_note > 0) //test instrument sequencer Instance=0
}
} else
{
if (seq_step_timer == 0) {
if (seq_data[ seq_patternchain[0][3] ][15] > 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; seq_noteoffsent = true;
} }

@ -14,27 +14,30 @@ int seq_transpose;
uint8_t seq_chain_select_menu; uint8_t seq_chain_select_menu;
uint8_t seq_chain_active_menu = 99; uint8_t seq_chain_active_menu = 99;
uint8_t seq_chain_active_chainstep; 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_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_data[9][16] = {72, 0, 0, 0, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 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, 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, 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, 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, 41, 41+12, 53, 53, 41+12, 41, 53, 53, 41, 41+12, 53, 53, 41, 41, 53, 53,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43+12, 43, 55, 55, 43, 43, 55+12, 55, 43, 43, 55, 55, 43, 43, 55, 55,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 72, 72, 72, 72, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 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, 55, 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, 55, 45, 77, 27, 12, 6, 15, 37, 7, 45, 43, 27, 15, 35, 2, 17,
128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 55, 75, 87, 27, 2, 16, 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, 65, 75, 87, 27, 2, 16, 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, 44,55,66,55,80,90,90,77,80,90,90,90,80,128,128,128,
128,128,128,128,128,128,128,128,128,128,128,128,128,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, //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, uint8_t seq_patternchain[4][4] = { 0, 1, 2, 3,
0, 4, 2, 5, 0, 1, 2, 6,
0, 1, 2, 7, 0, 1, 2, 4,
0, 1, 3, 6 7, 8, 2, 5
}; };

Loading…
Cancel
Save