pull/58/head
Holger Wirtz 3 years ago
commit 15ab290c49
  1. 23
      UI.hpp
  2. 38
      sequencer.cpp
  3. 39
      sequencer.h

@ -80,7 +80,11 @@ 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
#include "drums.h"
#endif
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
extern void change_disp_sd(bool d); extern void change_disp_sd(bool d);
@ -3549,7 +3553,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;
@ -3560,7 +3564,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;
@ -3585,7 +3589,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 *********
{ {
@ -3639,9 +3643,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 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -3653,10 +3657,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(void)
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,29 +76,22 @@ void sequencer(void)
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_prev_note > 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[ 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
{ {
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