Sequencer Upgrade and new Menu Functions. New Preset Sequencer Pattern "microdexed Theme"

pull/62/head
positionhigh 3 years ago
parent b65a40207f
commit 17d2f2faba
  1. 399
      UI.hpp
  2. 256
      dexed_sd.cpp
  3. 79
      sequencer.cpp
  4. 70
      sequencer.h

399
UI.hpp

@ -64,9 +64,20 @@ extern void eeprom_update_dexed(uint8_t instance_id);
extern float pseudo_log_curve(float value); extern float pseudo_log_curve(float value);
extern uint8_t selected_instance_id; extern uint8_t selected_instance_id;
extern char receive_bank_filename[FILENAME_LEN]; extern char receive_bank_filename[FILENAME_LEN];
extern uint8_t seq_data[4][16];
#if NUM_DRUMS > 0
#include "drums.h"
extern drum_config_t drum_config[DRUM_MAX_INSTRUMENTS + 1];
extern uint8_t num_drums;
extern char drumset_name[26];
extern uint8_t seq_data[10][16];
extern uint8_t seq_vel[10][16];
extern uint8_t seq_patternchain[4][4]; extern uint8_t seq_patternchain[4][4];
extern uint8_t seq_step_timer; extern uint8_t seq_content_type[10];
extern uint8_t seq_track_type[4];
extern uint8_t seq_step;
extern int seq_tempo_ms;
extern uint8_t seq_bpm;
extern uint8_t seq_chain_lenght; extern uint8_t seq_chain_lenght;
extern bool seq_running; extern bool seq_running;
extern bool seq_recording; extern bool seq_recording;
@ -75,16 +86,11 @@ uint8_t activesample;
extern uint8_t seq_active_track; extern uint8_t seq_active_track;
extern elapsedMillis seq_millis_timer; extern elapsedMillis seq_millis_timer;
extern uint8_t seq_menu; extern uint8_t seq_menu;
extern uint8_t seq_chain_select_menu; extern uint8_t seq_temp_select_menu;
extern uint8_t seq_chain_active_menu; extern uint8_t seq_temp_active_menu;
extern uint8_t seq_chain_active_chainstep; //for editor extern uint8_t seq_chain_active_chainstep; //for editor
extern uint8_t seq_chain_active_step; extern uint8_t seq_chain_active_step;
extern int seq_transpose; extern int seq_transpose;
#if NUM_DRUMS > 0
#include "drums.h"
extern drum_config_t drum_config[DRUM_MAX_INSTRUMENTS + 1];
extern uint8_t num_drums;
extern char drumset_name[26];
#endif #endif
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
@ -263,9 +269,12 @@ void UI_func_portamento_time(uint8_t param);
void UI_handle_OP(uint8_t param); void UI_handle_OP(uint8_t param);
void UI_func_information(uint8_t param); void UI_func_information(uint8_t param);
void UI_func_sequencer(uint8_t param); void UI_func_sequencer(uint8_t param);
void UI_func_seq_vel_editor(uint8_t param);
void UI_func_seq_live_transpose_oct(uint8_t param); void UI_func_seq_live_transpose_oct(uint8_t param);
void UI_func_seq_lenght(uint8_t param); void UI_func_seq_lenght(uint8_t param);
void UI_func_seq_tempo(uint8_t param);
void UI_func_seq_pat_chain(uint8_t param); void UI_func_seq_pat_chain(uint8_t param);
void UI_func_seq_track_setup(uint8_t param);
void UI_func_seq_pattern_load(uint8_t param); void UI_func_seq_pattern_load(uint8_t param);
void UI_func_seq_pattern_save(uint8_t param); void UI_func_seq_pattern_save(uint8_t param);
void UI_func_volume(uint8_t param); void UI_func_volume(uint8_t param);
@ -677,6 +686,14 @@ void lcdml_menu_control(void)
#endif #endif
encoderDir[ENC_R].ButtonLong(true); encoderDir[ENC_R].ButtonLong(true);
if (seq_running) {
seq_running = false;
seq_recording = false;
seq_step = 0;
seq_chain_active_step = 0;
MicroDexed[0]->panic();
}
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select))
{ {
LCDML.BT_enter(); LCDML.BT_enter();
@ -3616,7 +3633,7 @@ void UI_func_drum_reverb_send(uint8_t param)
lcd.setCursor(1, 1); lcd.setCursor(1, 1);
sprintf(displayname, "%02d", activesample); sprintf(displayname, "%02d", activesample);
lcd.print(displayname); lcd.print(displayname);
lcd.show(4, 1, 6, basename(drum_config[activesample].filename)); lcd.show(4, 5, 6, basename(drum_config[activesample].filename));
sprintf(displayname, "%03d", (int)(drum_config[activesample].reverb_send * 100) ); sprintf(displayname, "%03d", (int)(drum_config[activesample].reverb_send * 100) );
lcd.setCursor(12, 1); lcd.setCursor(12, 1);
lcd.print(displayname); lcd.print(displayname);
@ -3824,10 +3841,12 @@ const char* seq_find_shortname(uint8_t sstep)
{ {
const char* shortname = " "; const char* shortname = " ";
bool found = false; bool found = false;
if (seq_active_track < 3) { if (seq_content_type[seq_active_track] == 0) //is Drumtrack
{
for (uint8_t d = 0; d < num_drums - 1; d++) for (uint8_t d = 0; d < num_drums - 1; d++)
{ {
if (seq_data[ seq_patternchain[seq_chain_active_step][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)
if (seq_data[seq_active_track][sstep] == drum_config[d].midinote)
{ {
shortname = drum_config[d].shortname; shortname = drum_config[d].shortname;
found = true; found = true;
@ -3837,7 +3856,8 @@ const char* seq_find_shortname(uint8_t sstep)
if (found == false) shortname = "-"; if (found == false) shortname = "-";
} else } else
{ {
if (seq_data[ seq_patternchain[seq_chain_active_step][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 = "-";
if (seq_data[seq_active_track][sstep] > 0) shortname = "*"; else shortname = "-";
} }
return shortname; return shortname;
} }
@ -3849,9 +3869,9 @@ const char* seq_find_shortname(uint8_t sstep)
// if (track < 3) { // if (track < 3) {
// for (uint8_t d = 0; d < num_drums - 1; d++) // for (uint8_t d = 0; d < num_drums - 1; d++)
// { // {
// if (seq_data[track][seq_step_timer] == drum_config[d].midinote) // if (seq_data[track][seq_step] == drum_config[d].midinote)
// { // {
// drum_config[d].reverb_send = float(seq_reverb[track][seq_step_timer]) / float(100); // drum_config[d].reverb_send = float(seq_reverb[track][seq_step]) / float(100);
// break; // break;
// } // }
// } // }
@ -3936,6 +3956,162 @@ void UI_func_seq_lenght(uint8_t param)
} }
} }
void UI_func_seq_tempo(uint8_t param)
{
char tmp[5];
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(" Seq. Tempo ");
lcd.setCursor(5, 1);
lcd.print("BPM");
lcd.setCursor(14, 1);
lcd.print("ms");
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()))
{
if (LCDML.BT_checkDown())
seq_bpm = constrain(seq_bpm + ENCODER[ENC_R].speed(), 60, 180);
else if (LCDML.BT_checkUp())
seq_bpm = constrain(seq_bpm - ENCODER[ENC_R].speed(), 60, 180);
}
seq_tempo_ms = 60000 / seq_bpm / 4;
sprintf(tmp, "[%3d]", seq_bpm);
lcd.setCursor(0, 1);
lcd.print(tmp);
lcd.setCursor(9, 1);
sprintf(tmp, "[%3d]", seq_tempo_ms);
lcd.print(tmp);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void UI_func_seq_vel_editor(uint8_t param)
{
char tmp[5];
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
// setup function
lcd.setCursor(0, 0);
lcd.print("Vel:");
//lcd.show(0, 6, 6, basename(drum_config[activesample].filename));
sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]);
lcd.setCursor(4, 0);
lcd.print(tmp);
lcd.setCursor(10, 0);
lcd.print("Seq[");
lcd.setCursor(15, 0);
lcd.print("]");
lcd.setCursor(14, 0);
lcd.print(seq_active_track);
for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1);
lcd.print(seq_find_shortname(i) );
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (seq_active_function == 99) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_menu = constrain(seq_menu + 1, 0, 16);
else if (LCDML.BT_checkUp())
seq_menu = constrain(seq_menu - 1, 0, 16);
}
}
else if (seq_active_function == 0) {
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, 9);
else if (LCDML.BT_checkUp())
seq_active_track = constrain(seq_active_track - 1, 0, 9);
}
}
else if (seq_active_function == 1) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_vel[seq_active_track][seq_menu - 1] = constrain(seq_vel[seq_active_track][seq_menu - 1] + 1, 0, 127);
else if (LCDML.BT_checkUp())
seq_vel[seq_active_track][seq_menu - 1] = constrain(seq_vel[seq_active_track][seq_menu - 1] - 1, 0, 127);
}
}
if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
{
if ( seq_menu == 0 && seq_active_function == 99)
{
seq_active_function = 0;
} else if ( seq_menu == 0 && seq_active_function == 0)
{
seq_active_function = 99;
}
else if (seq_menu > 0 && seq_active_function == 99)
{
seq_active_function = 1;
}
else
seq_active_function = 99;
}
//button check end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if (seq_menu == 0) {
lcd.setCursor(4, 0);
lcd.print("---");
lcd.setCursor(13, 0);
lcd.print("[");
lcd.print(seq_active_track);
lcd.print("]");
lcd.setCursor(0, 1);
for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1);
lcd.print(seq_find_shortname(i) );
}
} else if (seq_menu == 1) {
lcd.setCursor(13, 0);
lcd.print(" ");
lcd.setCursor(15, 0);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("x");
lcd.setCursor(1, 1);
lcd.print(seq_find_shortname(1) );
sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]);
lcd.setCursor(4, 0);
lcd.print(tmp);
} else if (seq_menu > 1) {
lcd.setCursor(seq_menu - 1, 1);
lcd.print("x");
lcd.setCursor(seq_menu - 2, 1);
lcd.print(seq_find_shortname(seq_menu - 2) );
lcd.setCursor(seq_menu , 1);
lcd.print(seq_find_shortname(seq_menu ) );
sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]);
lcd.setCursor(4, 0);
lcd.print(tmp);
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void UI_func_sequencer(uint8_t param) void UI_func_sequencer(uint8_t param)
{ {
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
@ -3949,6 +4125,7 @@ void UI_func_sequencer(uint8_t param)
if (seq_running == false && seq_recording == false) if (seq_running == false && seq_recording == false)
{ {
lcd.print("PLY"); lcd.print("PLY");
} else if (seq_running == true && seq_recording == false) } else if (seq_running == true && seq_recording == false)
{ {
seq_note_in = 0; seq_note_in = 0;
@ -3959,7 +4136,7 @@ void UI_func_sequencer(uint8_t param)
lcd.print("STP"); lcd.print("STP");
} }
lcd.setCursor(14, 0); lcd.setCursor(14, 0);
lcd.print(seq_active_track + 1); lcd.print(seq_active_track);
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) );
@ -3988,9 +4165,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, 8); seq_active_track = constrain(seq_active_track + 1, 0, 9);
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
seq_active_track = constrain(seq_active_track - 1, 0, 8); seq_active_track = constrain(seq_active_track - 1, 0, 9);
} }
} }
if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -4003,6 +4180,7 @@ void UI_func_sequencer(uint8_t param)
if (activesample == num_drums + 2) { if (activesample == num_drums + 2) {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
memset(seq_data[i], 0, sizeof(seq_data[i])); memset(seq_data[i], 0, sizeof(seq_data[i]));
memset(seq_vel[i], 0, sizeof(seq_vel[i]));
} }
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1); lcd.setCursor(i, 1);
@ -4011,6 +4189,7 @@ void UI_func_sequencer(uint8_t param)
} else if (activesample == num_drums + 1) { } else if (activesample == num_drums + 1) {
memset(seq_data[seq_active_track], 0, sizeof(seq_data[seq_active_track])); memset(seq_data[seq_active_track], 0, sizeof(seq_data[seq_active_track]));
memset(seq_vel[seq_active_track], 0, sizeof(seq_vel[seq_active_track]));
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) );
@ -4039,6 +4218,8 @@ void UI_func_sequencer(uint8_t param)
seq_running = false; seq_running = false;
seq_recording = false; seq_recording = false;
seq_note_in = 0; seq_note_in = 0;
seq_step = 0;
seq_chain_active_step = 0;
lcd.print("PLY"); lcd.print("PLY");
MicroDexed[0]->panic(); MicroDexed[0]->panic();
} }
@ -4050,6 +4231,7 @@ void UI_func_sequencer(uint8_t param)
{ {
if (seq_active_function == 99) { if (seq_active_function == 99) {
seq_data[seq_active_track][seq_menu - 3] = drum_config[activesample].midinote; seq_data[seq_active_track][seq_menu - 3] = drum_config[activesample].midinote;
seq_vel[seq_active_track][seq_menu - 3] = 120;
} }
else else
seq_active_function = 99; seq_active_function = 99;
@ -4115,7 +4297,7 @@ void UI_func_sequencer(uint8_t param)
lcd.setCursor(13, 0); lcd.setCursor(13, 0);
lcd.print("["); lcd.print("[");
lcd.setCursor(14, 0); lcd.setCursor(14, 0);
lcd.print(seq_active_track + 1); lcd.print(seq_active_track);
lcd.setCursor(15, 0); lcd.setCursor(15, 0);
lcd.print("]"); lcd.print("]");
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
@ -4147,10 +4329,13 @@ void UI_func_sequencer(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
seq_running = false;
seq_recording = false; // seq_running = false;
seq_note_in = 0; // seq_recording = false;
MicroDexed[0]->panic(); // seq_note_in = 0;
// seq_step = 0;
// seq_chain_active_step = 0;
// MicroDexed[0]->panic();
} }
} }
@ -4167,38 +4352,39 @@ void UI_func_seq_pat_chain(uint8_t param)
lcd.print("/"); lcd.print("/");
lcd.setCursor( 14, 0); lcd.setCursor( 14, 0);
lcd.print(seq_chain_lenght + 1); lcd.print(seq_chain_lenght + 1);
lcd.setCursor(0 , 0); lcd.setCursor(0 , 0);
lcd.print("D"); if (seq_track_type[0] == 0 ) lcd.print("D"); else lcd.print("I");
lcd.setCursor(2 , 0); lcd.setCursor(2 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][0]); lcd.print( seq_patternchain[seq_chain_active_chainstep][0]);
lcd.setCursor(0 , 1); lcd.setCursor(0 , 1);
lcd.print("D"); if (seq_track_type[1] == 0 )lcd.print("D"); else lcd.print("I");
lcd.setCursor(2 , 1); lcd.setCursor(2 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][1]); lcd.print( seq_patternchain[seq_chain_active_chainstep][1]);
lcd.setCursor(6 , 0); lcd.setCursor(6 , 0);
lcd.print("D"); if (seq_track_type[2] == 0 ) lcd.print("D"); else lcd.print("I");
lcd.setCursor(8 , 0); lcd.setCursor(8 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][2]); lcd.print( seq_patternchain[seq_chain_active_chainstep][2]);
lcd.setCursor(6 , 1); lcd.setCursor(6 , 1);
lcd.print("I"); if (seq_track_type[3] == 0 )lcd.print("D"); else lcd.print("I");
lcd.setCursor(8 , 1); lcd.setCursor(8 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][3]); lcd.print( seq_patternchain[seq_chain_active_chainstep][3]);
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
{ {
if (seq_chain_active_menu == 99) { if (seq_temp_active_menu == 99) {
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_chain_select_menu = constrain(seq_chain_select_menu + 1, 0, 4); seq_temp_select_menu = constrain(seq_temp_select_menu + 1, 0, 4);
else if (LCDML.BT_checkUp()) else if (LCDML.BT_checkUp())
seq_chain_select_menu = constrain(seq_chain_select_menu - 1, 0, 4); seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, 4);
} }
} else if (seq_chain_active_menu == 4) { } else if (seq_temp_active_menu == 4) {
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())
@ -4207,16 +4393,16 @@ void UI_func_seq_pat_chain(uint8_t param)
seq_chain_active_chainstep = constrain(seq_chain_active_chainstep - 1, 0, seq_chain_lenght); seq_chain_active_chainstep = constrain(seq_chain_active_chainstep - 1, 0, seq_chain_lenght);
} }
} }
else if (seq_chain_active_menu < 4) { else if (seq_temp_active_menu < 4) {
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_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_chain_active_menu] + 1, 0, 9); seq_patternchain[seq_chain_active_chainstep][seq_temp_active_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_temp_active_menu] + 1, 0, 9);
else if (LCDML.BT_checkUp()) 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); seq_patternchain[seq_chain_active_chainstep][seq_temp_active_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_temp_active_menu] - 1, 0, 9);
} }
} }
if (seq_chain_select_menu == 0 && seq_chain_active_menu == 99) // Drum 0 if (seq_temp_select_menu == 0 && seq_temp_active_menu == 99) // Drum 0
{ {
lcd.setCursor(1 , 0); lcd.setCursor(1 , 0);
lcd.print("["); lcd.print("[");
@ -4226,7 +4412,7 @@ void UI_func_seq_pat_chain(uint8_t param)
lcd.print(" "); lcd.print(" ");
lcd.setCursor(3 , 1); lcd.setCursor(3 , 1);
lcd.print(" "); lcd.print(" ");
} else if (seq_chain_select_menu == 1 && seq_chain_active_menu == 99) // Drum 1 } else if (seq_temp_select_menu == 1 && seq_temp_active_menu == 99) // Drum 1
{ {
lcd.setCursor(1 , 0); lcd.setCursor(1 , 0);
lcd.print(" "); lcd.print(" ");
@ -4240,7 +4426,7 @@ void UI_func_seq_pat_chain(uint8_t param)
lcd.print("["); lcd.print("[");
lcd.setCursor(3 , 1); lcd.setCursor(3 , 1);
lcd.print("]"); lcd.print("]");
} else if (seq_chain_select_menu == 2 && seq_chain_active_menu == 99) // Drum 2 } else if (seq_temp_select_menu == 2 && seq_temp_active_menu == 99) // Drum 2
{ {
lcd.setCursor(7 , 0); lcd.setCursor(7 , 0);
lcd.print("["); lcd.print("[");
@ -4254,7 +4440,7 @@ void UI_func_seq_pat_chain(uint8_t param)
lcd.print(" "); lcd.print(" ");
lcd.setCursor(9 , 1); lcd.setCursor(9 , 1);
lcd.print(" "); lcd.print(" ");
} else if (seq_chain_select_menu == 3 && seq_chain_active_menu == 99) // Inst } else if (seq_temp_select_menu == 3 && seq_temp_active_menu == 99) // Inst
{ {
lcd.setCursor(7 , 0); lcd.setCursor(7 , 0);
lcd.print(" "); lcd.print(" ");
@ -4268,7 +4454,7 @@ void UI_func_seq_pat_chain(uint8_t param)
lcd.print(" "); lcd.print(" ");
lcd.setCursor( 15, 0); lcd.setCursor( 15, 0);
lcd.print(" "); lcd.print(" ");
} else if (seq_chain_select_menu == 4 && seq_chain_active_menu == 99) // Chainselect } else if (seq_temp_select_menu == 4 && seq_temp_active_menu == 99) // Chainselect
{ {
lcd.setCursor(7 , 1); lcd.setCursor(7 , 1);
lcd.print(" "); lcd.print(" ");
@ -4285,7 +4471,7 @@ void UI_func_seq_pat_chain(uint8_t param)
lcd.print(seq_chain_lenght + 1); lcd.print(seq_chain_lenght + 1);
lcd.setCursor( 15, 0); lcd.setCursor( 15, 0);
lcd.print("]"); lcd.print("]");
} else if (seq_chain_select_menu == 4 && seq_chain_active_menu == 4) // Chainselect modify } else if (seq_temp_select_menu == 4 && seq_temp_active_menu == 4) // Chainselect modify
{ {
lcd.setCursor( 11, 0); lcd.setCursor( 11, 0);
lcd.print("["); lcd.print("[");
@ -4309,19 +4495,19 @@ void UI_func_seq_pat_chain(uint8_t param)
lcd.setCursor(8 , 1); lcd.setCursor(8 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][3]); lcd.print( seq_patternchain[seq_chain_active_chainstep][3]);
} else if (seq_chain_select_menu == 0 && seq_chain_active_menu == 0) // Drum 0 modify } else if (seq_temp_select_menu == 0 && seq_temp_active_menu == 0) // Drum 0 modify
{ {
lcd.setCursor(2 , 0); lcd.setCursor(2 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][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 } else if (seq_temp_select_menu == 1 && seq_temp_active_menu == 1) // Drum 1 modify
{ {
lcd.setCursor(2 , 1); lcd.setCursor(2 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][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 } else if (seq_temp_select_menu == 2 && seq_temp_active_menu == 2) // Drum 2 modify
{ {
lcd.setCursor(8 , 0); lcd.setCursor(8 , 0);
lcd.print( seq_patternchain[seq_chain_active_chainstep][2]); lcd.print( seq_patternchain[seq_chain_active_chainstep][2]);
} else if (seq_chain_select_menu == 3 && seq_chain_active_menu == 3) // Inst modify } else if (seq_temp_select_menu == 3 && seq_temp_active_menu == 3) // Inst modify
{ {
lcd.setCursor(8 , 1); lcd.setCursor(8 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][3]); lcd.print( seq_patternchain[seq_chain_active_chainstep][3]);
@ -4329,13 +4515,129 @@ void UI_func_seq_pat_chain(uint8_t param)
if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
{ {
if (seq_chain_active_menu == seq_chain_select_menu) { if (seq_temp_active_menu == seq_temp_select_menu) {
seq_chain_active_menu = 99; seq_temp_active_menu = 99;
} else
{
seq_temp_active_menu = seq_temp_select_menu;
}
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void UI_func_seq_track_setup(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
seq_temp_active_menu = 99;
lcd.setCursor(0 , 0);
lcd.print("T1");
lcd.setCursor(0 , 1);
lcd.print("T2");
lcd.setCursor(9 , 0);
lcd.print("T3");
lcd.setCursor(9 , 1);
lcd.print("T4");
lcd.setCursor(3 , 0);
if (seq_track_type[0] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
lcd.setCursor(3 , 1);
if (seq_track_type[1] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
lcd.setCursor(12 , 0);
if (seq_track_type[2] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
lcd.setCursor(12 , 1);
if (seq_track_type[3] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (seq_temp_active_menu == 99) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_temp_select_menu = constrain(seq_temp_select_menu + 1, 0, 3);
else if (LCDML.BT_checkUp())
seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, 3);
}
} else {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_track_type[seq_temp_active_menu] = constrain(seq_track_type[seq_temp_active_menu] + 1, 0, 1);
else if (LCDML.BT_checkUp())
seq_track_type[seq_temp_active_menu] = constrain(seq_track_type[seq_temp_active_menu] - 1, 0, 1);
}
}
if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
{
if (seq_temp_active_menu == 99) {
seq_temp_active_menu = seq_temp_select_menu;
} else } else
{ {
seq_chain_active_menu = seq_chain_select_menu; seq_temp_active_menu = 99;
} }
} }
if (seq_temp_select_menu == 0)
{
lcd.setCursor(2 , 0);
lcd.print("[");
lcd.setCursor(6 , 0);
lcd.print("]");
lcd.setCursor(2 , 1);
lcd.print(" ");
lcd.setCursor(6 , 1);
lcd.print(" ");
lcd.setCursor(3 , 0);
if (seq_track_type[0] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
} else if (seq_temp_select_menu == 1)
{
lcd.setCursor(2 , 0);
lcd.print(" ");
lcd.setCursor(6 , 0);
lcd.print(" ");
lcd.setCursor(2 , 1);
lcd.print("[");
lcd.setCursor(6 , 1);
lcd.print("]");
lcd.setCursor(11 , 0);
lcd.print(" ");
lcd.setCursor(15 , 0);
lcd.print(" ");
lcd.setCursor(3 , 1);
if (seq_track_type[1] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
} else if (seq_temp_select_menu == 2)
{
lcd.setCursor(2 , 1);
lcd.print(" ");
lcd.setCursor(6 , 1);
lcd.print(" ");
lcd.setCursor(11 , 0);
lcd.print("[");
lcd.setCursor(15 , 0);
lcd.print("]");
lcd.setCursor(11 , 1);
lcd.print(" ");
lcd.setCursor(15 , 1);
lcd.print(" ");
lcd.setCursor(12 , 0);
if (seq_track_type[2] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
} else if (seq_temp_select_menu == 3)
{
lcd.setCursor(11 , 0);
lcd.print(" ");
lcd.setCursor(15 , 0);
lcd.print(" ");
lcd.setCursor(11 , 1);
lcd.print("[");
lcd.setCursor(15 , 1);
lcd.print("]");
lcd.setCursor(12 , 1);
if (seq_track_type[3] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
}
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
@ -4343,13 +4645,14 @@ void UI_func_seq_pat_chain(uint8_t param)
} }
} }
void UI_func_seq_pattern_load(uint8_t param) void UI_func_seq_pattern_load(uint8_t param)
{ {
static uint8_t mode; static uint8_t mode;
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
char tmp[10]; char tmp[10];
temp_int=param; temp_int = param;
mode = 0; mode = 0;
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
lcd.setCursor(0, 0); lcd.setCursor(0, 0);

@ -36,6 +36,15 @@ extern void check_configuration_dexed(uint8_t instance_id);
extern void check_configuration_performance(void); extern void check_configuration_performance(void);
extern void check_configuration_fx(void); extern void check_configuration_fx(void);
extern StaticJsonDocument<JSON_BUFFER> data_json; extern StaticJsonDocument<JSON_BUFFER> data_json;
extern uint8_t seq_chain_lenght;
extern uint8_t seq_data[10][16];
extern uint8_t seq_vel[10][16];
extern uint8_t seq_patternchain[4][4];
extern uint8_t seq_content_type[10];
extern uint8_t seq_track_type[4];
extern int perform_attack_mod[NUM_DEXED];
extern int perform_release_mod[NUM_DEXED];
extern int seq_transpose;
/****************************************************************************** /******************************************************************************
SD BANK/VOICE LOADING SD BANK/VOICE LOADING
@ -738,6 +747,253 @@ bool save_sd_fx_json(uint8_t fx)
return (false); return (false);
} }
bool save_sd_seq_json(uint8_t seq_number)
{
char filename[FILENAME_LEN];
int count = 0;
seq_number = constrain(seq_number, 0, 99);
if (sd_card > 0)
{
File json;
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number);
#ifdef DEBUG
Serial.print(F("Saving sequencer config "));
Serial.print(seq_number);
Serial.print(F(" to "));
Serial.println(filename);
#endif
int total = sizeof(seq_data);
int columns = sizeof(seq_data[0]);
int rows = total / columns;
Serial.print(F("Rows: "));
Serial.print(rows);
Serial.print(" Columns: ");
Serial.print(columns);
Serial.print(F(" "));
AudioNoInterrupts();
json = SD.open(filename, FILE_WRITE);
if (json)
{
data_json["seq_chain_lenght"] = seq_chain_lenght;
data_json["seq_transpose"] = seq_transpose;
for (uint8_t i = 0; i < sizeof(seq_track_type); i++) {
data_json["track_type"][i] = seq_track_type[i];
}
for (uint8_t i = 0; i < sizeof(seq_content_type); i++) {
data_json["content_type"][i] = seq_content_type[i];
}
for (uint8_t i = 0; i < rows; i++)
{
for (uint8_t j = 0; j < columns; j++) {
data_json["seq_data"][count] = seq_data[i][j];
count++;
}
}
count = 0;
for (uint8_t i = 0; i < rows; i++)
{
for (uint8_t j = 0; j < columns; j++) {
data_json["seq_velocity"][count] = seq_vel[i][j];
count++;
}
}
total = sizeof(seq_patternchain);
columns = sizeof(seq_patternchain[0]);
rows = total / columns;
Serial.print(F("Chain Rows: "));
Serial.print(rows);
Serial.print(" Chain Columns: ");
Serial.print(columns);
Serial.print(F(" "));
count = 0;
for (uint8_t i = 0; i < rows; i++)
{
for (uint8_t j = 0; j < columns; j++) {
data_json["seq_patternchain"][count] = seq_patternchain[i][j];
count++;
}
}
count = 0;
// following data maybe useful to be included in sequencer store and OPTIONAL to be loaded
for (uint8_t i = 0; i < MAX_DEXED; i++)
{
data_json["reverb_send"][i] = configuration.fx.reverb_send[i];
data_json["perform_attack_mod"][i] = perform_attack_mod[i];
data_json["perform_release_mod"][i] = perform_release_mod[i];
}
data_json["reverb_roomsize"] = configuration.fx.reverb_roomsize;
data_json["reverb_damping"] = configuration.fx.reverb_damping;
data_json["reverb_lowpass"] = configuration.fx.reverb_lowpass;
data_json["reverb_lodamp"] = configuration.fx.reverb_lodamp;
data_json["reverb_hidamp"] = configuration.fx.reverb_hidamp;
data_json["reverb_diffusion"] = configuration.fx.reverb_diffusion;
data_json["reverb_level"] = configuration.fx.reverb_level;
data_json["eq_bass"] = configuration.fx.eq_bass;
data_json["eq_treble"] = configuration.fx.eq_treble;
#ifdef DEBUG
Serial.println(F("Write JSON data:"));
serializeJsonPretty(data_json, Serial);
Serial.println();
#endif
serializeJsonPretty(data_json, json);
json.close();
AudioInterrupts();
return (true);
}
json.close();
}
else
{
#ifdef DEBUG
Serial.print(F("E : Cannot open "));
Serial.print(filename);
Serial.println(F(" on SD."));
#endif
}
AudioInterrupts();
return (false);
}
bool load_sd_seq_json(uint8_t seq_number)
{
if (seq_number < 0)
return (false);
seq_number = constrain(seq_number, 0, 99);
if (sd_card > 0)
{
File json;
char filename[FILENAME_LEN];
sprintf(filename, "/%s/%s%d.json", SEQ_CONFIG_PATH, SEQ_CONFIG_NAME, seq_number);
// first check if file exists...
AudioNoInterrupts();
if (SD.exists(filename))
{
// ... and if: load
#ifdef DEBUG
Serial.print(F("Found Sequencer configuration ["));
Serial.print(filename);
Serial.println(F("]... loading..."));
#endif
json = SD.open(filename);
if (json)
{
deserializeJson(data_json, json);
json.close();
AudioInterrupts();
//check_configuration_fx();
#ifdef DEBUG
Serial.println(F("Read JSON data:"));
serializeJsonPretty(data_json, Serial);
Serial.println();
#endif
int total = sizeof(seq_data);
int columns = sizeof(seq_data[0]);
int rows = total / columns;
int count = 0;
seq_transpose = data_json["seq_transpose"];
seq_chain_lenght = data_json["seq_chain_lenght"];
for (uint8_t i = 0; i < sizeof(seq_track_type); i++) {
seq_track_type[i] = data_json["track_type"][i];
}
for (uint8_t i = 0; i < sizeof(seq_content_type); i++) {
seq_content_type[i] = data_json["content_type"][i];
}
for (uint8_t i = 0; i < rows; i++)
{
for (uint8_t j = 0; j < columns; j++) {
seq_data[i][j] = data_json["seq_data"][count];
count++;
}
}
count = 0;
for (uint8_t i = 0; i < rows; i++)
{
for (uint8_t j = 0; j < columns; j++) {
seq_vel[i][j] = data_json["seq_velocity"][count];
count++;
}
}
total = sizeof(seq_patternchain);
columns = sizeof(seq_patternchain[0]);
rows = total / columns;
count = 0;
for (uint8_t i = 0; i < rows; i++)
{
for (uint8_t j = 0; j < columns; j++) {
seq_patternchain[i][j] = data_json["seq_patternchain"][count];
count++;
}
}
count = 0;
// following data maybe useful to be included in sequencer store and OPTIONAL to be loaded back
for (uint8_t i = 0; i < MAX_DEXED; i++)
{
configuration.fx.reverb_send[i] = data_json["reverb_send"][i];
//perform_attack_mod[i] = data_json["perform_attack_mod"][i];
//perform_release_mod[i] = data_json["perform_release_mod"][i];
}
configuration.fx.reverb_roomsize = data_json["reverb_roomsize"];
configuration.fx.reverb_damping = data_json["reverb_damping"];
configuration.fx.reverb_lowpass = data_json["reverb_lowpass"];
configuration.fx.reverb_lodamp = data_json["reverb_lodamp"];
configuration.fx.reverb_hidamp = data_json["reverb_hidamp"];
configuration.fx.reverb_diffusion = data_json["reverb_diffusion"];
configuration.fx.reverb_level = data_json["reverb_level"];
configuration.fx.eq_bass = data_json["eq_bass"];
configuration.fx.eq_treble = data_json["eq_treble"];
set_fx_params();
return (true);
}
#ifdef DEBUG
else
{
Serial.print(F("E : Cannot open "));
Serial.print(filename);
Serial.println(F(" on SD."));
}
}
else
{
Serial.print(F("No "));
Serial.print(filename);
Serial.println(F(" available."));
#endif
}
}
AudioInterrupts();
return (false);
}
/****************************************************************************** /******************************************************************************
SD PERFORMANCE SD PERFORMANCE
******************************************************************************/ ******************************************************************************/

@ -14,17 +14,20 @@ extern const char* seq_find_shortname(uint8_t);
void sequencer(void) void sequencer(void)
{ {
bool seq_noteoffsent = false;
if (seq_note_in > 0 && seq_recording == false && seq_active_track == 3 && seq_note_in < 71) { if (seq_note_in > 0 && seq_note_in < 62 && seq_recording == false ) {
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] + seq_transpose , 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[3][seq_step - 1] + seq_transpose , 0);
seq_transpose = seq_note_in - 6 * 12 + 3; //if (seq_note_in>65)seq_note_in=seq_note_in-12;
seq_note_in = 0;
// seq_transpose = seq_note_in % 12 ;
//seq_transpose=seq_transpose-12;
// seq_note_in = 0;
} }
if (seq_millis_timer > seq_timer_previous + 136) if (seq_millis_timer > seq_timer_previous + seq_tempo_ms)
{ {
seq_timer_previous = seq_millis_timer; seq_timer_previous = seq_millis_timer;
@ -34,48 +37,52 @@ void sequencer(void)
//write to sequencer if in sequencer menu //write to sequencer if in sequencer menu
if (seq_note_in > 0 && seq_recording == true) { 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); // if ( seq_content_type[ seq_patternchain[seq_chain_active_step][active_track] ] == 1) handleNoteOff(configuration.dexed[0].midi_channel, seq_data[active_track][seq_step] + seq_transpose , 0);
seq_data[seq_active_track][seq_step_timer] = seq_note_in; seq_data[seq_active_track][seq_step] = seq_note_in;
seq_vel[seq_active_track][seq_step_timer] = seq_note_in_velocity; seq_vel[seq_active_track][seq_step] = seq_note_in_velocity;
seq_note_in = 0; seq_note_in = 0;
seq_note_in_velocity=0; seq_note_in_velocity=0;
} }
lcd.setCursor(seq_step_timer, 1); lcd.setCursor(seq_step, 1);
lcd.print("X"); lcd.print("X");
if (seq_step_timer == 0) { if (seq_step == 0) {
lcd.setCursor(15, 1); lcd.setCursor(15, 1);
lcd.print(seq_find_shortname(15)); lcd.print(seq_find_shortname(15));
} }
else else
{ {
lcd.setCursor(seq_step_timer - 1, 1); lcd.setCursor(seq_step - 1, 1);
lcd.print(seq_find_shortname(seq_step_timer - 1)); lcd.print(seq_find_shortname(seq_step - 1));
} }
} }
//loop for drum track 0-2
for (uint8_t d = 0; d < 3; d++) for (uint8_t d = 0; d < 4; d++)
{ {
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)
if ( seq_content_type[ seq_patternchain[seq_chain_active_step][d] ] == 0){// drum track
if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0 && seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0)
{ {
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]); handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] , seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]);
} }
} }
// instrument track else {
if (seq_data[ seq_patternchain[seq_chain_active_step][3] ][seq_step_timer] > 0) //test instrument sequencer Instance=0 if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0 && seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0) // instrument track
{ {
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]); handleNoteOn(configuration.dexed[0].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose , seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]);
seq_prev_note=seq_data[ seq_patternchain[seq_chain_active_step][3] ][seq_step_timer] + seq_transpose; seq_prev_note[d]=seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose;
} }
}
seq_noteoffsent = false; seq_noteoffsent[d] = false;
seq_step_timer++; }
if (seq_step_timer > 15) { seq_step++;
seq_step_timer = 0;
if (seq_step > 15) {
seq_step = 0;
if (seq_chain_lenght>0){ if (seq_chain_lenght>0){
seq_chain_active_step++; seq_chain_active_step++;
if (seq_chain_active_step>seq_chain_lenght) if (seq_chain_active_step>seq_chain_lenght)
@ -86,12 +93,18 @@ void sequencer(void)
} }
} }
if (seq_millis_timer > seq_timer_previous + 80 && seq_noteoffsent == false) if (seq_millis_timer > seq_timer_previous + 80 )
{ {
if ( seq_prev_note > 0) //test instrument sequencer Instance=0 for (uint8_t d = 0; d < 4; d++)
{
if( seq_noteoffsent[d] == false) {
if ( seq_prev_note[d] > 0) //test instrument sequencer Instance=0
{ {
handleNoteOff(configuration.dexed[0].midi_channel, seq_prev_note , 0); handleNoteOff(configuration.dexed[0].midi_channel, seq_prev_note[d] , 0);
} }
seq_noteoffsent = true; }
seq_noteoffsent[d] = true;
}
} }
} }

@ -2,52 +2,54 @@
uint8_t seq_active_track = 0; uint8_t seq_active_track = 0;
uint8_t seq_menu; uint8_t seq_menu;
bool seq_button_r = false; bool seq_button_r = false;
bool seq_noteoffsent = false; bool seq_noteoffsent[4] = {false,false,false,false};
elapsedMillis seq_millis_timer; elapsedMillis seq_millis_timer;
uint8_t seq_step_timer = 0; uint8_t seq_step = 0;
uint32_t seq_timer_previous = 0; uint32_t seq_timer_previous = 0;
bool seq_running = false; bool seq_running = false;
bool seq_recording = false; bool seq_recording = false;
uint8_t seq_note_in; uint8_t seq_note_in;
uint8_t seq_note_in_velocity; uint8_t seq_note_in_velocity;
int seq_transpose; int seq_transpose;
uint8_t seq_chain_select_menu; int seq_tempo_ms=147;
uint8_t seq_chain_active_menu = 99; int seq_bpm=102;
uint8_t seq_temp_select_menu;
uint8_t seq_temp_active_menu = 99;
uint8_t seq_chain_active_chainstep; uint8_t seq_chain_active_chainstep;
uint8_t seq_chain_lenght=3; // 0=16 steps, 1=32 Steps, 2=46 Steps, 3=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_chain_active_step = 0;
uint8_t seq_prev_note; uint8_t seq_prev_note[4]; // note_offs for every (instr.) track
uint8_t seq_data[10][16] = {72, 0, 0, 0, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 0, uint8_t seq_data[10][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 ,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 72 ,0 ,0 ,0 ,72 ,0 ,0 ,0 ,72 ,0 ,0 ,75 ,72 ,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 ,
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, 55 ,0 ,0 ,0 ,0 ,0 ,52 ,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, 57 ,0 ,0 ,0 ,0 ,0 ,53 ,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, 74 ,0 ,0 ,72 ,0 ,0 ,74 ,0 ,0 ,0 ,76 ,0 ,0 ,0 ,0 ,0 ,
50, 50, 0, 0, 75, 0, 0, 50, 50, 50, 50, 50, 75, 75, 75, 75, 74 ,0 ,0 ,72 ,0 ,0 ,71 ,0 ,0 ,0 ,67 ,0 ,0 ,0 ,0 ,0 ,
72, 0, 0, 0, 72, 0, 0, 72, 72, 0, 0, 0, 72, 0, 0, 0 69 ,0 ,0 ,76 ,0 ,0 ,69 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0
};
uint8_t seq_vel[10][16] = {120 ,0 ,0 ,0 ,120 ,0 ,0 ,0 ,120 ,0 ,0 ,0 ,120 ,0 ,0 ,0 ,
125 ,101 ,125 ,125 ,126 ,98 ,126 ,99 ,126 ,97 ,126 ,100 ,126 ,99 ,125 ,100 ,
120 ,0 ,0 ,0 ,120 ,0 ,0 ,0 ,120 ,0 ,120 ,120 ,120 ,120 ,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 ,
125 ,0 ,0 ,0 ,0 ,0 ,126 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
78 ,120 ,0 ,0 ,0 ,0 ,84 ,120 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
98 ,120 ,0 ,88 ,120 ,0 ,127 ,120 ,0 ,0 ,125 ,120 ,0 ,0 ,
0 ,0 ,124 ,120 ,0 ,115 ,0 ,0 ,126 ,120 ,0 ,120 ,127 ,120 ,0 ,0 ,
0 ,0 ,123 ,120 ,0 ,110 ,120 ,0 ,90 ,120 ,0 ,0 ,0 ,0 ,0 ,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, uint8_t seq_patternchain[4][4] = { 0 ,1 ,6 ,9 ,0 ,1 ,5 ,8 ,0 ,1 ,6 ,9 ,2 ,1 ,5 ,7
78, 58, 88, 48, 78, 38, 78, 78, 68, 48, 68, 48, 88, 48, 78, 48, };
55, 45, 87, 27, 2, 6, 5, 37, 7, 45, 33, 37, 5, 35, 2, 27, uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 1, 1, 1 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack
55, 45, 77, 27, 12, 6, 15, 37, 7, 45, 43, 27, 15, 35, 2, 17, uint8_t seq_track_type[4] = { 0, 0, 1, 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack
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, //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, 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,
// 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, 1, 2, 6,
0, 1, 2, 4,
7, 8, 2, 5
};

Loading…
Cancel
Save