From 213160d30f1b28f321759fc0ada6ae9e08968da2 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 19 Oct 2021 14:14:22 +0200 Subject: [PATCH] Global sequencer data is now inside the struct --- MicroDexed.ino | 56 +-- UI.hpp | 1046 ++++++++++++++++++++++------------------------ dexed_sd.cpp | 169 ++++---- midi_devices.hpp | 13 +- sequencer.cpp | 183 ++++---- sequencer.h | 168 +------- 6 files changed, 708 insertions(+), 927 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 16c7619..72fbc12 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -338,8 +338,8 @@ elapsedMillis midi_decay_timer; #endif #if NUM_DEXED>1 -int perform_attack_mod[NUM_DEXED] = { 0, 0}; -int perform_release_mod[NUM_DEXED] = { 0, 0}; +int perform_attack_mod[NUM_DEXED] = { 0, 0 }; +int perform_release_mod[NUM_DEXED] = { 0, 0 }; #else int perform_attack_mod[NUM_DEXED] = { 0 }; int perform_release_mod[NUM_DEXED] = { 0 }; @@ -350,6 +350,7 @@ int16_t delayline[NUM_DEXED][MOD_DELAY_SAMPLE_BUFFER]; #endif #if NUM_DRUMS > 0 +extern sequencer_t seq; extern drum_config_t drum_config[NUM_DRUMSET_CONFIG]; uint8_t drum_counter; uint8_t drum_type[NUM_DRUMS]; @@ -363,7 +364,6 @@ extern LCDMenuLib2 LCDML; extern void getNoteName(char* noteName, uint8_t noteNumber); PeriodicTimer timer1; -extern char seq_chord_names[7][4]; /*********************************************************************** SETUP @@ -564,7 +564,7 @@ void setup() } // Start timer (to avoid a crash when loading the performance data) - timer1.begin(sequencer, seq_tempo_ms / 2, false); + timer1.begin(sequencer, seq.seq_tempo_ms / 2, false); // Load initial Performance or the last used one initial_values(false); @@ -619,7 +619,7 @@ void setup() #if NUM_DRUMS > 0 master_mixer_r.gain(2, VOL_MAX_FLOAT); master_mixer_l.gain(2, VOL_MAX_FLOAT); - drums_volume = VOL_MAX_FLOAT; + seq.drums_volume = VOL_MAX_FLOAT; #else master_mixer_r.gain(2, 0.0); master_mixer_l.gain(2, 0.0); @@ -646,7 +646,7 @@ void setup() Serial.println(F("")); #endif - strcpy(seq_name, "INIT Perf"); + strcpy(seq.seq_name, "INIT Perf"); LCDML.OTHER_jumpToFunc(UI_func_voice_select); } @@ -663,34 +663,34 @@ void loop() LCDML.loop(); #endif - if (seq_running) + if (seq.seq_running) { - if (seq_step != seq_UI_last_step) + if (seq.seq_step != seq_UI_last_step) { - seq_UI_last_step = seq_step; + seq_UI_last_step = seq.seq_step; if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) //is in UI of Sequencer { - lcd.setCursor(seq_step, 1); + lcd.setCursor(seq.seq_step, 1); lcd.write(124); - if (seq_step == 0) + if (seq.seq_step == 0) { lcd.setCursor(15, 1); lcd.print(seq_find_shortname(15)[0]); } else { - lcd.setCursor(seq_step - 1, 1); - lcd.print(seq_find_shortname(seq_step - 1)[0]); + lcd.setCursor(seq.seq_step - 1, 1); + lcd.print(seq_find_shortname(seq.seq_step - 1)[0]); } } else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_arpeggio)) //is in UI of Arpeggiator { lcd.setCursor(7, 0); - lcd.print( seq_chord_names[arp_chord][0]); - lcd.print( seq_chord_names[arp_chord][1]); - lcd.print( seq_chord_names[arp_chord][2]); - lcd.print( seq_chord_names[arp_chord][3]); + lcd.print( seq.seq_chord_names[seq.arp_chord][0]); + lcd.print( seq.seq_chord_names[seq.arp_chord][1]); + lcd.print( seq.seq_chord_names[seq.arp_chord][2]); + lcd.print( seq.seq_chord_names[seq.arp_chord][3]); } } } @@ -817,7 +817,7 @@ void loop() void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) { #if NUM_DRUMS > 0 - if (activesample < 6 && seq_running == false && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor) ) // live play pitched sample + if (activesample < 6 && seq.seq_running == false && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor) ) // live play pitched sample { if (drum_counter >= NUM_DRUMS) drum_counter = 0; @@ -839,7 +839,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) else #endif //Ignore the note when playing & recording the same note into the sequencer - if (seq_recording == false || (seq_recording && inNumber != seq_note_in )) + if (seq.seq_recording == false || (seq.seq_recording && inNumber != seq.seq_note_in )) { // Check for MicroDexed for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) @@ -1761,9 +1761,9 @@ void handleStart(void) midi_bpm_timer = 0; midi_bpm_counter = 0; _midi_bpm = -1; - seq_step = 0; - seq_chain_active_step = 0; - seq_running = true; + seq.seq_step = 0; + seq.seq_chain_active_step = 0; + seq.seq_running = true; timer1.start(); } @@ -1776,11 +1776,11 @@ void handleContinue(void) void handleStop(void) { timer1.stop(); - seq_running = false; - seq_recording = false; - seq_note_in = 0; - seq_step = 0; - seq_chain_active_step = 0; + seq.seq_running = false; + seq.seq_recording = false; + seq.seq_note_in = 0; + seq.seq_step = 0; + seq.seq_chain_active_step = 0; MicroDexed[0]->panic(); #if NUM_DEXED > 1 @@ -2293,7 +2293,7 @@ void set_fx_params(void) delay_fx[instance_id]->delay(0, constrain(configuration.fx.delay_time[instance_id], DELAY_TIME_MIN, DELAY_TIME_MAX) * 10); if (configuration.fx.delay_sync[instance_id] > 0) { - uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] / seq_bpm); + uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[instance_id]] / seq.seq_bpm); delay_fx[instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX * 10)); } // REVERB SEND diff --git a/UI.hpp b/UI.hpp index 1945e7b..709fe34 100644 --- a/UI.hpp +++ b/UI.hpp @@ -41,6 +41,7 @@ #endif #include "template_mixer.hpp" #include "drumset.h" +#include "sequencer.h" #define _LCDML_DISP_cols LCD_cols #define _LCDML_DISP_rows LCD_rows @@ -72,45 +73,9 @@ extern void eeprom_update(void); #include "drums.h" extern void get_sd_performance_name_json(uint8_t number); extern bool save_sd_performance_json(uint8_t p); -extern drum_config_t drum_config[NUM_DRUMSET_CONFIG]; -extern char seq_name[FILENAME_LEN]; -extern char seq_name_temp[FILENAME_LEN]; -extern uint8_t seq_vel[NUM_SEQ_PATTERN][16]; -extern uint8_t seq_patternchain[4][NUM_SEQ_TRACKS]; -extern uint8_t seq_content_type[NUM_SEQ_PATTERN]; -extern uint8_t seq_track_type[NUM_SEQ_TRACKS]; -extern uint8_t seq_step; -extern uint8_t seq_chord_key_ammount; -extern int seq_tempo_ms; -extern int seq_bpm; -extern uint8_t seq_chain_lenght; -extern bool seq_running; -extern bool seq_recording; -extern bool smartfilter; -extern uint8_t seq_state_last_loadsave; -extern uint8_t seq_active_track; -extern uint8_t seq_menu; -extern uint8_t seq_temp_select_menu; -extern uint8_t seq_temp_active_menu; -extern uint8_t seq_chain_active_chainstep; //for editor -extern uint8_t seq_chain_active_step; -extern int seq_transpose; -extern uint8_t seq_inst_dexed[NUM_SEQ_TRACKS]; -extern uint8_t arp_step; -extern uint8_t arp_note; -extern uint8_t arp_chord; -extern uint8_t arp_octave; -extern uint8_t arp_lenght; -extern uint8_t arp_style; -extern uint8_t arp_speed; -extern uint8_t seq_element_shift; -extern int seq_oct_shift; -extern char arp_style_names[4][3]; -extern char seq_chord_names[7][4]; -extern uint8_t seq_data_buffer[16]; -extern uint8_t seq_data[NUM_SEQ_PATTERN][16]; -extern float drums_volume; extern uint8_t drum_midi_channel; +extern drum_config_t drum_config[NUM_DRUMSET_CONFIG]; +extern sequencer_t seq; uint8_t seq_active_function = 99; uint8_t activesample; #endif @@ -179,7 +144,6 @@ int temp_int; bool menu_select_toggle; float temp_float; - #ifdef I2C_DISPLAY #include Disp_Plus lcd(LCD_I2C_ADDRESS, _LCDML_DISP_cols, _LCDML_DISP_rows); @@ -557,15 +521,15 @@ void smart_filter(uint8_t dir) //search backwards if (dir == 0) { - if (smartfilter) { + if (seq.smartfilter) { do { if (found == false) activesample = constrain(activesample - 1, 0, NUM_DRUMSET_CONFIG - 2); for (uint8_t d = 0; d < 10; d++) { - if (seq_content_type[d] == 0) { + if (seq.seq_content_type[d] == 0) { for (uint8_t y = 0; y < 16; y++) { - if (drum_config[activesample].midinote == seq_data[d][y] || drum_config[activesample].midinote == seq_vel[d][y]) + if (drum_config[activesample].midinote == seq.seq_data[d][y] || drum_config[activesample].midinote == seq.seq_vel[d][y]) { found = true; break; @@ -580,16 +544,16 @@ void smart_filter(uint8_t dir) } else //search forwards { - if (smartfilter) { + if (seq.smartfilter) { do { if (found == false) activesample = constrain(activesample + 1, 0, NUM_DRUMSET_CONFIG - 2); for (uint8_t d = 0; d < 10; d++) { - if (seq_content_type[d] == 0) { + if (seq.seq_content_type[d] == 0) { for (uint8_t y = 0; y < 16; y++) { - if (drum_config[activesample].midinote == seq_data[d][y] || drum_config[activesample].midinote == seq_vel[d][y]) + if (drum_config[activesample].midinote == seq.seq_data[d][y] || drum_config[activesample].midinote == seq.seq_vel[d][y]) { found = true; break; @@ -645,11 +609,11 @@ void setup_debug_message(void) void toggle_sequencer_play_status() { - if (seq_running == false && seq_recording == false) + if (seq.seq_running == false && seq.seq_recording == false) { handleStart(); } - else if (seq_running == true && seq_recording == false) + else if (seq.seq_running == true && seq.seq_recording == false) { handleStop(); } @@ -790,11 +754,11 @@ void lcdml_menu_control(void) #endif encoderDir[ENC_R].ButtonLong(true); - // if (seq_running) { - // seq_running = false; - // seq_recording = false; - // seq_step = 0; - // seq_chain_active_step = 0; + // if (seq.seq_running) { + // seq.seq_running = false; + // seq.seq_recording = false; + // seq.seq_step = 0; + // seq.seq_chain_active_step = 0; // MicroDexed[0]->panic(); // } @@ -3656,7 +3620,7 @@ void UI_func_drums_main_volume(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - temp_int = mapfloat(drums_volume, 0.0, VOL_MAX_FLOAT, 0, 100); + temp_int = mapfloat(seq.drums_volume, 0.0, VOL_MAX_FLOAT, 0, 100); lcd.setCursor(0, 0); lcd.print(" Drums M.Volume "); } @@ -3680,7 +3644,7 @@ void UI_func_drums_main_volume(uint8_t param) lcd.print("/100"); master_mixer_r.gain (2, volume_transform(mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT))); master_mixer_l.gain (2, volume_transform(mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT))); - drums_volume = mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT); + seq.drums_volume = mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT); } if (LCDML.FUNC_close()) // ****** STABLE END ********* { @@ -3968,12 +3932,12 @@ void UI_func_arp_shift(uint8_t param) lcd.setCursor(0, 1); lcd.print("Oct"); lcd.setCursor(4, 1); - sprintf(displayname, "%02d", seq_oct_shift); + sprintf(displayname, "%02d", seq.seq_oct_shift); lcd.print(displayname); lcd.setCursor(8, 1); lcd.print("Shift"); lcd.setCursor(14, 1); - lcd.print(seq_element_shift); + lcd.print(seq.seq_element_shift); } if (LCDML.FUNC_loop()) // ****** LOOP ********* { @@ -3982,11 +3946,11 @@ void UI_func_arp_shift(uint8_t param) { if (LCDML.BT_checkDown()) { - seq_oct_shift = constrain(seq_oct_shift + ENCODER[ENC_R].speed(), -2, 2); + seq.seq_oct_shift = constrain(seq.seq_oct_shift + ENCODER[ENC_R].speed(), -2, 2); } else if (LCDML.BT_checkUp()) { - seq_oct_shift = constrain(seq_oct_shift - ENCODER[ENC_R].speed(), -2, 2); + seq.seq_oct_shift = constrain(seq.seq_oct_shift - ENCODER[ENC_R].speed(), -2, 2); } } } else { @@ -3994,11 +3958,11 @@ void UI_func_arp_shift(uint8_t param) { if (LCDML.BT_checkDown()) { - seq_element_shift = constrain(seq_element_shift + ENCODER[ENC_R].speed(), 0, 6); + seq.seq_element_shift = constrain(seq.seq_element_shift + ENCODER[ENC_R].speed(), 0, 6); } else if (LCDML.BT_checkUp()) { - seq_element_shift = constrain(seq_element_shift - ENCODER[ENC_R].speed(), 0, 6); + seq.seq_element_shift = constrain(seq.seq_element_shift - ENCODER[ENC_R].speed(), 0, 6); } } } @@ -4016,7 +3980,7 @@ void UI_func_arp_shift(uint8_t param) lcd.setCursor(6, 1); lcd.print("]"); lcd.setCursor(4, 1); - sprintf(displayname, "%02d", seq_oct_shift); + sprintf(displayname, "%02d", seq.seq_oct_shift); lcd.print(displayname); } else { @@ -4029,7 +3993,7 @@ void UI_func_arp_shift(uint8_t param) lcd.setCursor(15, 1); lcd.print("]"); lcd.setCursor(14, 1); - lcd.print(seq_element_shift); + lcd.print(seq.seq_element_shift); } } @@ -4157,11 +4121,11 @@ const char* seq_find_shortname(uint8_t sstep) { const char* shortname; bool found = false; - if (seq_content_type[seq_active_track] == 0 && seq_vel[seq_active_track][sstep] < 210) //is Drumtrack and not a pitched sample + if (seq.seq_content_type[seq.seq_active_track] == 0 && seq.seq_vel[seq.seq_active_track][sstep] < 210) //is Drumtrack and not a pitched sample { for (uint8_t d = 0; d < NUM_DRUMSET_CONFIG - 1; d++) { - if (seq_data[seq_active_track][sstep] == drum_config[d].midinote) + if (seq.seq_data[seq.seq_active_track][sstep] == drum_config[d].midinote) { shortname = drum_config[d].shortname; found = true; @@ -4171,9 +4135,9 @@ const char* seq_find_shortname(uint8_t sstep) if (found == false) shortname = "-"; } else { - if (seq_data[seq_active_track][sstep] > 0 && seq_data[seq_active_track][sstep] != 130) - shortname = noteNames[seq_data[seq_active_track][sstep] % 12]; - else if (seq_data[seq_active_track][sstep] == 130) shortname = "~"; // note has tie/latch + if (seq.seq_data[seq.seq_active_track][sstep] > 0 && seq.seq_data[seq.seq_active_track][sstep] != 130) + shortname = noteNames[seq.seq_data[seq.seq_active_track][sstep] % 12]; + else if (seq.seq_data[seq.seq_active_track][sstep] == 130) shortname = "~"; // note has tie/latch else shortname = "-"; } @@ -4195,21 +4159,21 @@ void seq_printVelGraphBar() lcd.setCursor(0, 2); for (uint8_t i = 0; i < 16; i++) { - if (seq_vel[seq_active_track][i] == 0) + if (seq.seq_vel[seq.seq_active_track][i] == 0) lcd.print(" "); - else if (seq_vel[seq_active_track][i] > 0 && seq_vel[seq_active_track][i] <= 20) + else if (seq.seq_vel[seq.seq_active_track][i] > 0 && seq.seq_vel[seq.seq_active_track][i] <= 20) lcd.write(1); - else if (seq_vel[seq_active_track][i] > 21 && seq_vel[seq_active_track][i] <= 40) + else if (seq.seq_vel[seq.seq_active_track][i] > 21 && seq.seq_vel[seq.seq_active_track][i] <= 40) lcd.write(2); - else if (seq_vel[seq_active_track][i] > 41 && seq_vel[seq_active_track][i] <= 60) + else if (seq.seq_vel[seq.seq_active_track][i] > 41 && seq.seq_vel[seq.seq_active_track][i] <= 60) lcd.write(3); - else if (seq_vel[seq_active_track][i] > 61 && seq_vel[seq_active_track][i] <= 80) + else if (seq.seq_vel[seq.seq_active_track][i] > 61 && seq.seq_vel[seq.seq_active_track][i] <= 80) lcd.write(4); - else if (seq_vel[seq_active_track][i] > 81 && seq_vel[seq_active_track][i] <= 90) + else if (seq.seq_vel[seq.seq_active_track][i] > 81 && seq.seq_vel[seq.seq_active_track][i] <= 90) lcd.write(5); - else if (seq_vel[seq_active_track][i] > 91 && seq_vel[seq_active_track][i] <= 105) + else if (seq.seq_vel[seq.seq_active_track][i] > 91 && seq.seq_vel[seq.seq_active_track][i] <= 105) lcd.write(6); - else if (seq_vel[seq_active_track][i] > 105 && seq_vel[seq_active_track][i] <= 128) + else if (seq.seq_vel[seq.seq_active_track][i] > 105 && seq.seq_vel[seq.seq_active_track][i] <= 128) lcd.write(7); else lcd.print("C"); @@ -4236,11 +4200,11 @@ void UI_func_seq_display_style(uint8_t param) { if (LCDML.BT_checkDown()) { - seq_active_track = constrain(seq_active_track + ENCODER[ENC_R].speed(), 0, NUM_SEQ_PATTERN - 1); + seq.seq_active_track = constrain(seq.seq_active_track + ENCODER[ENC_R].speed(), 0, NUM_SEQ_PATTERN - 1); } else if (LCDML.BT_checkUp()) { - seq_active_track = constrain(seq_active_track - ENCODER[ENC_R].speed(), 0, NUM_SEQ_PATTERN - 1); + seq.seq_active_track = constrain(seq.seq_active_track - ENCODER[ENC_R].speed(), 0, NUM_SEQ_PATTERN - 1); } } } else { @@ -4248,11 +4212,11 @@ void UI_func_seq_display_style(uint8_t param) { if (LCDML.BT_checkDown()) { - seq_content_type[seq_active_track] = constrain(seq_content_type[seq_active_track] + ENCODER[ENC_R].speed(), 0, 2); + seq.seq_content_type[seq.seq_active_track] = constrain(seq.seq_content_type[seq.seq_active_track] + ENCODER[ENC_R].speed(), 0, 2); } else if (LCDML.BT_checkUp()) { - seq_content_type[seq_active_track] = constrain(seq_content_type[seq_active_track] - ENCODER[ENC_R].speed(), 0, 2); + seq.seq_content_type[seq.seq_active_track] = constrain(seq.seq_content_type[seq.seq_active_track] - ENCODER[ENC_R].speed(), 0, 2); } } } @@ -4267,9 +4231,9 @@ void UI_func_seq_display_style(uint8_t param) lcd.print(" "); lcd.setCursor(4, 1); lcd.print("["); - if (seq_active_track < 10) + if (seq.seq_active_track < 10) lcd.print ("0"); - lcd.print(seq_active_track); + lcd.print(seq.seq_active_track); lcd.print("]"); } else { lcd.setCursor(4, 1); @@ -4282,9 +4246,9 @@ void UI_func_seq_display_style(uint8_t param) lcd.print("]"); } lcd.setCursor(11, 1); - if (seq_content_type[seq_active_track] == 0) + if (seq.seq_content_type[seq.seq_active_track] == 0) lcd.print("Drum"); - else if (seq_content_type[seq_active_track] == 1) + else if (seq.seq_content_type[seq.seq_active_track] == 1) lcd.print("Inst"); else lcd.print("Chrd"); @@ -4304,8 +4268,8 @@ void UI_func_seq_live_transpose_oct(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - getNoteName(note_name, seq_transpose); - getNoteName(note_name2, seq_transpose + 12); + getNoteName(note_name, seq.seq_transpose); + getNoteName(note_name2, seq.seq_transpose + 12); lcd.setCursor(0, 0); lcd.print(F("Live Transp.Oct.")); lcd.setCursor(0, 1); @@ -4321,12 +4285,12 @@ void UI_func_seq_live_transpose_oct(uint8_t param) 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_transpose = constrain(seq_transpose + ENCODER[ENC_R].speed(), 24, 60); + seq.seq_transpose = constrain(seq.seq_transpose + ENCODER[ENC_R].speed(), 24, 60); else if (LCDML.BT_checkUp()) - seq_transpose = constrain(seq_transpose - ENCODER[ENC_R].speed(), 24, 60); + seq.seq_transpose = constrain(seq.seq_transpose - ENCODER[ENC_R].speed(), 24, 60); } - getNoteName(note_name, seq_transpose); - getNoteName(note_name2, seq_transpose + 12); + getNoteName(note_name, seq.seq_transpose); + getNoteName(note_name2, seq.seq_transpose + 12); lcd.setCursor(0, 1); lcd.print(F("[")); lcd.print(note_name); @@ -4357,13 +4321,13 @@ void UI_func_seq_chord_keys_ammount(uint8_t param) 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_chord_key_ammount = constrain(seq_chord_key_ammount + ENCODER[ENC_R].speed(), 1, 7); + seq.seq_chord_key_ammount = constrain(seq.seq_chord_key_ammount + ENCODER[ENC_R].speed(), 1, 7); else if (LCDML.BT_checkUp()) - seq_chord_key_ammount = constrain(seq_chord_key_ammount - ENCODER[ENC_R].speed(), 1, 7); + seq.seq_chord_key_ammount = constrain(seq.seq_chord_key_ammount - ENCODER[ENC_R].speed(), 1, 7); } lcd.setCursor(4, 1); lcd.print("["); - sprintf(displayname, "%02d", seq_chord_key_ammount); + sprintf(displayname, "%02d", seq.seq_chord_key_ammount); lcd.print(displayname); lcd.print("]"); } @@ -4386,12 +4350,12 @@ void UI_func_seq_lenght(uint8_t param) 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_chain_lenght = constrain(seq_chain_lenght + ENCODER[ENC_R].speed(), 0, 3); + seq.seq_chain_lenght = constrain(seq.seq_chain_lenght + ENCODER[ENC_R].speed(), 0, 3); else if (LCDML.BT_checkUp()) - seq_chain_lenght = constrain(seq_chain_lenght - ENCODER[ENC_R].speed(), 0, 3); + seq.seq_chain_lenght = constrain(seq.seq_chain_lenght - ENCODER[ENC_R].speed(), 0, 3); } lcd.setCursor(3, 1); - lcd.print((seq_chain_lenght + 1) * 16 ); + lcd.print((seq.seq_chain_lenght + 1) * 16 ); lcd.setCursor(7, 1); lcd.print("Steps"); } @@ -4419,29 +4383,29 @@ void UI_func_seq_tempo(uint8_t param) 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(), 50, 190); + seq.seq_bpm = constrain(seq.seq_bpm + ENCODER[ENC_R].speed(), 50, 190); else if (LCDML.BT_checkUp()) - seq_bpm = constrain(seq_bpm - ENCODER[ENC_R].speed(), 50, 190); + seq.seq_bpm = constrain(seq.seq_bpm - ENCODER[ENC_R].speed(), 50, 190); } - seq_tempo_ms = 60000000 / seq_bpm / 4; + seq.seq_tempo_ms = 60000000 / seq.seq_bpm / 4; lcd.setCursor(0, 1); - sprintf(tmp, "[%3d]", seq_bpm); + sprintf(tmp, "[%3d]", seq.seq_bpm); lcd.print(tmp); lcd.setCursor(11, 1); - sprintf(tmp, "%3d", seq_tempo_ms / 1000); + sprintf(tmp, "%3d", seq.seq_tempo_ms / 1000); lcd.print(tmp); #ifdef USE_FX for (uint8_t i = 0; i < MAX_DEXED; i++) { if (configuration.fx.delay_sync[i] > 0) { - uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[i]] / seq_bpm); + uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[configuration.fx.delay_sync[i]] / seq.seq_bpm); delay_fx[i]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX * 10)); } } #endif //timer1.stop(); - timer1.begin(sequencer, seq_tempo_ms / 2); + timer1.begin(sequencer, seq.seq_tempo_ms / 2); } if (LCDML.FUNC_close()) // ****** STABLE END ********* { @@ -4458,15 +4422,15 @@ void UI_func_seq_vel_editor(uint8_t param) encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); lcd.print("V:"); - sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]); + sprintf(tmp, "%03d", seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1]); lcd.setCursor(2, 0); lcd.print(tmp); lcd.setCursor(12, 0); lcd.print("["); lcd.setCursor(13, 0); - if (seq_active_track < 10) + if (seq.seq_active_track < 10) lcd.print("0"); - lcd.print(seq_active_track); + lcd.print(seq.seq_active_track); lcd.setCursor(15, 0); lcd.print("]"); @@ -4479,9 +4443,9 @@ void UI_func_seq_vel_editor(uint8_t param) 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); + seq.seq_menu = constrain(seq.seq_menu + 1, 0, 16); else if (LCDML.BT_checkUp()) - seq_menu = constrain(seq_menu - 1, 0, 16); + seq.seq_menu = constrain(seq.seq_menu - 1, 0, 16); } } else if (seq_active_function == 0) @@ -4489,33 +4453,33 @@ void UI_func_seq_vel_editor(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, NUM_SEQ_PATTERN - 1); + seq.seq_active_track = constrain(seq.seq_active_track + 1, 0, NUM_SEQ_PATTERN - 1); else if (LCDML.BT_checkUp()) - seq_active_track = constrain(seq_active_track - 1, 0, NUM_SEQ_PATTERN - 1); + seq.seq_active_track = constrain(seq.seq_active_track - 1, 0, NUM_SEQ_PATTERN - 1); } } - if ( seq_data[seq_active_track][seq_menu - 1] > 0 ) + if ( seq.seq_data[seq.seq_active_track][seq.seq_menu - 1] > 0 ) { - if (seq_vel[seq_active_track][seq_menu - 1] < 210) //it is a normal sample + if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] < 210) //it is a normal sample { - if (seq_active_function == 1 && seq_content_type[seq_active_track] < 2 ) + if (seq_active_function == 1 && seq.seq_content_type[seq.seq_active_track] < 2 ) { //if is Drum or normal Instrument Track 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); + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] = constrain(seq.seq_vel[seq.seq_active_track][seq.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); + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] = constrain(seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] - 1, 0, 127); } } - else if (seq_active_function == 1 && seq_content_type[seq_active_track] > 1 ) + else if (seq_active_function == 1 && seq.seq_content_type[seq.seq_active_track] > 1 ) { //is in Chord or Arp Mode 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, 200, 205); + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] = constrain(seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] + 1, 200, 205); else if (LCDML.BT_checkUp()) - seq_vel[seq_active_track][seq_menu - 1] = constrain(seq_vel[seq_active_track][seq_menu - 1] - 1, 200, 205); + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] = constrain(seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] - 1, 200, 205); } } } @@ -4525,22 +4489,22 @@ void UI_func_seq_vel_editor(uint8_t param) 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, 210, 215); + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] = constrain(seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] + 1, 210, 215); else if (LCDML.BT_checkUp()) - seq_vel[seq_active_track][seq_menu - 1] = constrain(seq_vel[seq_active_track][seq_menu - 1] - 1, 210, 215); + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] = constrain(seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] - 1, 210, 215); } } } if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> { - if ( seq_menu == 0 && seq_active_function == 99) + if ( seq.seq_menu == 0 && seq_active_function == 99) { seq_active_function = 0; - } else if ( seq_menu == 0 && seq_active_function == 0) + } else if ( seq.seq_menu == 0 && seq_active_function == 0) { seq_active_function = 99; } - else if (seq_menu > 0 && seq_active_function == 99) + else if (seq.seq_menu > 0 && seq_active_function == 99) { seq_active_function = 1; } @@ -4548,47 +4512,47 @@ void UI_func_seq_vel_editor(uint8_t param) seq_active_function = 99; } //button check end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - if ( seq_content_type[seq_active_track] > 1 && seq_vel[seq_active_track][seq_menu - 1] < 200) seq_vel[seq_active_track][seq_menu - 1] = 200; + if ( seq.seq_content_type[seq.seq_active_track] > 1 && seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] < 200) seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] = 200; if (seq_active_function == 0) { lcd.setCursor(0, 0); - if (seq_content_type[seq_active_track] == 0) + if (seq.seq_content_type[seq.seq_active_track] == 0) lcd.print("Drum Track "); - else if (seq_content_type[seq_active_track] == 1) + else if (seq.seq_content_type[seq.seq_active_track] == 1) lcd.print("Instr. Track "); else lcd.print("Chord Track "); } - if (seq_menu > 0 && seq_content_type[seq_active_track] == 0) + if (seq.seq_menu > 0 && seq.seq_content_type[seq.seq_active_track] == 0) { lcd.setCursor(0, 0); - if (seq_vel[seq_active_track][seq_menu - 1] < 210 && seq_vel[seq_active_track][seq_menu - 1] > 0) //it is a normal sample + if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] < 210 && seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] > 0) //it is a normal sample { lcd.print("V:"); - sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]); + sprintf(tmp, "%03d", seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1]); lcd.setCursor(2, 0); lcd.print(tmp); } else { // else it is a live-pitched sample - if (seq_vel[seq_active_track][seq_menu - 1] > 0) { + if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] > 0) { lcd.setCursor(0, 0); lcd.print("Smp:["); lcd.setCursor(12, 0); lcd.print("]"); - lcd.show(0, 5, 7, basename(drum_config[seq_vel[seq_active_track][seq_menu - 1] - 210].name)); + lcd.show(0, 5, 7, basename(drum_config[seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] - 210].name)); } } } - if (seq_menu == 0) { + if (seq.seq_menu == 0) { lcd.setCursor(12, 0); lcd.print("["); - if (seq_active_track < 10) + if (seq.seq_active_track < 10) lcd.print("0"); - lcd.print(seq_active_track); + lcd.print(seq.seq_active_track); lcd.print("]"); lcd.setCursor(0, 1); seq_printAllSeqSteps(); - } else if (seq_menu == 1) { + } else if (seq.seq_menu == 1) { lcd.setCursor(12, 0); lcd.print(" "); lcd.setCursor(15, 0); @@ -4597,38 +4561,38 @@ void UI_func_seq_vel_editor(uint8_t param) lcd.write(219); // cursor symbol lcd.setCursor(1, 1); lcd.print(seq_find_shortname(1)[0] ); - if (seq_vel[seq_active_track][seq_menu - 1] < 210 && seq_content_type[seq_active_track] < 2) //it is a normal sample + if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] < 210 && seq.seq_content_type[seq.seq_active_track] < 2) //it is a normal sample { - sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]); + sprintf(tmp, "%03d", seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1]); lcd.setCursor(2, 0); lcd.print(tmp); } - } else if (seq_menu > 1) + } else if (seq.seq_menu > 1) { - lcd.setCursor(seq_menu - 1, 1); + lcd.setCursor(seq.seq_menu - 1, 1); lcd.write(219); // cursor symbol - lcd.setCursor(seq_menu - 2, 1); - lcd.print(seq_find_shortname(seq_menu - 2)[0] ); - if (seq_menu < 16) { - lcd.setCursor(seq_menu , 1); - lcd.print(seq_find_shortname(seq_menu)[0] ); + lcd.setCursor(seq.seq_menu - 2, 1); + lcd.print(seq_find_shortname(seq.seq_menu - 2)[0] ); + if (seq.seq_menu < 16) { + lcd.setCursor(seq.seq_menu , 1); + lcd.print(seq_find_shortname(seq.seq_menu)[0] ); } } - if (seq_menu > 0) { + if (seq.seq_menu > 0) { lcd.setCursor(4, 0); - if (seq_data[seq_active_track][seq_menu - 1] > 0) + if (seq.seq_data[seq.seq_active_track][seq.seq_menu - 1] > 0) { - if (seq_content_type[seq_active_track] == 0) //is Drumtrack + if (seq.seq_content_type[seq.seq_active_track] == 0) //is Drumtrack { lcd.setCursor(0, 0); - if (seq_vel[seq_active_track][seq_menu - 1] < 210) //it is a normal sample + if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] < 210) //it is a normal sample { lcd.print("V:"); - sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]); + sprintf(tmp, "%03d", seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1]); lcd.print(tmp); //lcd.setCursor(7, 0); //lcd.print(" "); - lcd.show(0, 6, 5, seq_find_drum_name_from_note( seq_data[seq_active_track][seq_menu - 1]) ); + lcd.show(0, 6, 5, seq_find_drum_name_from_note( seq.seq_data[seq.seq_active_track][seq.seq_menu - 1]) ); } else { // else it is a live-pitched sample @@ -4637,27 +4601,27 @@ void UI_func_seq_vel_editor(uint8_t param) lcd.setCursor(12, 0); lcd.print("]"); lcd.setCursor(1, 0); - lcd.show(0, 5, 7, basename(drum_config[seq_vel[seq_active_track][seq_menu - 1] - 210].name)); + lcd.show(0, 5, 7, basename(drum_config[seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] - 210].name)); } } else { - if ( seq_data[seq_active_track][seq_menu - 1] != 130 ) //note not latched + if ( seq.seq_data[seq.seq_active_track][seq.seq_menu - 1] != 130 ) //note not latched { - if (seq_content_type[seq_active_track] < 2) + if (seq.seq_content_type[seq.seq_active_track] < 2) { lcd.setCursor(0, 0); lcd.print("Vel:"); - sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]); + sprintf(tmp, "%03d", seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1]); lcd.setCursor(4, 0); lcd.print(tmp); lcd.print(" "); } lcd.setCursor(8, 0); - lcd.print(noteNames[seq_data[seq_active_track][seq_menu - 1] % 12 ][0] ); - if (noteNames[seq_data[seq_active_track][seq_menu - 1] % 12 ][1] != '\0' ) { - lcd.print(noteNames[seq_data[seq_active_track][seq_menu - 1] % 12 ][1] ); + lcd.print(noteNames[seq.seq_data[seq.seq_active_track][seq.seq_menu - 1] % 12 ][0] ); + if (noteNames[seq.seq_data[seq.seq_active_track][seq.seq_menu - 1] % 12 ][1] != '\0' ) { + lcd.print(noteNames[seq.seq_data[seq.seq_active_track][seq.seq_menu - 1] % 12 ][1] ); } - lcd.print( (seq_data[seq_active_track][seq_menu - 1] / 12) - 1); + lcd.print( (seq.seq_data[seq.seq_active_track][seq.seq_menu - 1] / 12) - 1); lcd.print(" "); } else @@ -4665,15 +4629,15 @@ void UI_func_seq_vel_editor(uint8_t param) lcd.setCursor(0, 0); lcd.print("latched note "); } - if (seq_content_type[seq_active_track] > 1) + if (seq.seq_content_type[seq.seq_active_track] > 1) { lcd.setCursor(0, 0); - if (seq_vel[seq_active_track][seq_menu - 1] == 200) lcd.print("Major " ); - else if (seq_vel[seq_active_track][seq_menu - 1] == 201) lcd.print("Minor " ); - else if (seq_vel[seq_active_track][seq_menu - 1] == 202) lcd.print("Seven " ); - else if (seq_vel[seq_active_track][seq_menu - 1] == 203) lcd.print("Aug " ); - else if (seq_vel[seq_active_track][seq_menu - 1] == 204) lcd.print("Dim " ); - else if (seq_vel[seq_active_track][seq_menu - 1] == 205) lcd.print("Major7 " ); + if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] == 200) lcd.print("Major " ); + else if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] == 201) lcd.print("Minor " ); + else if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] == 202) lcd.print("Seven " ); + else if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] == 203) lcd.print("Aug " ); + else if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] == 204) lcd.print("Dim " ); + else if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 1] == 205) lcd.print("Major7 " ); } } } @@ -4692,21 +4656,21 @@ void UI_func_seq_vel_editor(uint8_t param) void seq_clear_active_pattern() { - 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])); + memset(seq.seq_data[seq.seq_active_track], 0, sizeof(seq.seq_data[seq.seq_active_track])); + memset(seq.seq_vel[seq.seq_active_track], 0, sizeof(seq.seq_vel[seq.seq_active_track])); } void seq_clear_all_patterns() { for (uint8_t i = 0; i < NUM_SEQ_PATTERN - 1; i++) { - memset(seq_data[i], 0, sizeof(seq_data[i])); - memset(seq_vel[i], 0, sizeof(seq_vel[i])); + memset(seq.seq_data[i], 0, sizeof(seq.seq_data[i])); + memset(seq.seq_vel[i], 0, sizeof(seq.seq_vel[i])); } } void seq_refresh_display_play_status() { - if (seq_running == false && seq_recording == false) + if (seq.seq_running == false && seq.seq_recording == false) { lcd.createChar(0, (uint8_t*)special_chars[19]); //play symbol #ifdef TESTDISPLAY20x4 @@ -4715,9 +4679,9 @@ void seq_refresh_display_play_status() lcd.setCursor(10, 0); #endif lcd.write(0); - } else if (seq_running == true && seq_recording == false) + } else if (seq.seq_running == true && seq.seq_recording == false) { - seq_note_in = 0; + seq.seq_note_in = 0; lcd.createChar(0, (uint8_t*)special_chars[20]); //record symbol #ifdef TESTDISPLAY20x4 lcd.setCursor(14, 0); @@ -4725,9 +4689,9 @@ void seq_refresh_display_play_status() lcd.setCursor(10, 0); #endif lcd.write(0); - } else if (seq_running == true && seq_recording == true) + } else if (seq.seq_running == true && seq.seq_recording == true) { - seq_note_in = 0; + seq.seq_note_in = 0; lcd.createChar(0, (uint8_t*)special_chars[21]); //stop symbol #ifdef TESTDISPLAY20x4 lcd.setCursor(14, 0); @@ -4740,14 +4704,14 @@ void seq_refresh_display_play_status() void arp_refresh_display_play_status() { - if (seq_running == false ) + if (seq.seq_running == false ) { lcd.createChar(0, (uint8_t*)special_chars[19]); //play symbol lcd.setCursor(13, 0); lcd.write(0); - } else if (seq_running == true ) + } else if (seq.seq_running == true ) { - seq_note_in = 0; + seq.seq_note_in = 0; lcd.createChar(0, (uint8_t*)special_chars[21]); //stop symbol lcd.setCursor(13, 0); lcd.write(0); @@ -4755,12 +4719,12 @@ void arp_refresh_display_play_status() } void seq_print_current_note() { - lcd.print(noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][0] ); - if (noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][1] != '\0' ) + lcd.print(noteNames[seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] % 12 ][0] ); + if (noteNames[seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] % 12 ][1] != '\0' ) { - lcd.print(noteNames[seq_data[seq_active_track][seq_menu - 3] % 12 ][1] ); + lcd.print(noteNames[seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] % 12 ][1] ); } - lcd.print( (seq_data[seq_active_track][seq_menu - 3] / 12) - 1); + lcd.print( (seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] / 12) - 1); lcd.print(" "); } void check_variable_samples_basespeed() @@ -4786,9 +4750,9 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.createChar(6, (uint8_t*)special_chars[14]); //bar graph lcd.createChar(7, (uint8_t*)special_chars[15]); //bar graph #endif - temp_int = seq_data[seq_active_track][0]; + temp_int = seq.seq_data[seq.seq_active_track][0]; encoderDir[ENC_R].reset(); - seq_note_in = 0; + seq.seq_note_in = 0; // setup function seq_refresh_display_play_status(); #ifdef TESTDISPLAY20x4 @@ -4796,8 +4760,8 @@ void UI_func_seq_pattern_editor(uint8_t param) #else lcd.setCursor(13, 0); #endif - if (seq_active_track < 10)lcd.print("0"); - lcd.print(seq_active_track); + if (seq.seq_active_track < 10)lcd.print("0"); + lcd.print(seq.seq_active_track); seq_printAllSeqSteps(); #ifdef TESTDISPLAY20x4 seq_printVelGraphBar(); @@ -4809,35 +4773,35 @@ void UI_func_seq_pattern_editor(uint8_t param) if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) { - seq_data[seq_active_track][seq_menu - 3] = constrain(seq_data[seq_active_track][seq_menu - 3] + 1, 1, 108); + seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = constrain(seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] + 1, 1, 108); } else if (LCDML.BT_checkUp()) { - seq_data[seq_active_track][seq_menu - 3] = constrain(seq_data[seq_active_track][seq_menu - 3] - 1, 1, 108); + seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = constrain(seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] - 1, 1, 108); } } } - else if (seq_menu == 33) { // is in sub-function - fill pattern + else if (seq.seq_menu == 33) { // is in sub-function - fill pattern seq_active_function = 95; if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) { - seq_temp_active_menu = constrain(seq_temp_active_menu + 1, 0, 3); + seq.seq_temp_active_menu = constrain(seq.seq_temp_active_menu + 1, 0, 3); } else if (LCDML.BT_checkUp()) { - seq_temp_active_menu = constrain(seq_temp_active_menu - 1, 0, 3); + seq.seq_temp_active_menu = constrain(seq.seq_temp_active_menu - 1, 0, 3); } } } - else if (seq_menu == 32) { // is in sub-function - fill pattern + else if (seq.seq_menu == 32) { // is in sub-function - fill pattern seq_active_function = 97; - if (seq_content_type[seq_active_track] == 0) { + if (seq.seq_content_type[seq.seq_active_track] == 0) { 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, NUM_DRUMSET_CONFIG - 1); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu + 1, 0, NUM_DRUMSET_CONFIG - 1); } else if (LCDML.BT_checkUp()) { - seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, NUM_DRUMSET_CONFIG - 1); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu - 1, 0, NUM_DRUMSET_CONFIG - 1); } } } @@ -4846,30 +4810,30 @@ void UI_func_seq_pattern_editor(uint8_t param) 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, 108 ); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu + 1, 0, 108 ); else if (LCDML.BT_checkUp()) - seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, 108 ); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu - 1, 0, 108 ); } } } - else if (seq_menu == 30 || seq_menu == 31 ) { // is in sub-function - swap pattern or copy pattern + else if (seq.seq_menu == 30 || seq.seq_menu == 31 ) { // is in sub-function - swap pattern or copy pattern seq_active_function = 98; if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) { temp_int = constrain(temp_int + 1, 0, NUM_SEQ_PATTERN - 1); - if (temp_int == seq_active_track)temp_int++; + if (temp_int == seq.seq_active_track)temp_int++; if (temp_int > NUM_SEQ_PATTERN - 1)temp_int = 0; } else if (LCDML.BT_checkUp()) { temp_int = constrain(temp_int - 1, 0, NUM_SEQ_PATTERN - 1); - if (temp_int == seq_active_track)temp_int--; + if (temp_int == seq.seq_active_track)temp_int--; if (temp_int < 0)temp_int = NUM_SEQ_PATTERN - 1; } } } - else if (seq_menu == 34) { // is in transpose edit + else if (seq.seq_menu == 34) { // is in transpose edit seq_active_function = 94; if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { @@ -4888,13 +4852,13 @@ void UI_func_seq_pattern_editor(uint8_t param) 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, 18); + seq.seq_menu = constrain(seq.seq_menu + 1, 0, 18); else if (LCDML.BT_checkUp()) - seq_menu = constrain(seq_menu - 1, 0, 18); + seq.seq_menu = constrain(seq.seq_menu - 1, 0, 18); } } else if (seq_active_function == 0 ) { - if (seq_content_type[seq_active_track] == 0) // is in Drumedit mode + if (seq.seq_content_type[seq.seq_active_track] == 0) // is in Drumedit mode { if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { @@ -4919,17 +4883,17 @@ void UI_func_seq_pattern_editor(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, NUM_SEQ_PATTERN - 1); + seq.seq_active_track = constrain(seq.seq_active_track + 1, 0, NUM_SEQ_PATTERN - 1); else if (LCDML.BT_checkUp()) - seq_active_track = constrain(seq_active_track - 1, 0, NUM_SEQ_PATTERN - 1); + seq.seq_active_track = constrain(seq.seq_active_track - 1, 0, NUM_SEQ_PATTERN - 1); lcd.setCursor(1, 0); - if (seq_content_type[seq_active_track] == 0) lcd.print("Drum "); else if (seq_content_type[seq_active_track] == 1) lcd.print("Instr "); else if (seq_content_type[seq_active_track] == 2) lcd.print("Chord "); else lcd.print("Arp "); + if (seq.seq_content_type[seq.seq_active_track] == 0) lcd.print("Drum "); else if (seq.seq_content_type[seq.seq_active_track] == 1) lcd.print("Instr "); else if (seq.seq_content_type[seq.seq_active_track] == 2) lcd.print("Chord "); else lcd.print("Arp "); } } if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> { - if (seq_menu > 2 && seq_menu < 19 && seq_vel[seq_active_track][seq_menu - 3] > 209 && seq_active_function != 40 && activesample != NUM_DRUMSET_CONFIG - 1) //edit pitch of sample + if (seq.seq_menu > 2 && seq.seq_menu < 19 && seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] > 209 && seq_active_function != 40 && activesample != NUM_DRUMSET_CONFIG - 1) //edit pitch of sample { seq_active_function = 40; } else if ( seq_active_function == 40 ) // get out of pitch edit for samples @@ -4940,161 +4904,161 @@ void UI_func_seq_pattern_editor(uint8_t param) activesample = 0; seq_refresh_display_play_status(); seq_printAllSeqSteps(); - } else if (seq_menu == 34 ) //transpose pattern + } else if (seq.seq_menu == 34 ) //transpose pattern { - seq_menu = 0; + seq.seq_menu = 0; seq_active_function = 0; activesample = 0; - temp_int = seq_data[seq_active_track][0]; + temp_int = seq.seq_data[seq.seq_active_track][0]; lcd.setCursor(8, 0); lcd.print(" "); lcd.setCursor(12, 0); lcd.print(" "); lcd.setCursor(13, 0); - if (seq_active_track < 10)lcd.print("0"); - lcd.print(seq_active_track); + if (seq.seq_active_track < 10)lcd.print("0"); + lcd.print(seq.seq_active_track); seq_refresh_display_play_status(); seq_printAllSeqSteps(); } - else if (seq_menu == 32 && seq_active_function == 97) //fill pattern every 1/4, 1/8, 1/16 step with active sample/note step 1 + else if (seq.seq_menu == 32 && seq_active_function == 97) //fill pattern every 1/4, 1/8, 1/16 step with active sample/note step 1 { seq_active_function = 96; - seq_menu = 33; - } else if (seq_menu == 33 && seq_active_function == 95) //fill pattern every 1/4, 1/8, 1/16 step with active sample/note step 2 + seq.seq_menu = 33; + } else if (seq.seq_menu == 33 && seq_active_function == 95) //fill pattern every 1/4, 1/8, 1/16 step with active sample/note step 2 { - if (seq_content_type[seq_active_track] == 0) { //Drumtrack + if (seq.seq_content_type[seq.seq_active_track] == 0) { //Drumtrack for (uint8_t i = 0; i < 16; i++) { - seq_data[seq_active_track][i] = drum_config[seq_temp_select_menu].midinote; - seq_vel[seq_active_track][i] = 120; - if (seq_temp_active_menu == 0) i = i + 3; else if (seq_temp_active_menu == 1) i = i + 1; + seq.seq_data[seq.seq_active_track][i] = drum_config[seq.seq_temp_select_menu].midinote; + seq.seq_vel[seq.seq_active_track][i] = 120; + if (seq.seq_temp_active_menu == 0) i = i + 3; else if (seq.seq_temp_active_menu == 1) i = i + 1; } } else { //Inst. Track for (uint8_t i = 0; i < 16; i++) { - seq_data[seq_active_track][i] = seq_temp_select_menu; - seq_vel[seq_active_track][i] = 120; - if (seq_temp_active_menu == 0) i = i + 3; else if (seq_temp_active_menu == 1) i = i + 1; + seq.seq_data[seq.seq_active_track][i] = seq.seq_temp_select_menu; + seq.seq_vel[seq.seq_active_track][i] = 120; + if (seq.seq_temp_active_menu == 0) i = i + 3; else if (seq.seq_temp_active_menu == 1) i = i + 1; } } - seq_menu = 0; + seq.seq_menu = 0; seq_active_function = 0; activesample = 0; - temp_int = seq_data[seq_active_track][0]; + temp_int = seq.seq_data[seq.seq_active_track][0]; lcd.setCursor(8, 0); lcd.print(" "); seq_refresh_display_play_status(); seq_printAllSeqSteps(); - } else if (seq_menu == 31 && seq_active_function != 40) //copy patterns + } else if (seq.seq_menu == 31 && seq_active_function != 40) //copy patterns { - memcpy( seq_data[temp_int], seq_data[seq_active_track], sizeof(seq_data[0])); - memcpy( seq_vel[temp_int], seq_vel[seq_active_track], sizeof(seq_vel[0])); - seq_content_type[temp_int] = seq_content_type[seq_active_track]; - seq_menu = 0; + memcpy( seq.seq_data[temp_int], seq.seq_data[seq.seq_active_track], sizeof(seq.seq_data[0])); + memcpy( seq.seq_vel[temp_int], seq.seq_vel[seq.seq_active_track], sizeof(seq.seq_vel[0])); + seq.seq_content_type[temp_int] = seq.seq_content_type[seq.seq_active_track]; + seq.seq_menu = 0; seq_active_function = 0; activesample = 0; - temp_int = seq_data[seq_active_track][0]; + temp_int = seq.seq_data[seq.seq_active_track][0]; lcd.setCursor(8, 0); lcd.print(" "); seq_refresh_display_play_status(); seq_printAllSeqSteps(); - } else if (seq_menu == 30 && seq_active_function != 40) //swap patterns + } else if (seq.seq_menu == 30 && seq_active_function != 40) //swap patterns { uint8_t data_temp[1][16]; uint8_t vel_temp[1][16]; uint8_t content_type_temp; - memcpy( data_temp[0], seq_data[seq_active_track], sizeof(data_temp[0])); - memcpy( vel_temp[0], seq_vel[seq_active_track], sizeof(vel_temp[0])); - content_type_temp = seq_content_type[seq_active_track]; - memcpy( seq_data[seq_active_track], seq_data[temp_int], sizeof(data_temp[0])); - memcpy( seq_vel[seq_active_track], seq_vel[temp_int], sizeof(vel_temp[0])); - seq_content_type[seq_active_track] = seq_content_type[temp_int]; - memcpy( seq_data[temp_int], data_temp[0], sizeof(data_temp[0])); - memcpy( seq_vel[temp_int], vel_temp[0], sizeof(vel_temp[0])); - seq_content_type[temp_int] = content_type_temp; - seq_menu = 0; + memcpy( data_temp[0], seq.seq_data[seq.seq_active_track], sizeof(data_temp[0])); + memcpy( vel_temp[0], seq.seq_vel[seq.seq_active_track], sizeof(vel_temp[0])); + content_type_temp = seq.seq_content_type[seq.seq_active_track]; + memcpy( seq.seq_data[seq.seq_active_track], seq.seq_data[temp_int], sizeof(data_temp[0])); + memcpy( seq.seq_vel[seq.seq_active_track], seq.seq_vel[temp_int], sizeof(vel_temp[0])); + seq.seq_content_type[seq.seq_active_track] = seq.seq_content_type[temp_int]; + memcpy( seq.seq_data[temp_int], data_temp[0], sizeof(data_temp[0])); + memcpy( seq.seq_vel[temp_int], vel_temp[0], sizeof(vel_temp[0])); + seq.seq_content_type[temp_int] = content_type_temp; + seq.seq_menu = 0; seq_active_function = 0; activesample = 0; lcd.setCursor(8, 0); lcd.print(" "); - temp_int = seq_data[seq_active_track][0]; + temp_int = seq.seq_data[seq.seq_active_track][0]; seq_refresh_display_play_status(); seq_printAllSeqSteps(); } - if ( seq_menu == 0 && seq_active_function == 99) + if ( seq.seq_menu == 0 && seq_active_function == 99) { seq_active_function = 0; - } else if ( seq_menu == 0 && seq_active_function == 0) + } else if ( seq.seq_menu == 0 && seq_active_function == 0) { - if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 5) || (seq_content_type[seq_active_track] > 0 && temp_int == 116) ) + if ( (seq.seq_content_type[seq.seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 5) || (seq.seq_content_type[seq.seq_active_track] > 0 && temp_int == 116) ) { //transpose pattern lcd.setCursor(0, 0); lcd.print("Transpose:[ 00]"); for (uint8_t i = 0; i < 16; i++) { - seq_data_buffer[i] = seq_data[seq_active_track][i]; + seq.seq_data_buffer[i] = seq.seq_data[seq.seq_active_track][i]; } - seq_menu = 34; + seq.seq_menu = 34; temp_int = 0; - seq_temp_select_menu = 0; - seq_temp_active_menu = 0; + seq.seq_temp_select_menu = 0; + seq.seq_temp_active_menu = 0; } - if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 4) || (seq_content_type[seq_active_track] > 0 && temp_int == 115) ) + if ( (seq.seq_content_type[seq.seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 4) || (seq.seq_content_type[seq.seq_active_track] > 0 && temp_int == 115) ) { //fill patterns lcd.setCursor(0, 0); lcd.print("Fill Pattern:"); lcd.setCursor(9, 1); lcd.print(" "); - seq_menu = 32; - seq_temp_select_menu = 0; - seq_temp_active_menu = 0; + seq.seq_menu = 32; + seq.seq_temp_select_menu = 0; + seq.seq_temp_active_menu = 0; } - else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 3) || (seq_content_type[seq_active_track] > 0 && temp_int == 114) ) + else if ( (seq.seq_content_type[seq.seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 3) || (seq.seq_content_type[seq.seq_active_track] > 0 && temp_int == 114) ) { //swap patterns: Active pattern <-> destination pattern lcd.setCursor(0, 0); lcd.print("SwapPattern:"); - temp_int = seq_active_track + 1; + temp_int = seq.seq_active_track + 1; if (temp_int > NUM_SEQ_PATTERN - 1)temp_int = 0; - seq_menu = 30; - } else if ( ( seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 2) || ( seq_content_type[seq_active_track] > 0 && temp_int == 113) ) + seq.seq_menu = 30; + } else if ( ( seq.seq_content_type[seq.seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 2) || ( seq.seq_content_type[seq.seq_active_track] > 0 && temp_int == 113) ) { //copy pattern lcd.setCursor(0, 0); lcd.print("Copy Pattern:"); - temp_int = seq_active_track + 1; + temp_int = seq.seq_active_track + 1; if (temp_int > NUM_SEQ_PATTERN - 1)temp_int = 0; - seq_menu = 31; - } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 1) || (seq_content_type[seq_active_track] > 0 && temp_int == 112) ) + seq.seq_menu = 31; + } else if ( (seq.seq_content_type[seq.seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 1) || (seq.seq_content_type[seq.seq_active_track] > 0 && temp_int == 112) ) { //clear all patterns seq_clear_all_patterns(); seq_printAllSeqSteps(); - } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG) || (seq_content_type[seq_active_track] > 0 && temp_int == 111) ) + } else if ( (seq.seq_content_type[seq.seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG) || (seq.seq_content_type[seq.seq_active_track] > 0 && temp_int == 111) ) { //clear pattern seq_clear_active_pattern(); seq_printAllSeqSteps(); } seq_active_function = 99; } - if ( seq_menu == 1 && seq_active_function != 40) + if ( seq.seq_menu == 1 && seq_active_function != 40) { - if (seq_running == false && seq_recording == false) + if (seq.seq_running == false && seq.seq_recording == false) { handleStart(); - } else if (seq_running == true && seq_recording == false) + } else if (seq.seq_running == true && seq.seq_recording == false) { - seq_running = true; - seq_recording = true; - seq_note_in = 0; - } else if (seq_running == true && seq_recording == true) + seq.seq_running = true; + seq.seq_recording = true; + seq.seq_note_in = 0; + } else if (seq.seq_running == true && seq.seq_recording == true) { handleStop(); } - } else if ( seq_menu == 2 && seq_active_function != 40) + } else if ( seq.seq_menu == 2 && seq_active_function != 40) { if (seq_active_function != 2) seq_active_function = 2; else seq_active_function = 99; - if (seq_content_type[seq_active_track] == 0) + if (seq.seq_content_type[seq.seq_active_track] == 0) { if (activesample < NUM_DRUMSET_CONFIG - 1) lcd.show(0, 1, 6, basename(drum_config[activesample].name)); @@ -5108,49 +5072,49 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.print( (temp_int / 12) - 1); } } - } else if (seq_menu > 2 && seq_menu < 30 && seq_active_function != 40) + } else if (seq.seq_menu > 2 && seq.seq_menu < 30 && seq_active_function != 40) { if (seq_active_function == 99) { - if (seq_content_type[seq_active_track] == 0) + if (seq.seq_content_type[seq.seq_active_track] == 0) { //Drumtrack if ( drum_config[activesample].midinote > 209 ) //it is a pitched sample { - seq_vel[seq_active_track][seq_menu - 3] = drum_config[activesample].midinote; - //seq_data[seq_active_track][seq_menu - 3] = MIDI_C4; + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] = drum_config[activesample].midinote; + //seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = MIDI_C4; } else // if (activesample == NUM_DRUMSET_CONFIG - 1) //user selected EMPTY note for pitched sample // { - // seq_data[seq_active_track][seq_menu - 3] = 0; - // seq_vel[seq_active_track][seq_menu - 3] = 0; + // seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = 0; + // seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] = 0; // } // else //check if note is already there, if not -> insert it, else remove it from grid. - if (seq_data[seq_active_track][seq_menu - 3] == drum_config[activesample].midinote) + if (seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] == drum_config[activesample].midinote) { - seq_data[seq_active_track][seq_menu - 3] = 0; - seq_vel[seq_active_track][seq_menu - 3] = 0; + seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = 0; + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] = 0; } else { - seq_data[seq_active_track][seq_menu - 3] = drum_config[activesample].midinote; - seq_vel[seq_active_track][seq_menu - 3] = 120; + seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = drum_config[activesample].midinote; + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] = 120; } } else { //Inst. Track - if (temp_int == 109 || seq_data[seq_active_track][seq_menu - 3] == temp_int ) + if (temp_int == 109 || seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] == temp_int ) { //clear note - seq_data[seq_active_track][seq_menu - 3] = 0; - seq_vel[seq_active_track][seq_menu - 3] = 0; + seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = 0; + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] = 0; } else if (temp_int == 110) { //latch note - seq_data[seq_active_track][seq_menu - 3] = 130; - //seq_vel[seq_active_track][seq_menu - 3] = 0; + seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = 130; + //seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] = 0; } else { - seq_data[seq_active_track][seq_menu - 3] = temp_int; - seq_vel[seq_active_track][seq_menu - 3] = 120; + seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] = temp_int; + seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] = 120; } } } @@ -5160,7 +5124,7 @@ void UI_func_seq_pattern_editor(uint8_t param) } //button check end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - if (seq_menu == 34 && seq_active_function == 94) + if (seq.seq_menu == 34 && seq_active_function == 94) { //transpose char displayname[4] = {0, 0, 0, 0}; lcd.setCursor(10, 0); @@ -5180,21 +5144,21 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.print("]"); for (uint8_t i = 0; i < 16; i++) { - if (seq_content_type[seq_active_track] == 0) { //drums - if (seq_data_buffer[i] != 0 && seq_data_buffer[i] + temp_int >= 0 && seq_data_buffer[i] + temp_int < 254 - && seq_vel[seq_active_track][i] >= 210 ) // pitched drums only - seq_data[seq_active_track][i] = seq_data_buffer[i] + temp_int; + if (seq.seq_content_type[seq.seq_active_track] == 0) { //drums + if (seq.seq_data_buffer[i] != 0 && seq.seq_data_buffer[i] + temp_int >= 0 && seq.seq_data_buffer[i] + temp_int < 254 + && seq.seq_vel[seq.seq_active_track][i] >= 210 ) // pitched drums only + seq.seq_data[seq.seq_active_track][i] = seq.seq_data_buffer[i] + temp_int; } else //instruments - if (seq_content_type[seq_active_track] > 0) { - if (seq_data_buffer[i] != 0 && seq_data_buffer[i] != 130 && seq_data_buffer[i] + temp_int > 0 && seq_data_buffer[i] + temp_int < 254) - seq_data[seq_active_track][i] = seq_data_buffer[i] + temp_int; + if (seq.seq_content_type[seq.seq_active_track] > 0) { + if (seq.seq_data_buffer[i] != 0 && seq.seq_data_buffer[i] != 130 && seq.seq_data_buffer[i] + temp_int > 0 && seq.seq_data_buffer[i] + temp_int < 254) + seq.seq_data[seq.seq_active_track][i] = seq.seq_data_buffer[i] + temp_int; } } seq_printAllSeqSteps(); } - else if (seq_menu == 33) + else if (seq.seq_menu == 33) { //fill pattern 2nd parameter lcd.setCursor(4, 1); lcd.print(" "); @@ -5205,22 +5169,22 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.setCursor(15, 1); lcd.print("]"); lcd.setCursor(11, 1); - if (seq_temp_active_menu == 0) lcd.print(" 1/4"); - else if (seq_temp_active_menu == 1) lcd.print(" 1/8"); - else if (seq_temp_active_menu == 2) lcd.print("1/16"); - } else if (seq_menu == 32 ) { //fill pattern - if (seq_content_type[seq_active_track] == 0) { //drum + if (seq.seq_temp_active_menu == 0) lcd.print(" 1/4"); + else if (seq.seq_temp_active_menu == 1) lcd.print(" 1/8"); + else if (seq.seq_temp_active_menu == 2) lcd.print("1/16"); + } else if (seq.seq_menu == 32 ) { //fill pattern + if (seq.seq_content_type[seq.seq_active_track] == 0) { //drum lcd.setCursor(0, 1); lcd.print("with"); lcd.setCursor(4, 1); lcd.print("["); lcd.setCursor(9, 1); lcd.print("]"); - lcd.show(1, 5, 4, basename(drum_config[seq_temp_select_menu].name)); + lcd.show(1, 5, 4, basename(drum_config[seq.seq_temp_select_menu].name)); lcd.setCursor(11, 1); - if (seq_temp_active_menu == 0) lcd.print(" 1/4"); - else if (seq_temp_active_menu == 1) lcd.print(" 1/8"); - else if (seq_temp_active_menu == 2) lcd.print("1/16"); + if (seq.seq_temp_active_menu == 0) lcd.print(" 1/4"); + else if (seq.seq_temp_active_menu == 1) lcd.print(" 1/8"); + else if (seq.seq_temp_active_menu == 2) lcd.print("1/16"); } else { //inst lcd.setCursor(0, 1); @@ -5228,17 +5192,17 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.setCursor(4, 1); lcd.print("["); lcd.setCursor(5, 1); - lcd.print(noteNames[seq_temp_select_menu % 12 ]); - lcd.print( (seq_temp_select_menu / 12) - 1); + lcd.print(noteNames[seq.seq_temp_select_menu % 12 ]); + lcd.print( (seq.seq_temp_select_menu / 12) - 1); lcd.print(" "); lcd.setCursor(9, 1); lcd.print("]"); lcd.setCursor(11, 1); - if (seq_temp_active_menu == 0) lcd.print(" 1/4"); - else if (seq_temp_active_menu == 1) lcd.print(" 1/8"); - else if (seq_temp_active_menu == 2) lcd.print("1/16"); + if (seq.seq_temp_active_menu == 0) lcd.print(" 1/4"); + else if (seq.seq_temp_active_menu == 1) lcd.print(" 1/8"); + else if (seq.seq_temp_active_menu == 2) lcd.print("1/16"); } - } else if (seq_menu == 31) { //copy pattern + } else if (seq.seq_menu == 31) { //copy pattern lcd.setCursor(12, 0); lcd.print("["); lcd.setCursor(15, 0); @@ -5248,7 +5212,7 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.setCursor(13, 1); if (temp_int < 10) lcd.print("0"); lcd.print(temp_int); - } else if (seq_menu == 30) { //swap pattern + } else if (seq.seq_menu == 30) { //swap pattern lcd.setCursor(12, 0); lcd.print("["); lcd.setCursor(15, 0); @@ -5258,7 +5222,7 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.setCursor(13, 1); if (temp_int < 10) lcd.print("0"); lcd.print(temp_int); - } else if (seq_menu == 0) { + } else if (seq.seq_menu == 0) { #ifdef TESTDISPLAY20x4 lcd.setCursor(13, 0); lcd.print(" "); @@ -5272,7 +5236,7 @@ void UI_func_seq_pattern_editor(uint8_t param) #endif lcd.setCursor(0, 0); lcd.print("["); - if (seq_content_type[seq_active_track] == 0) //Drum Mode + if (seq.seq_content_type[seq.seq_active_track] == 0) //Drum Mode { if (activesample < NUM_DRUMSET_CONFIG - 1) { lcd.show(0, 1, 6, basename(drum_config[activesample].name)); @@ -5341,7 +5305,7 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.print("]"); } } - else if (seq_menu == 1) { + else if (seq.seq_menu == 1) { lcd.setCursor(0, 0); lcd.print(" "); lcd.setCursor(7, 0); @@ -5371,7 +5335,7 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.print("]"); #endif } - if (seq_menu == 2) { + if (seq.seq_menu == 2) { #ifdef TESTDISPLAY20x4 lcd.setCursor(13, 0); lcd.print(" "); @@ -5380,8 +5344,8 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.setCursor(16, 0); lcd.print("["); lcd.setCursor(17, 0); - if (seq_active_track < 10) lcd.print("0"); - lcd.print(seq_active_track); + if (seq.seq_active_track < 10) lcd.print("0"); + lcd.print(seq.seq_active_track); lcd.setCursor(19, 0); lcd.print("]"); #else @@ -5392,11 +5356,11 @@ void UI_func_seq_pattern_editor(uint8_t param) lcd.setCursor(12, 0); lcd.print("["); lcd.setCursor(13, 0); - if (seq_active_track < 10) lcd.print("0"); - lcd.print(seq_active_track); + if (seq.seq_active_track < 10) lcd.print("0"); + lcd.print(seq.seq_active_track); lcd.setCursor(15, 0); lcd.print("]"); - if (seq_content_type[seq_active_track] == 0) //Drum Mode + if (seq.seq_content_type[seq.seq_active_track] == 0) //Drum Mode { lcd.setCursor(0, 0); lcd.print(" "); @@ -5410,7 +5374,7 @@ void UI_func_seq_pattern_editor(uint8_t param) seq_printVelGraphBar(); #endif } - if (seq_menu == 3) { + if (seq.seq_menu == 3) { #ifdef TESTDISPLAY20x4 lcd.setCursor(16, 0); lcd.print(" "); @@ -5427,26 +5391,26 @@ void UI_func_seq_pattern_editor(uint8_t param) // lcd.setCursor(1, 1); // lcd.print(seq_find_shortname(1)[0]); } - if (seq_menu > 2 && seq_menu < 19 && seq_active_function != 40) + if (seq.seq_menu > 2 && seq.seq_menu < 19 && seq_active_function != 40) { - if (seq_menu == 3) + if (seq.seq_menu == 3) lcd.setCursor(0, 1); else - lcd.setCursor(seq_menu - 3, 1); + lcd.setCursor(seq.seq_menu - 3, 1); lcd.write(219); // cursor symbol - if (seq_menu > 3) + if (seq.seq_menu > 3) { - lcd.setCursor(seq_menu - 4, 1); + lcd.setCursor(seq.seq_menu - 4, 1); - lcd.print(seq_find_shortname(seq_menu - 4)[0]); + lcd.print(seq_find_shortname(seq.seq_menu - 4)[0]); } - if (seq_menu < 18) + if (seq.seq_menu < 18) { - lcd.setCursor(seq_menu - 2, 1); - lcd.print(seq_find_shortname(seq_menu - 2)[0]); + lcd.setCursor(seq.seq_menu - 2, 1); + lcd.print(seq_find_shortname(seq.seq_menu - 2)[0]); } - if (seq_vel[seq_active_track][seq_menu - 3] > 209 && activesample != NUM_DRUMSET_CONFIG - 1 ) //is pitched sample and selected item is not set to EMPTY + if (seq.seq_vel[seq.seq_active_track][seq.seq_menu - 3] > 209 && activesample != NUM_DRUMSET_CONFIG - 1 ) //is pitched sample and selected item is not set to EMPTY { lcd.setCursor(0, 0); lcd.print("[EDIT "); @@ -5456,16 +5420,16 @@ void UI_func_seq_pattern_editor(uint8_t param) } else //print current sample name on active step if not empty - if (seq_data[seq_active_track][seq_menu - 3] > 0) + if (seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] > 0) { lcd.setCursor(0, 0); lcd.print(" "); - lcd.show(0, 1, 6, seq_find_drum_name_from_note( seq_data[seq_active_track][seq_menu - 3]) ); + lcd.show(0, 1, 6, seq_find_drum_name_from_note( seq.seq_data[seq.seq_active_track][seq.seq_menu - 3]) ); lcd.print(" "); } else { //if step empty, print selected, active sample - if (seq_data[seq_active_track][seq_menu - 3] == 0) + if (seq.seq_data[seq.seq_active_track][seq.seq_menu - 3] == 0) lcd.setCursor(0, 0); lcd.print(" "); lcd.show(0, 1, 6, basename(drum_config[activesample].name)); @@ -5487,7 +5451,7 @@ void UI_func_seq_pattern_editor(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - seq_menu = 0; + seq.seq_menu = 0; seq_active_function = 99; lcd_special_chars(SCROLLBAR); } @@ -5500,15 +5464,15 @@ void UI_func_arpeggio(uint8_t param) encoderDir[ENC_R].reset(); lcd.createChar(0, (uint8_t*)special_chars[19]); //play symbol lcd.createChar(2, (uint8_t*)special_chars[21]); //stop symbol - seq_temp_select_menu = 0; - seq_temp_active_menu = 0; + seq.seq_temp_select_menu = 0; + seq.seq_temp_active_menu = 0; lcd.setCursor( 0, 0); lcd.print("Len"); lcd.setCursor(7, 0); - lcd.print( seq_chord_names[arp_chord][0]); - lcd.print( seq_chord_names[arp_chord][1]); - lcd.print( seq_chord_names[arp_chord][2]); - lcd.print( seq_chord_names[arp_chord][3]); + lcd.print( seq.seq_chord_names[seq.arp_chord][0]); + lcd.print( seq.seq_chord_names[seq.arp_chord][1]); + lcd.print( seq.seq_chord_names[seq.arp_chord][2]); + lcd.print( seq.seq_chord_names[seq.arp_chord][3]); lcd.setCursor( 0, 1); lcd.print("Style"); lcd.setCursor( 11, 1); @@ -5519,92 +5483,92 @@ void UI_func_arpeggio(uint8_t param) { if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { - if (seq_temp_active_menu == 0) + if (seq.seq_temp_active_menu == 0) { if (LCDML.BT_checkDown()) - seq_temp_select_menu = constrain(seq_temp_select_menu + ENCODER[ENC_R].speed(), 0, 3); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu + ENCODER[ENC_R].speed(), 0, 3); else if (LCDML.BT_checkUp()) - seq_temp_select_menu = constrain(seq_temp_select_menu - ENCODER[ENC_R].speed(), 0, 3); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu - ENCODER[ENC_R].speed(), 0, 3); } - else if (seq_temp_active_menu == 1) // Octave setting + else if (seq.seq_temp_active_menu == 1) // Octave setting { if (LCDML.BT_checkDown()) - arp_lenght = constrain(arp_lenght + ENCODER[ENC_R].speed(), 0, 9); + seq.arp_lenght = constrain(seq.arp_lenght + ENCODER[ENC_R].speed(), 0, 9); else if (LCDML.BT_checkUp()) - arp_lenght = constrain(arp_lenght - ENCODER[ENC_R].speed(), 0, 9); + seq.arp_lenght = constrain(seq.arp_lenght - ENCODER[ENC_R].speed(), 0, 9); } - else if (seq_temp_active_menu == 2) // Style setting + else if (seq.seq_temp_active_menu == 2) // Style setting { if (LCDML.BT_checkDown()) - arp_style = constrain(arp_style + ENCODER[ENC_R].speed(), 0, 3); + seq.arp_style = constrain(seq.arp_style + ENCODER[ENC_R].speed(), 0, 3); else if (LCDML.BT_checkUp()) - arp_style = constrain(arp_style - ENCODER[ENC_R].speed(), 0, 3); + seq.arp_style = constrain(seq.arp_style - ENCODER[ENC_R].speed(), 0, 3); } - else if (seq_temp_active_menu == 3) // Arp Speed setting + else if (seq.seq_temp_active_menu == 3) // Arp Speed setting { if (LCDML.BT_checkDown()) - arp_speed = constrain(arp_speed + ENCODER[ENC_R].speed(), 0, 1); + seq.arp_speed = constrain(seq.arp_speed + ENCODER[ENC_R].speed(), 0, 1); else if (LCDML.BT_checkUp()) - arp_speed = constrain(arp_speed - ENCODER[ENC_R].speed(), 0, 1); + seq.arp_speed = constrain(seq.arp_speed - ENCODER[ENC_R].speed(), 0, 1); } if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> { - if ( seq_temp_select_menu == 0 && seq_temp_active_menu == 0 ) + if ( seq.seq_temp_select_menu == 0 && seq.seq_temp_active_menu == 0 ) { - seq_temp_active_menu = 1; + seq.seq_temp_active_menu = 1; } - else if ( seq_temp_select_menu == 0 && seq_temp_active_menu == 1 ) + else if ( seq.seq_temp_select_menu == 0 && seq.seq_temp_active_menu == 1 ) { - seq_temp_active_menu = 0; + seq.seq_temp_active_menu = 0; } - if ( seq_temp_select_menu == 1 && seq_temp_active_menu == 0 ) + if ( seq.seq_temp_select_menu == 1 && seq.seq_temp_active_menu == 0 ) { - seq_temp_active_menu = 2; + seq.seq_temp_active_menu = 2; } - else if ( seq_temp_select_menu == 1 && seq_temp_active_menu == 2 ) + else if ( seq.seq_temp_select_menu == 1 && seq.seq_temp_active_menu == 2 ) { - seq_temp_active_menu = 0; + seq.seq_temp_active_menu = 0; } - else if ( seq_temp_select_menu == 2 ) + else if ( seq.seq_temp_select_menu == 2 ) { - if (seq_running) { - seq_running = !seq_running; + if (seq.seq_running) { + seq.seq_running = !seq.seq_running; handleStop(); arp_refresh_display_play_status(); - seq_step = 0; - arp_octave = 0; - arp_step = 0; - seq_chain_active_step = 0; + seq.seq_step = 0; + seq.arp_octave = 0; + seq.arp_step = 0; + seq.seq_chain_active_step = 0; } else { - seq_running = !seq_running; + seq.seq_running = !seq.seq_running; arp_refresh_display_play_status(); handleStart(); } } - else if ( seq_temp_select_menu == 3 && seq_temp_active_menu == 0 ) + else if ( seq.seq_temp_select_menu == 3 && seq.seq_temp_active_menu == 0 ) { - seq_temp_active_menu = 3; + seq.seq_temp_active_menu = 3; } - else if ( seq_temp_select_menu == 3 && seq_temp_active_menu == 3 ) + else if ( seq.seq_temp_select_menu == 3 && seq.seq_temp_active_menu == 3 ) { - seq_temp_active_menu = 0; + seq.seq_temp_active_menu = 0; } } } lcd.setCursor( 4, 0); - if (arp_lenght == 0) lcd.print("A"); else lcd.print(arp_lenght); //play all elements or from 1-xx elements + if (seq.arp_lenght == 0) lcd.print("A"); else lcd.print(seq.arp_lenght); //play all elements or from 1-xx elements lcd.setCursor( 6, 1); - lcd.print( arp_style_names[arp_style][0] ); - lcd.print( arp_style_names[arp_style][1] ); - lcd.print( arp_style_names[arp_style][2] ); + lcd.print( seq.arp_style_names[seq.arp_style][0] ); + lcd.print( seq.arp_style_names[seq.arp_style][1] ); + lcd.print( seq.arp_style_names[seq.arp_style][2] ); lcd.setCursor( 11, 1); - if (arp_speed == 0)lcd.print("1/16"); else if (arp_speed == 1)lcd.print("1/8 "); + if (seq.arp_speed == 0)lcd.print("1/16"); else if (seq.arp_speed == 1)lcd.print("1/8 "); - if (seq_temp_select_menu == 0) { + if (seq.seq_temp_select_menu == 0) { lcd.setCursor( 3, 0); lcd.print("["); lcd.setCursor( 5, 0); @@ -5618,7 +5582,7 @@ void UI_func_arpeggio(uint8_t param) lcd.setCursor( 15, 1); lcd.print(" "); } - else if (seq_temp_select_menu == 1) + else if (seq.seq_temp_select_menu == 1) { lcd.setCursor( 5, 1); lcd.print("["); @@ -5633,7 +5597,7 @@ void UI_func_arpeggio(uint8_t param) lcd.setCursor( 15, 0); lcd.print(" "); } - else if (seq_temp_select_menu == 2) + else if (seq.seq_temp_select_menu == 2) { lcd.setCursor( 5, 1); lcd.print(" "); @@ -5648,7 +5612,7 @@ void UI_func_arpeggio(uint8_t param) lcd.setCursor( 15, 1); lcd.print(" "); } - else if (seq_temp_select_menu == 3) + else if (seq.seq_temp_select_menu == 3) { lcd.setCursor( 13, 0); lcd.print(" "); @@ -5676,17 +5640,17 @@ void UI_func_seq_pat_chain(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function - seq_temp_select_menu = 0; - seq_temp_active_menu = 99; - seq_menu = 0; + seq.seq_temp_select_menu = 0; + seq.seq_temp_active_menu = 99; + seq.seq_menu = 0; lcd.setCursor( 0, 0); lcd.print("ChainStep:"); lcd.setCursor( 13, 0); - lcd.print(seq_chain_active_chainstep + 1); + lcd.print(seq.seq_chain_active_chainstep + 1); lcd.setCursor( 14, 0); lcd.print("/"); lcd.setCursor( 15, 0); - lcd.print(seq_chain_lenght + 1); + lcd.print(seq.seq_chain_lenght + 1); lcd.setCursor( 0, 1); lcd.print("T"); lcd.setCursor(10 , 1); @@ -5694,63 +5658,63 @@ void UI_func_seq_pat_chain(uint8_t param) } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if (seq_temp_active_menu == 99) { + if (seq.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_menu = constrain(seq_menu + 1, 0, 2); //menu select + seq.seq_menu = constrain(seq.seq_menu + 1, 0, 2); //menu select else if (LCDML.BT_checkUp()) - seq_menu = constrain(seq_menu - 1, 0, 2); + seq.seq_menu = constrain(seq.seq_menu - 1, 0, 2); } } - else if (seq_temp_active_menu == 90) { + else if (seq.seq_temp_active_menu == 90) { 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, NUM_SEQ_TRACKS - 1); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu + 1, 0, NUM_SEQ_TRACKS - 1); else if (LCDML.BT_checkUp()) - seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS - 1); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS - 1); } - } else if (seq_temp_active_menu == 20) { + } else if (seq.seq_temp_active_menu == 20) { 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, seq_chain_lenght); + seq.seq_chain_active_chainstep = constrain(seq.seq_chain_active_chainstep + 1, 0, seq.seq_chain_lenght); else if (LCDML.BT_checkUp()) - seq_chain_active_chainstep = constrain(seq_chain_active_chainstep - 1, 0, seq_chain_lenght); + seq.seq_chain_active_chainstep = constrain(seq.seq_chain_active_chainstep - 1, 0, seq.seq_chain_lenght); } } - else if (seq_temp_active_menu == 18) { + else if (seq.seq_temp_active_menu == 18) { 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_temp_select_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_temp_select_menu] + 1, 0, NUM_SEQ_PATTERN ); + seq.seq_patternchain[seq.seq_chain_active_chainstep][seq.seq_temp_select_menu] = constrain(seq.seq_patternchain[seq.seq_chain_active_chainstep][seq.seq_temp_select_menu] + 1, 0, NUM_SEQ_PATTERN ); } else if (LCDML.BT_checkUp()) { - seq_patternchain[seq_chain_active_chainstep][seq_temp_select_menu] = constrain(seq_patternchain[seq_chain_active_chainstep][seq_temp_select_menu] - 1, 0, NUM_SEQ_PATTERN ); + seq.seq_patternchain[seq.seq_chain_active_chainstep][seq.seq_temp_select_menu] = constrain(seq.seq_patternchain[seq.seq_chain_active_chainstep][seq.seq_temp_select_menu] - 1, 0, NUM_SEQ_PATTERN ); } } } if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> { - if (seq_temp_active_menu == 99 && seq_menu == 0 ) + if (seq.seq_temp_active_menu == 99 && seq.seq_menu == 0 ) { - seq_temp_active_menu = 20; + seq.seq_temp_active_menu = 20; } - else if (seq_temp_active_menu == 99 && seq_menu == 1 ) + else if (seq.seq_temp_active_menu == 99 && seq.seq_menu == 1 ) { - seq_temp_active_menu = 90; + seq.seq_temp_active_menu = 90; } - else if (seq_temp_active_menu == 99 && seq_menu == 2 ) + else if (seq.seq_temp_active_menu == 99 && seq.seq_menu == 2 ) { - seq_temp_active_menu = 18; + seq.seq_temp_active_menu = 18; } else - seq_temp_active_menu = 99; + seq.seq_temp_active_menu = 99; } - if (seq_menu == 0) // Chainselect modify + if (seq.seq_menu == 0) // Chainselect modify { lcd.setCursor( 12, 1); lcd.print(" "); @@ -5765,7 +5729,7 @@ void UI_func_seq_pat_chain(uint8_t param) lcd.setCursor( 13, 0); lcd.print("]"); } - else if (seq_menu == 1 ) { + else if (seq.seq_menu == 1 ) { lcd.setCursor( 12, 1); lcd.print(" "); lcd.setCursor( 15, 1); @@ -5779,7 +5743,7 @@ void UI_func_seq_pat_chain(uint8_t param) lcd.setCursor(3 , 1); lcd.print("]"); } - else if (seq_menu == 2 ) { + else if (seq.seq_menu == 2 ) { lcd.setCursor( 11, 0); lcd.print(" "); lcd.setCursor( 13, 0); @@ -5794,20 +5758,20 @@ void UI_func_seq_pat_chain(uint8_t param) lcd.print("]"); } lcd.setCursor( 12, 0); - lcd.print(seq_chain_active_chainstep + 1); + lcd.print(seq.seq_chain_active_chainstep + 1); lcd.setCursor(2 , 1); - lcd.print( seq_temp_select_menu + 1); + lcd.print( seq.seq_temp_select_menu + 1); lcd.setCursor(4 , 1); - if (seq_track_type[seq_temp_select_menu] == 0 ) lcd.print("(Drum)"); - else if (seq_track_type[seq_temp_select_menu] == 1 ) lcd.print("(Inst)"); - else if (seq_track_type[seq_temp_select_menu] == 2 ) lcd.print("(Chrd)"); else lcd.print("(Arp.)"); + if (seq.seq_track_type[seq.seq_temp_select_menu] == 0 ) lcd.print("(Drum)"); + else if (seq.seq_track_type[seq.seq_temp_select_menu] == 1 ) lcd.print("(Inst)"); + else if (seq.seq_track_type[seq.seq_temp_select_menu] == 2 ) lcd.print("(Chrd)"); else lcd.print("(Arp.)"); lcd.setCursor( 13, 1); - if (seq_patternchain[seq_chain_active_chainstep][seq_temp_select_menu] == NUM_SEQ_PATTERN)lcd.print("--"); //empty pattern + if (seq.seq_patternchain[seq.seq_chain_active_chainstep][seq.seq_temp_select_menu] == NUM_SEQ_PATTERN)lcd.print("--"); //empty pattern else { - if (seq_patternchain[seq_chain_active_chainstep][seq_temp_select_menu] < 10) + if (seq.seq_patternchain[seq.seq_chain_active_chainstep][seq.seq_temp_select_menu] < 10) lcd.print("0"); - lcd.print(seq_patternchain[seq_chain_active_chainstep][seq_temp_select_menu] ); + lcd.print(seq.seq_patternchain[seq.seq_chain_active_chainstep][seq.seq_temp_select_menu] ); } } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -5822,80 +5786,80 @@ void UI_func_seq_mute_matrix(uint8_t param) // for test display 20x4 if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function - seq_temp_active_menu = 99; - seq_temp_select_menu = 1; - seq_menu = 0; + seq.seq_temp_active_menu = 99; + seq.seq_temp_select_menu = 1; + seq.seq_menu = 0; temp_int = 0; //y offset lcd.setCursor( 0, 0); } if (LCDML.FUNC_loop()) // ****** LOOP ********* { uint8_t xscroll; - if (seq_temp_active_menu == 99) { + if (seq.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, NUM_SEQ_TRACKS + 1); - if (seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int != 3) //next chain step + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu + 1, 0, NUM_SEQ_TRACKS + 1); + if (seq.seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int != 3) //next chain step { lcd.setCursor( 14 , temp_int); lcd.print(" "); lcd.setCursor( 18 , temp_int); lcd.print(" "); - seq_temp_select_menu = 1; + seq.seq_temp_select_menu = 1; if (temp_int < 3)temp_int++; } - if (seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int == 3) - seq_temp_select_menu = NUM_SEQ_TRACKS; + if (seq.seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int == 3) + seq.seq_temp_select_menu = NUM_SEQ_TRACKS; } else if (LCDML.BT_checkUp()) { - seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS + 1); - if (seq_temp_select_menu == 0 && temp_int > 0) //prev chain step + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS + 1); + if (seq.seq_temp_select_menu == 0 && temp_int > 0) //prev chain step { lcd.setCursor( 2 , temp_int); lcd.print(" "); lcd.setCursor( 6 , temp_int); lcd.print(" "); - seq_temp_select_menu = NUM_SEQ_TRACKS - 1 ; + seq.seq_temp_select_menu = NUM_SEQ_TRACKS - 1 ; if (temp_int >= 0)temp_int = temp_int - 1; lcd.setCursor( 14 , temp_int); lcd.print("["); lcd.setCursor( 18 , temp_int); lcd.print("]"); } - else if (seq_temp_select_menu < 1 && temp_int == 0 ) - seq_temp_select_menu = 1; + else if (seq.seq_temp_select_menu < 1 && temp_int == 0 ) + seq.seq_temp_select_menu = 1; } } } if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> { - if (seq_patternchain[temp_int][seq_temp_select_menu - 1] < NUM_SEQ_PATTERN) - seq_patternchain[temp_int][seq_temp_select_menu - 1] = seq_patternchain[temp_int][seq_temp_select_menu - 1] + (NUM_SEQ_PATTERN + 10); - else if (seq_patternchain[temp_int][seq_temp_select_menu - 1] > NUM_SEQ_PATTERN && seq_patternchain[temp_int][seq_temp_select_menu - 1] != 99) - seq_patternchain[temp_int][seq_temp_select_menu - 1] = seq_patternchain[temp_int][seq_temp_select_menu - 1] - (NUM_SEQ_PATTERN + 10); - else if (seq_patternchain[temp_int][seq_temp_select_menu - 1] == 99) - seq_patternchain[temp_int][seq_temp_select_menu - 1] = NUM_SEQ_PATTERN - 1; + if (seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] < NUM_SEQ_PATTERN) + seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] = seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] + (NUM_SEQ_PATTERN + 10); + else if (seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] > NUM_SEQ_PATTERN && seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] != 99) + seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] = seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] - (NUM_SEQ_PATTERN + 10); + else if (seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] == 99) + seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] = NUM_SEQ_PATTERN - 1; } - if (seq_temp_select_menu - 1 < 4)xscroll = 0; - else if (seq_temp_select_menu - 1 == 4)xscroll = 1; + if (seq.seq_temp_select_menu - 1 < 4)xscroll = 0; + else if (seq.seq_temp_select_menu - 1 == 4)xscroll = 1; else xscroll = 2; for (uint8_t y = 0; y < 4; y++) { for (uint8_t x = 0; x < NUM_SEQ_TRACKS - 2; x++) { lcd.setCursor( x * 4 + 3, y); - if (seq_patternchain[y][x + xscroll] < NUM_SEQ_PATTERN ) + if (seq.seq_patternchain[y][x + xscroll] < NUM_SEQ_PATTERN ) { - if (seq_track_type[x + xscroll ] == 0 ) lcd.print("D"); - else if (seq_track_type[x + xscroll ] == 1 ) lcd.print("I"); - else if (seq_track_type[x + xscroll ] == 2 ) lcd.print("C"); + if (seq.seq_track_type[x + xscroll ] == 0 ) lcd.print("D"); + else if (seq.seq_track_type[x + xscroll ] == 1 ) lcd.print("I"); + else if (seq.seq_track_type[x + xscroll ] == 2 ) lcd.print("C"); else lcd.print("A"); - if (seq_patternchain[y][x + xscroll] < 10) + if (seq.seq_patternchain[y][x + xscroll] < 10) lcd.print("0"); - lcd.print( seq_patternchain[y][x + xscroll] ); + lcd.print( seq.seq_patternchain[y][x + xscroll] ); } else lcd.print("OFF"); @@ -5904,22 +5868,22 @@ void UI_func_seq_mute_matrix(uint8_t param) // for test display 20x4 if (xscroll == 0) { //print cursor - lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 2, temp_int); + lcd.setCursor( (seq.seq_temp_select_menu - 1) * 4 + 2, temp_int); lcd.print("["); - lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 6, temp_int); + lcd.setCursor( (seq.seq_temp_select_menu - 1) * 4 + 6, temp_int); lcd.print("]"); - if ((seq_temp_select_menu - 1) > 0) { - lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 2 - 4 , temp_int); + if ((seq.seq_temp_select_menu - 1) > 0) { + lcd.setCursor( (seq.seq_temp_select_menu - 1) * 4 + 2 - 4 , temp_int); lcd.print(" "); } - if ((seq_temp_select_menu - 1) < 4) { - lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 6 + 4 , temp_int); + if ((seq.seq_temp_select_menu - 1) < 4) { + lcd.setCursor( (seq.seq_temp_select_menu - 1) * 4 + 6 + 4 , temp_int); lcd.print(" "); } } lcd.setCursor( 0, 0); lcd.print("T"); - lcd.print(seq_temp_select_menu); + lcd.print(seq.seq_temp_select_menu); lcd.setCursor( 0, 1); lcd.print("S"); lcd.print(temp_int + 1); // Chain Step @@ -5937,81 +5901,81 @@ void UI_func_seq_mute_matrix(uint8_t param) // for standard display 16x2 if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function - seq_temp_active_menu = 99; - seq_temp_select_menu = 1; - seq_menu = 0; + seq.seq_temp_active_menu = 99; + seq.seq_temp_select_menu = 1; + seq.seq_menu = 0; temp_int = 0; //y offset lcd.setCursor( 0, 0); } if (LCDML.FUNC_loop()) // ****** LOOP ********* { uint8_t xscroll; - if (seq_temp_active_menu == 99) { + if (seq.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, NUM_SEQ_TRACKS + 1); - if (seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int != 3) //next chain step + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu + 1, 0, NUM_SEQ_TRACKS + 1); + if (seq.seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int != 3) //next chain step { lcd.setCursor( 10 , 1); lcd.print(" "); lcd.setCursor( 14 , 1); lcd.print(" "); - seq_temp_select_menu = 1; + seq.seq_temp_select_menu = 1; if (temp_int < 3)temp_int++; } - if (seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int == 3) - seq_temp_select_menu = NUM_SEQ_TRACKS; + if (seq.seq_temp_select_menu == NUM_SEQ_TRACKS + 1 && temp_int == 3) + seq.seq_temp_select_menu = NUM_SEQ_TRACKS; } else if (LCDML.BT_checkUp()) { - seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS + 1); - if (seq_temp_select_menu == 0 && temp_int > 0) //prev chain step + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS + 1); + if (seq.seq_temp_select_menu == 0 && temp_int > 0) //prev chain step { lcd.setCursor( 2 , 1); lcd.print(" "); lcd.setCursor( 6 , 1); lcd.print(" "); - seq_temp_select_menu = NUM_SEQ_TRACKS - 1 ; + seq.seq_temp_select_menu = NUM_SEQ_TRACKS - 1 ; if (temp_int >= 0)temp_int = temp_int - 1; lcd.setCursor( 10 , 1); lcd.print("["); lcd.setCursor( 14 , 1); lcd.print("]"); } - else if (seq_temp_select_menu < 1 && temp_int == 0 ) - seq_temp_select_menu = 1; + else if (seq.seq_temp_select_menu < 1 && temp_int == 0 ) + seq.seq_temp_select_menu = 1; } } } if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> { - if (seq_patternchain[temp_int][seq_temp_select_menu - 1] < NUM_SEQ_PATTERN) - seq_patternchain[temp_int][seq_temp_select_menu - 1] = seq_patternchain[temp_int][seq_temp_select_menu - 1] + (NUM_SEQ_PATTERN + 10); - else if (seq_patternchain[temp_int][seq_temp_select_menu - 1] > NUM_SEQ_PATTERN && seq_patternchain[temp_int][seq_temp_select_menu - 1] != 99) - seq_patternchain[temp_int][seq_temp_select_menu - 1] = seq_patternchain[temp_int][seq_temp_select_menu - 1] - (NUM_SEQ_PATTERN + 10); - else if (seq_patternchain[temp_int][seq_temp_select_menu - 1] == 99) - seq_patternchain[temp_int][seq_temp_select_menu - 1] = NUM_SEQ_PATTERN - 1; + if (seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] < NUM_SEQ_PATTERN) + seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] = seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] + (NUM_SEQ_PATTERN + 10); + else if (seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] > NUM_SEQ_PATTERN && seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] != 99) + seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] = seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] - (NUM_SEQ_PATTERN + 10); + else if (seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] == 99) + seq.seq_patternchain[temp_int][seq.seq_temp_select_menu - 1] = NUM_SEQ_PATTERN - 1; } - if (seq_temp_select_menu - 1 < 3)xscroll = 0; - else xscroll = seq_temp_select_menu - 3; + if (seq.seq_temp_select_menu - 1 < 3)xscroll = 0; + else xscroll = seq.seq_temp_select_menu - 3; if (xscroll == 0) { //print cursor - lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 2, 1); + lcd.setCursor( (seq.seq_temp_select_menu - 1) * 4 + 2, 1); lcd.print("["); - lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 6, 1); + lcd.setCursor( (seq.seq_temp_select_menu - 1) * 4 + 6, 1); lcd.print("]"); - if ((seq_temp_select_menu - 1) > 0) + if ((seq.seq_temp_select_menu - 1) > 0) { - lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 2 - 4 , 1); + lcd.setCursor( (seq.seq_temp_select_menu - 1) * 4 + 2 - 4 , 1); lcd.print(" "); } - if ((seq_temp_select_menu - 1) < 4) + if ((seq.seq_temp_select_menu - 1) < 4) { - lcd.setCursor( (seq_temp_select_menu - 1) * 4 + 6 + 4 , 1); + lcd.setCursor( (seq.seq_temp_select_menu - 1) * 4 + 6 + 4 , 1); lcd.print(" "); } lcd.setCursor( 3, 0); @@ -6025,26 +5989,26 @@ void UI_func_seq_mute_matrix(uint8_t param) // for standard display 16x2 { lcd.setCursor( 3, 0); lcd.print("T"); - lcd.print(seq_temp_select_menu - 2); + lcd.print(seq.seq_temp_select_menu - 2); lcd.setCursor( 7, 0); lcd.print("T"); - lcd.print(seq_temp_select_menu - 2 + 1); + lcd.print(seq.seq_temp_select_menu - 2 + 1); lcd.setCursor( 11, 0); lcd.print("T"); - lcd.print(seq_temp_select_menu - 2 + 2); + lcd.print(seq.seq_temp_select_menu - 2 + 2); } for (uint8_t x = 0; x < NUM_SEQ_TRACKS - 3; x++) { lcd.setCursor( x * 4 + 3, 1); - if (seq_patternchain[temp_int][x + xscroll] < NUM_SEQ_PATTERN ) + if (seq.seq_patternchain[temp_int][x + xscroll] < NUM_SEQ_PATTERN ) { - if (seq_track_type[x + xscroll] == 0 ) lcd.print("D"); - else if (seq_track_type[x + xscroll ] == 1 ) lcd.print("I"); - else if (seq_track_type[x + xscroll ] == 2 ) lcd.print("C"); + if (seq.seq_track_type[x + xscroll] == 0 ) lcd.print("D"); + else if (seq.seq_track_type[x + xscroll ] == 1 ) lcd.print("I"); + else if (seq.seq_track_type[x + xscroll ] == 2 ) lcd.print("C"); else lcd.print("A"); - if (seq_patternchain[temp_int][x + xscroll] < 10) + if (seq.seq_patternchain[temp_int][x + xscroll] < 10) lcd.print("0"); - lcd.print( seq_patternchain[temp_int][x + xscroll] ); + lcd.print( seq.seq_patternchain[temp_int][x + xscroll] ); } else lcd.print("OFF"); @@ -6065,8 +6029,8 @@ void UI_func_seq_track_setup(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function - seq_temp_active_menu = 99; - seq_temp_select_menu = 0; + seq.seq_temp_active_menu = 99; + seq.seq_temp_select_menu = 0; lcd.setCursor(0 , 0); lcd.print("Track Setup"); lcd.setCursor(0 , 1); @@ -6074,33 +6038,33 @@ void UI_func_seq_track_setup(uint8_t param) } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if (seq_temp_active_menu == 99) { + if (seq.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, NUM_SEQ_TRACKS - 1); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu + 1, 0, NUM_SEQ_TRACKS - 1); else if (LCDML.BT_checkUp()) - seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS - 1); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS - 1); } } 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, 3); + seq.seq_track_type[seq.seq_temp_active_menu] = constrain(seq.seq_track_type[seq.seq_temp_active_menu] + 1, 0, 3); else if (LCDML.BT_checkUp()) - seq_track_type[seq_temp_active_menu] = constrain(seq_track_type[seq_temp_active_menu] - 1, 0, 3); + seq.seq_track_type[seq.seq_temp_active_menu] = constrain(seq.seq_track_type[seq.seq_temp_active_menu] - 1, 0, 3); } } if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> { - if (seq_temp_active_menu == 99) { - seq_temp_active_menu = seq_temp_select_menu; + if (seq.seq_temp_active_menu == 99) { + seq.seq_temp_active_menu = seq.seq_temp_select_menu; } else { - seq_temp_active_menu = 99; + seq.seq_temp_active_menu = 99; } } - if (seq_temp_active_menu == 99) + if (seq.seq_temp_active_menu == 99) { lcd.setCursor(8 , 1); lcd.print(" "); @@ -6109,7 +6073,7 @@ void UI_func_seq_track_setup(uint8_t param) lcd.setCursor(5 , 1); lcd.print("["); lcd.setCursor(6 , 1); - lcd.print(seq_temp_select_menu + 1); + lcd.print(seq.seq_temp_select_menu + 1); lcd.setCursor(7 , 1); lcd.print("]"); lcd.setCursor(9 , 1); @@ -6125,8 +6089,8 @@ void UI_func_seq_track_setup(uint8_t param) lcd.print("]"); lcd.setCursor(9 , 1); } - if (seq_track_type[seq_temp_select_menu] == 0 ) lcd.print("Drums "); else if (seq_track_type[seq_temp_select_menu] == 1 ) lcd.print("Instru"); - else if (seq_track_type[seq_temp_select_menu] == 2 )lcd.print("Chords"); else lcd.print("Arp "); + if (seq.seq_track_type[seq.seq_temp_select_menu] == 0 ) lcd.print("Drums "); else if (seq.seq_track_type[seq.seq_temp_select_menu] == 1 ) lcd.print("Instru"); + else if (seq.seq_track_type[seq.seq_temp_select_menu] == 2 )lcd.print("Chords"); else lcd.print("Arp "); } if (LCDML.FUNC_close()) // ****** STABLE END ********* { @@ -6139,8 +6103,8 @@ void UI_func_dexed_assign(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function - seq_temp_active_menu = 99; - seq_temp_select_menu = 0; + seq.seq_temp_active_menu = 99; + seq.seq_temp_select_menu = 0; lcd.setCursor(0 , 0); lcd.print("Dexed Assign"); lcd.setCursor(0 , 1); @@ -6148,33 +6112,33 @@ void UI_func_dexed_assign(uint8_t param) } if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if (seq_temp_active_menu == 99) { + if (seq.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, NUM_SEQ_TRACKS - 1); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu + 1, 0, NUM_SEQ_TRACKS - 1); else if (LCDML.BT_checkUp()) - seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS - 1); + seq.seq_temp_select_menu = constrain(seq.seq_temp_select_menu - 1, 0, NUM_SEQ_TRACKS - 1); } } else { if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) - seq_inst_dexed[seq_temp_active_menu] = constrain(seq_inst_dexed[seq_temp_active_menu] + 1, 0, 1); + seq.seq_inst_dexed[seq.seq_temp_active_menu] = constrain(seq.seq_inst_dexed[seq.seq_temp_active_menu] + 1, 0, 1); else if (LCDML.BT_checkUp()) - seq_inst_dexed[seq_temp_active_menu] = constrain(seq_inst_dexed[seq_temp_active_menu] - 1, 0, 1); + seq.seq_inst_dexed[seq.seq_temp_active_menu] = constrain(seq.seq_inst_dexed[seq.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; + if (seq.seq_temp_active_menu == 99) { + seq.seq_temp_active_menu = seq.seq_temp_select_menu; } else { - seq_temp_active_menu = 99; + seq.seq_temp_active_menu = 99; } } - if (seq_temp_active_menu == 99) + if (seq.seq_temp_active_menu == 99) { lcd.setCursor(8 , 1); lcd.print(" "); @@ -6183,7 +6147,7 @@ void UI_func_dexed_assign(uint8_t param) lcd.setCursor(5 , 1); lcd.print("["); lcd.setCursor(6 , 1); - lcd.print(seq_temp_select_menu + 1); + lcd.print(seq.seq_temp_select_menu + 1); lcd.setCursor(7 , 1); lcd.print("]"); lcd.setCursor(9 , 1); @@ -6200,7 +6164,7 @@ void UI_func_dexed_assign(uint8_t param) lcd.setCursor(9 , 1); } - if (seq_inst_dexed[seq_temp_select_menu] == 0 ) lcd.print("dexed0"); else if (seq_inst_dexed[seq_temp_select_menu] == 1 ) lcd.print("dexed1"); else lcd.print("??????"); + if (seq.seq_inst_dexed[seq.seq_temp_select_menu] == 0 ) lcd.print("dexed0"); else if (seq.seq_inst_dexed[seq.seq_temp_select_menu] == 1 ) lcd.print("dexed1"); else lcd.print("??????"); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -6215,7 +6179,7 @@ void UI_func_load_performance(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { char tmp[10]; - if (seq_state_last_loadsave != 200)temp_int = seq_state_last_loadsave; else temp_int = param; + if (seq.seq_state_last_loadsave != 200)temp_int = seq.seq_state_last_loadsave; else temp_int = param; mode = 0; encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); @@ -6245,7 +6209,7 @@ void UI_func_load_performance(uint8_t param) else { load_sd_performance_json(temp_int); - seq_state_last_loadsave = temp_int; + seq.seq_state_last_loadsave = temp_int; lcd.print("Done. "); } delay(MESSAGE_WAIT_TIME); @@ -6259,8 +6223,8 @@ void UI_func_load_performance(uint8_t param) if (check_sd_performance_exists(temp_int)) { get_sd_performance_name_json(temp_int); - if ( seq_name_temp[0] != 0 ) - lcd.show(1, 5, 11, seq_name_temp); + if ( seq.seq_name_temp[0] != 0 ) + lcd.show(1, 5, 11, seq.seq_name_temp); else lcd.print(" -- DATA --"); } @@ -6291,8 +6255,8 @@ void UI_func_save_performance(uint8_t param) { char tmp[FILENAME_LEN]; yesno = false; - if (seq_state_last_loadsave != 200) - temp_int = seq_state_last_loadsave; + if (seq.seq_state_last_loadsave != 200) + temp_int = seq.seq_state_last_loadsave; else temp_int = 0; mode = 0; @@ -6310,8 +6274,8 @@ void UI_func_save_performance(uint8_t param) if (check_sd_performance_exists(temp_int)) { get_sd_performance_name_json(temp_int); - if ( seq_name_temp[0] != 0 ) - lcd.show(1, 5, 11, seq_name_temp); + if ( seq.seq_name_temp[0] != 0 ) + lcd.show(1, 5, 11, seq.seq_name_temp); else lcd.print(" -- DATA --"); } @@ -6354,7 +6318,7 @@ void UI_func_save_performance(uint8_t param) SD.remove(tmp); } lcd.show(1, 0, 16, "Done."); - seq_state_last_loadsave = temp_int; + seq.seq_state_last_loadsave = temp_int; delay(MESSAGE_WAIT_TIME); LCDML.FUNC_goBackToMenu(); } @@ -6387,8 +6351,8 @@ void UI_func_save_performance(uint8_t param) } else if (check_sd_performance_exists(temp_int)) { get_sd_performance_name_json(temp_int); - if ( seq_name_temp[0] != 0 ) - lcd.show(1, 5, 11, seq_name_temp); else + if ( seq.seq_name_temp[0] != 0 ) + lcd.show(1, 5, 11, seq.seq_name_temp); else lcd.print("-- DATA --"); } else lcd.print(" "); @@ -6503,12 +6467,12 @@ void UI_func_smart_filter(uint8_t param) if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) - smartfilter = !smartfilter; + seq.smartfilter = !seq.smartfilter; else if (LCDML.BT_checkUp()) - smartfilter = !smartfilter; + seq.smartfilter = !seq.smartfilter; } lcd.setCursor(0, 1); - if (smartfilter) lcd.print(F("[ON ]")); else lcd.print(F("[OFF]")); + if (seq.smartfilter) lcd.print(F("[ON ]")); else lcd.print(F("[OFF]")); } if (LCDML.FUNC_close()) // ****** STABLE END ********* { @@ -7417,10 +7381,10 @@ void UI_func_set_performance_name(uint8_t param) if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) { - if (mode == 1) ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, false); + if (mode == 1) ui_select_name_state = UI_select_name(1, 1, seq.seq_name_temp, BANK_NAME_LEN - 1, false); } else if (LCDML.BT_checkUp()) { - if (mode == 1) ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, false); + if (mode == 1) ui_select_name_state = UI_select_name(1, 1, seq.seq_name_temp, BANK_NAME_LEN - 1, false); // if (ui_select_name_state == false) { // lcd.setCursor(12, 1); // lcd.print(" "); @@ -7429,7 +7393,7 @@ void UI_func_set_performance_name(uint8_t param) // lcd.setCursor(11, 1); // lcd.print("]"); // lcd.blink(); - // ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, true); + // ui_select_name_state = UI_select_name(1, 1, seq.seq_name_temp, BANK_NAME_LEN - 1, true); // } } } @@ -7438,10 +7402,10 @@ void UI_func_set_performance_name(uint8_t param) if (mode == 1) { - ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, false); + ui_select_name_state = UI_select_name(1, 1, seq.seq_name_temp, BANK_NAME_LEN - 1, false); if (ui_select_name_state == true) { - strcpy( seq_name, seq_name_temp); + strcpy( seq.seq_name, seq.seq_name_temp); mode = 0xff; lcd.noBlink(); lcd.setCursor(0, 1); @@ -7454,10 +7418,10 @@ void UI_func_set_performance_name(uint8_t param) if (mode == 0 ) { mode = 1; - strcpy(seq_name_temp, seq_name); + strcpy(seq.seq_name_temp, seq.seq_name); lcd.setCursor(0, 1); lcd.print(F("[ ] ")); - ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, true); + ui_select_name_state = UI_select_name(1, 1, seq.seq_name_temp, BANK_NAME_LEN - 1, true); lcd.blink(); } } @@ -8652,7 +8616,7 @@ void lcd_special_chars(uint8_t mode) void lcd_display_delay_sync(uint8_t sync) { lcd.show(0, 0, LCD_cols - 2, "Delay Sync"); - if (seq_running == false)lcd.show(1, 0, 10, "MIDI Sync "); else lcd.show(1, 0, 10, "Seq. Sync "); + if (seq.seq_running == false)lcd.show(1, 0, 10, "MIDI Sync "); else lcd.show(1, 0, 10, "Seq. Sync "); switch (sync) { case 1: @@ -8683,7 +8647,7 @@ void lcd_display_delay_sync(uint8_t sync) lcd.show(1, 10, 6, "1/1"); break; } - if (seq_running == false) { + if (seq.seq_running == false) { uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[sync] / midi_bpm + 0.5); if (midi_sync_delay_time > DELAY_MAX_TIME) @@ -8699,7 +8663,7 @@ void lcd_display_delay_sync(uint8_t sync) } } else { - uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[sync] / seq_bpm); + uint16_t midi_sync_delay_time = uint16_t(60000.0 * midi_ticks_factor[sync] / seq.seq_bpm); delay_fx[selected_instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX * 10)); } lcd.show(1, 15, 1, "!"); diff --git a/dexed_sd.cpp b/dexed_sd.cpp index 3fd9ba0..e86ab4a 100644 --- a/dexed_sd.cpp +++ b/dexed_sd.cpp @@ -33,6 +33,7 @@ using namespace TeensyTimerTool; #include "dexed_sd.h" #include "synth_dexed.h" #if NUM_DRUMS > 0 +#include "sequencer.h" #include "drums.h" extern void set_drums_volume(float vol); extern drum_config_t drum_config[]; @@ -43,31 +44,7 @@ extern void check_configuration_dexed(uint8_t instance_id); extern void check_configuration_performance(void); extern void check_configuration_fx(void); extern void sequencer(); -extern float drums_volume; -extern uint8_t seq_chain_lenght; -extern uint8_t seq_data[NUM_SEQ_PATTERN][16]; -extern uint8_t seq_vel[NUM_SEQ_PATTERN][16]; -extern uint8_t seq_patternchain[4][NUM_SEQ_TRACKS]; -extern uint8_t seq_content_type[NUM_SEQ_PATTERN]; -extern uint8_t seq_track_type[NUM_SEQ_TRACKS]; -extern uint8_t seq_chord_key_ammount; -extern uint8_t seq_element_shift; -extern int seq_oct_shift; -extern int seq_transpose; -extern int seq_tempo_ms; -extern int seq_bpm; -extern bool arp_play_basenote; -extern bool seq_running; -extern uint8_t arp_speed; -extern uint8_t arp_lenght; -extern uint8_t arp_style; -extern uint8_t seq_chord_velocity; -extern uint8_t seq_chord_dexed_inst; -extern uint8_t seq_inst_dexed[NUM_SEQ_TRACKS]; -extern uint8_t seq_step; -extern uint8_t seq_chain_active_step; -extern char seq_name[FILENAME_LEN]; -extern char seq_name_temp[FILENAME_LEN]; +extern sequencer_t seq; extern PeriodicTimer timer1; extern float midi_volume_transform(uint8_t midi_amp); extern void set_sample_note(uint8_t sample, uint8_t note); @@ -490,8 +467,8 @@ bool load_sd_drumsettings_json(uint8_t number) serializeJsonPretty(data_json, Serial); Serial.println(); #endif - drums_volume = data_json["drums_volume"]; - set_drums_volume(drums_volume); + seq.drums_volume = data_json["drums_volume"]; + set_drums_volume(seq.drums_volume); for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG - 1; i++) { uint8_t drumnumber = 0; @@ -556,7 +533,7 @@ bool save_sd_drumsettings_json(uint8_t number) json = SD.open(filename, FILE_WRITE); if (json) { - data_json["drums_volume"] = drums_volume; + data_json["drums_volume"] = seq.drums_volume; for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG - 1; i++) { data_json["note"][i] = get_sample_note(i); @@ -1101,8 +1078,8 @@ bool save_sd_seq_sub_vel_json(uint8_t seq_number) Serial.print(F(" to ")); Serial.println(filename); #endif - int total = sizeof(seq_vel); - int columns = sizeof(seq_vel[0]); + int total = sizeof(seq.seq_vel); + int columns = sizeof(seq.seq_vel[0]); int rows = total / columns; AudioNoInterrupts(); SD.begin(); @@ -1113,7 +1090,7 @@ bool save_sd_seq_sub_vel_json(uint8_t seq_number) 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]; + data_json["seq_velocity"][count] = seq.seq_vel[i][j]; count++; } } @@ -1157,8 +1134,8 @@ bool save_sd_seq_sub_patterns_json(uint8_t seq_number) Serial.print(F(" to ")); Serial.println(filename); #endif - int total = sizeof(seq_data); - int columns = sizeof(seq_data[0]); + int total = sizeof(seq.seq_data); + int columns = sizeof(seq.seq_data[0]); int rows = total / columns; AudioNoInterrupts(); SD.begin(); @@ -1169,7 +1146,7 @@ bool save_sd_seq_sub_patterns_json(uint8_t seq_number) 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]; + data_json["seq_data"][count] = seq.seq_data[i][j]; count++; } } @@ -1203,7 +1180,7 @@ bool save_sd_performance_json(uint8_t seq_number) bool seq_was_running = false; seq_number = constrain(seq_number, VELOCITY_CONFIG_MIN, VELOCITY_CONFIG_MAX); - if (seq_running == true ) { + if (seq.seq_running == true ) { seq_was_running = true; handleStop(); } @@ -1240,8 +1217,8 @@ bool save_sd_performance_json(uint8_t seq_number) Serial.print(F(" to ")); Serial.println(filename); #endif - int total = sizeof(seq_patternchain); - int columns = sizeof(seq_patternchain[0]); + int total = sizeof(seq.seq_patternchain); + int columns = sizeof(seq.seq_patternchain[0]); int rows = total / columns; Serial.print(F(" ")); SD.remove(filename); @@ -1257,40 +1234,40 @@ bool save_sd_performance_json(uint8_t seq_number) 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]; + data_json["seq_patternchain"][count] = seq.seq_patternchain[i][j]; count++; } } count = 0; - data_json["seq_tempo_ms"] = seq_tempo_ms ; - data_json["seq_bpm"] = seq_bpm; - data_json["arp_play_basenote"] = arp_play_basenote; - data_json["arp_speed"] = arp_speed; - data_json["arp_lenght"] = arp_lenght; - data_json["arp_style"] = arp_style; - data_json["seq_chord_velocity"] = seq_chord_velocity; - data_json["seq_chord_dexed_inst"] = seq_chord_dexed_inst; - data_json["seq_chain_lenght"] = seq_chain_lenght; - data_json["seq_transpose"] = seq_transpose; - data_json["chord_key_ammount"] = seq_chord_key_ammount; - data_json["seq_oct_shift"] = seq_oct_shift; - data_json["seq_element_shift"] = seq_element_shift; + data_json["seq_tempo_ms"] = seq.seq_tempo_ms ; + data_json["seq_bpm"] = seq.seq_bpm; + data_json["arp_play_basenote"] = seq.arp_play_basenote; + data_json["arp_speed"] = seq.arp_speed; + data_json["arp_lenght"] = seq.arp_lenght; + data_json["arp_style"] = seq.arp_style; + data_json["seq_chord_velocity"] = seq.seq_chord_velocity; + data_json["seq_chord_dexed_inst"] = seq.seq_chord_dexed_inst; + data_json["seq_chain_lenght"] = seq.seq_chain_lenght; + data_json["seq_transpose"] = seq.seq_transpose; + data_json["chord_key_ammount"] = seq.seq_chord_key_ammount; + data_json["seq_oct_shift"] = seq.seq_oct_shift; + data_json["seq_element_shift"] = seq.seq_element_shift; for (uint8_t i = 0; i < MAX_DEXED; i++) { data_json["bank"][i] = configuration.performance.bank[i]; data_json["voice"][i] = configuration.performance.voice[i]; } - 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.seq_track_type); i++) { + data_json["track_type"][i] = seq.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 < sizeof(seq.seq_content_type); i++) { + data_json["content_type"][i] = seq.seq_content_type[i]; } - for (uint8_t i = 0; i < sizeof(seq_inst_dexed); i++) { - data_json["seq_inst_dexed"][i] = seq_inst_dexed[i]; + for (uint8_t i = 0; i < sizeof(seq.seq_inst_dexed); i++) { + data_json["seq_inst_dexed"][i] = seq.seq_inst_dexed[i]; } for (uint8_t i = 0; i < FILENAME_LEN; i++) { - data_json["seq_name"][i] = seq_name[i]; + data_json["seq_name"][i] = seq.seq_name[i]; } #ifdef DEBUG Serial.println(F("Write JSON data:")); @@ -1363,7 +1340,7 @@ bool check_performance_directory(uint8_t seq_number) void get_sd_performance_name_json(uint8_t seq_number) { seq_number = constrain(seq_number, 0, 99); - memset(seq_name_temp, 0, FILENAME_LEN); + memset(seq.seq_name_temp, 0, FILENAME_LEN); if (sd_card > 0) { File json; @@ -1388,7 +1365,7 @@ void get_sd_performance_name_json(uint8_t seq_number) } if (data_json["seq_name"][0] != 0) { for (uint8_t i = 0; i < FILENAME_LEN; i++) { - seq_name_temp[i] = data_json["seq_name"][i]; + seq.seq_name_temp[i] = data_json["seq_name"][i]; } } @@ -1432,14 +1409,14 @@ bool load_sd_seq_sub_vel_json(uint8_t seq_number) serializeJsonPretty(data_json, Serial); Serial.println(); #endif - int total = sizeof(seq_vel); - int columns = sizeof(seq_vel[0]); + int total = sizeof(seq.seq_vel); + int columns = sizeof(seq.seq_vel[0]); int rows = total / columns; int 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]; + seq.seq_vel[i][j] = data_json["seq_velocity"][count]; count++; } } @@ -1501,15 +1478,15 @@ bool load_sd_seq_sub_patterns_json(uint8_t seq_number) serializeJsonPretty(data_json, Serial); Serial.println(); #endif - int total = sizeof(seq_data); - int columns = sizeof(seq_data[0]); + int total = sizeof(seq.seq_data); + int columns = sizeof(seq.seq_data[0]); int rows = total / columns; int count = 0; 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]; + seq.seq_data[i][j] = data_json["seq_data"][count]; count++; } } @@ -1538,10 +1515,10 @@ bool load_sd_performance_json(uint8_t seq_number) { bool seq_was_running = false; - if (seq_running) + if (seq.seq_running) { seq_was_running = true; - seq_running = false; + seq.seq_running = false; } dac_mute(); handleStop(); @@ -1578,52 +1555,52 @@ bool load_sd_performance_json(uint8_t seq_number) serializeJsonPretty(data_json, Serial); Serial.println(); #endif - int total = sizeof(seq_patternchain); - int columns = sizeof(seq_patternchain[0]); + int total = sizeof(seq.seq_patternchain); + int columns = sizeof(seq.seq_patternchain[0]); int rows = total / columns; int 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]; + seq.seq_patternchain[i][j] = data_json["seq_patternchain"][count]; count++; } } - for (uint8_t i = 0; i < sizeof(seq_track_type); i++) + for (uint8_t i = 0; i < sizeof(seq.seq_track_type); i++) { - seq_track_type[i] = data_json["track_type"][i]; + seq.seq_track_type[i] = data_json["track_type"][i]; } - for (uint8_t i = 0; i < sizeof(seq_content_type); i++) + for (uint8_t i = 0; i < sizeof(seq.seq_content_type); i++) { - seq_content_type[i] = data_json["content_type"][i]; + seq.seq_content_type[i] = data_json["content_type"][i]; } - for (uint8_t i = 0; i < sizeof(seq_inst_dexed); i++) + for (uint8_t i = 0; i < sizeof(seq.seq_inst_dexed); i++) { - seq_inst_dexed[i] = data_json["seq_inst_dexed"][i]; + seq.seq_inst_dexed[i] = data_json["seq_inst_dexed"][i]; } if (data_json["seq_name"][0] != 0) { for (uint8_t i = 0; i < FILENAME_LEN; i++) { - seq_name[i] = data_json["seq_name"][i]; + seq.seq_name[i] = data_json["seq_name"][i]; } } count = 0; - seq_tempo_ms = data_json["seq_tempo_ms"] ; - seq_bpm = data_json["seq_bpm"]; - arp_play_basenote = data_json["arp_play_basenote"]; - arp_speed = data_json["arp_speed"] ; - arp_lenght = data_json["arp_lenght"]; - arp_style = data_json["arp_style"]; - seq_chord_velocity = data_json["seq_chord_velocity"]; - seq_chord_dexed_inst = data_json["seq_chord_dexed_inst"] ; - seq_chain_lenght = data_json["seq_chain_lenght"]; - seq_transpose = data_json["seq_transpose"]; - seq_chord_key_ammount = data_json["chord_key_ammount"]; - seq_oct_shift = data_json["seq_oct_shift"]; - seq_element_shift = data_json["seq_element_shift"]; + seq.seq_tempo_ms = data_json["seq_tempo_ms"] ; + seq.seq_bpm = data_json["seq_bpm"]; + seq.arp_play_basenote = data_json["arp_play_basenote"]; + seq.arp_speed = data_json["arp_speed"] ; + seq.arp_lenght = data_json["arp_lenght"]; + seq.arp_style = data_json["arp_style"]; + seq.seq_chord_velocity = data_json["seq_chord_velocity"]; + seq.seq_chord_dexed_inst = data_json["seq_chord_dexed_inst"] ; + seq.seq_chain_lenght = data_json["seq_chain_lenght"]; + seq.seq_transpose = data_json["seq_transpose"]; + seq.seq_chord_key_ammount = data_json["chord_key_ammount"]; + seq.seq_oct_shift = data_json["seq_oct_shift"]; + seq.seq_element_shift = data_json["seq_element_shift"]; for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { configuration.performance.bank[instance_id] = data_json["bank"][instance_id]; @@ -1644,15 +1621,15 @@ bool load_sd_performance_json(uint8_t seq_number) set_fx_params();*/ dac_unmute(); - seq_step = 0; - seq_chain_active_step = 0; + seq.seq_step = 0; + seq.seq_chain_active_step = 0; if (seq_was_running) { - timer1.begin(sequencer, seq_tempo_ms / 2); - seq_running = true; + timer1.begin(sequencer, seq.seq_tempo_ms / 2); + seq.seq_running = true; } else - timer1.begin(sequencer, seq_tempo_ms / 2, false); + timer1.begin(sequencer, seq.seq_tempo_ms / 2, false); return (true); } #ifdef DEBUG diff --git a/midi_devices.hpp b/midi_devices.hpp index a98481f..1185ab0 100644 --- a/midi_devices.hpp +++ b/midi_devices.hpp @@ -25,10 +25,11 @@ #define MIDI_DEVICES_H #include "config.h" +#include "sequencer.h" extern config_t configuration; -extern uint8_t seq_note_in; -extern uint8_t seq_note_in_velocity; +extern sequencer_t seq; + /* #if defined(MIDI_DEVICE_USB) #include #endif */ @@ -83,8 +84,8 @@ void MD_sendControlChange(uint8_t channel, uint8_t cc, uint8_t value); #ifdef MIDI_DEVICE_DIN void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNumber, byte inVelocity) { - seq_note_in=inNumber; - seq_note_in_velocity=inVelocity; + seq.seq_note_in=inNumber; + seq.seq_note_in_velocity=inVelocity; handleNoteOn(inChannel, inNumber, inVelocity); #ifdef DEBUG Serial.print(F("[MIDI_DIN] NoteOn")); @@ -584,8 +585,8 @@ void handleSystemReset_MIDI_DEVICE_DIN(void) #ifdef MIDI_DEVICE_USB_HOST void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNumber, byte inVelocity) { - seq_note_in=inNumber; - seq_note_in_velocity=inVelocity; + seq.seq_note_in=inNumber; + seq.seq_note_in_velocity=inVelocity; handleNoteOn(inChannel, inNumber, inVelocity); #ifdef DEBUG Serial.print(F("[MIDI_USB_HOST] NoteOn")); diff --git a/sequencer.cpp b/sequencer.cpp index 5952da7..95b6645 100644 --- a/sequencer.cpp +++ b/sequencer.cpp @@ -20,167 +20,168 @@ extern float get_sample_vol_max(uint8_t); extern float get_sample_p_offset(uint8_t); boolean interrupt_swapper = false; +sequencer_t seq; void seq_live_recording(void) { //record to sequencer if sequencer menu is active and recording is active - if (seq_note_in > 0 && seq_recording == true && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) + if (seq.seq_note_in > 0 && seq.seq_recording == true && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_seq_pattern_editor)) { - seq_data[seq_active_track][seq_step] = seq_note_in; + seq.seq_data[seq.seq_active_track][seq.seq_step] = seq.seq_note_in; if ( get_sample_note(activesample) > 209 ) // pitched sample { - seq_vel[seq_active_track][seq_step] = get_sample_note(activesample); + seq.seq_vel[seq.seq_active_track][seq.seq_step] = get_sample_note(activesample); } else - seq_vel[seq_active_track][seq_step] = seq_note_in_velocity; + seq.seq_vel[seq.seq_active_track][seq.seq_step] = seq.seq_note_in_velocity; - seq_note_in = 0; - seq_note_in_velocity = 0; + seq.seq_note_in = 0; + seq.seq_note_in_velocity = 0; } } void sequencer_part1(void) { - //if (seq_note_in > 0 && seq_note_in < 62 && seq_recording == false ) { - //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 - 1] + seq_transpose , 0); - //if (seq_note_in>65)seq_note_in=seq_note_in-12; - //seq_transpose = seq_note_in % 12 ; - //seq_transpose=seq_transpose-12; - //seq_note_in = 0; + //if (seq.seq_note_in > 0 && seq.seq_note_in < 62 && seq.seq_recording == false ) { + //handleNoteOff(configuration.dexed[0].midi_channel, seq.seq_data[3][seq.seq_step] + seq.seq_transpose , 0); + //handleNoteOff(configuration.dexed[0].midi_channel, seq.seq_data[3][seq.seq_step - 1] + seq.seq_transpose , 0); + //if (seq.seq_note_in>65)seq.seq_note_in=seq.seq_note_in-12; + //seq.seq_transpose = seq.seq_note_in % 12 ; + //seq.seq_transpose=seq.seq_transpose-12; + //seq.seq_note_in = 0; //} seq_live_recording(); for (uint8_t d = 0; d < NUM_SEQ_TRACKS; d++) { - if (seq_patternchain[seq_chain_active_step][d] < NUM_SEQ_PATTERN ) // sequence not empty or muted + if (seq.seq_patternchain[seq.seq_chain_active_step][d] < NUM_SEQ_PATTERN ) // sequence not empty or muted { - if ( seq_track_type[d] == 0) + if ( seq.seq_track_type[d] == 0) { // drum track (drum samples and pitched one-shot samples) - if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0 ) + if (seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] > 0 ) { - if (seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 209) // it is a pitched sample + if (seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] > 209) // it is a pitched sample { // Drum[slot]->setPlaybackRate( pow (2, (inNote - 72) / 12.00) * drum_config[sample].pitch ); get_sample_vol_max(sample) - set_sample_pitch(seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 210 , (float)pow (2, (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 72) / 12.00) * get_sample_p_offset( seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 210 ) ); - handleNoteOn(drum_midi_channel, seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] , 90 ); + set_sample_pitch(seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 210 , (float)pow (2, (seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 72) / 12.00) * get_sample_p_offset( seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 210 ) ); + handleNoteOn(drum_midi_channel, seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] , 90 ); } else // else play normal drum sample - 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]); + handleNoteOn(drum_midi_channel, seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] , seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step]); } } else { - if (seq_data[seq_patternchain[seq_chain_active_step][d]][seq_step] > 0 ) // instrument track + if (seq.seq_data[seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step] > 0 ) // instrument track { - if (seq_track_type[d] == 1 || (seq_track_type[d] == 3 && arp_play_basenote) ) + if (seq.seq_track_type[d] == 1 || (seq.seq_track_type[d] == 3 && seq.arp_play_basenote) ) { - if (seq_data[seq_patternchain[seq_chain_active_step][d]][seq_step] != 130 ) + if (seq.seq_data[seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step] != 130 ) { - handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step], seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]); - seq_prev_note[d] = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step]; - seq_prev_vel[d] = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]; + handleNoteOn(configuration.dexed[seq.seq_inst_dexed[d]].midi_channel, seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step], seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step]); + seq.seq_prev_note[d] = seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step]; + seq.seq_prev_vel[d] = seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step]; } } - else if (seq_track_type[d] == 2 ) //Chords + else if (seq.seq_track_type[d] == 2 ) //Chords { - if (seq_vel[ seq_patternchain[seq_chain_active_step][d]][seq_step] > 199) + if (seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step] > 199) { - //handleNoteOn(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step], seq_chord_velocity); // basenote + //handleNoteOn(configuration.dexed[seq.seq_inst_dexed[d]].midi_channel, seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step], seq.seq_chord_velocity); // basenote - for (uint8_t x = seq_element_shift; x < seq_element_shift + seq_chord_key_ammount; x++) //play chord notes + for (uint8_t x = seq.seq_element_shift; x < seq.seq_element_shift + seq.seq_chord_key_ammount; x++) //play chord notes { - handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + (seq_oct_shift * 12) + seq_arps[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][x], seq_chord_velocity); + handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] + (seq.seq_oct_shift * 12) + seq.seq_arps[seq.seq_vel[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 200][x], seq.seq_chord_velocity); } - seq_prev_note[d] = seq_data[seq_patternchain[seq_chain_active_step][d]][seq_step] + (seq_oct_shift * 12); - seq_prev_vel[d] = seq_vel[seq_patternchain[seq_chain_active_step][d]][seq_step]; + seq.seq_prev_note[d] = seq.seq_data[seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step] + (seq.seq_oct_shift * 12); + seq.seq_prev_vel[d] = seq.seq_vel[seq.seq_patternchain[seq.seq_chain_active_step][d]][seq.seq_step]; } } - if (seq_track_type[d] == 3) { //Arp - arp_step = 0; - arp_counter = 0; - arp_note = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + (seq_oct_shift * 12); - arp_chord = seq_vel[seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200; + if (seq.seq_track_type[d] == 3) { //Arp + seq.arp_step = 0; + seq.arp_counter = 0; + seq.arp_note = seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] + (seq.seq_oct_shift * 12); + seq.arp_chord = seq.seq_vel[seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] - 200; } } // after here not triggered by a key input - arp only - if (seq_track_type[d] == 3) + if (seq.seq_track_type[d] == 3) { //Arp - if (arp_speed == 0 || (arp_speed == 1 && arp_counter == 0) ) { + if (seq.arp_speed == 0 || (seq.arp_speed == 1 && seq.arp_counter == 0) ) { - { if (arp_style == 0) { //arp up - handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_step + seq_element_shift], seq_chord_velocity); - arp_note_prev = arp_note + seq_arps[arp_chord][arp_step + seq_element_shift] ; + { if (seq.arp_style == 0) { //arp up + handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_step + seq.seq_element_shift], seq.seq_chord_velocity); + seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_step + seq.seq_element_shift] ; } - else if (arp_style == 1) { //arp down - handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_lenght - arp_step + seq_element_shift], seq_chord_velocity); - arp_note_prev = arp_note + seq_arps[arp_chord][arp_lenght - arp_step + seq_element_shift] ; + else if (seq.arp_style == 1) { //arp down + handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_lenght - seq.arp_step + seq.seq_element_shift], seq.seq_chord_velocity); + seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_lenght - seq.arp_step + seq.seq_element_shift] ; } - else if (arp_style == 2) { //arp up & down - if (arp_step <= arp_lenght) { - handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_step ], seq_chord_velocity); - arp_note_prev = arp_note + seq_arps[arp_chord][arp_step ] ; + else if (seq.arp_style == 2) { //arp up & down + if (seq.arp_step <= seq.arp_lenght) { + handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_step ], seq.seq_chord_velocity); + seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_step ] ; } else { - handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][arp_lenght * 2 - arp_step ], seq_chord_velocity); - arp_note_prev = arp_note + seq_arps[arp_chord][arp_lenght * 2 - arp_step ] ; + handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_lenght * 2 - seq.arp_step ], seq.seq_chord_velocity); + seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][seq.arp_lenght * 2 - seq.arp_step ] ; } } - else if (arp_style == 3) { //arp random - uint8_t rnd1 = random(arp_lenght); - handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_arps[arp_chord][rnd1 + seq_element_shift] + (seq_oct_shift * 12), seq_chord_velocity); - arp_note_prev = arp_note + seq_arps[arp_chord][rnd1 + seq_element_shift] + (seq_oct_shift * 12); + else if (seq.arp_style == 3) { //arp random + uint8_t rnd1 = random(seq.arp_lenght); + handleNoteOn(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note + seq.seq_arps[seq.arp_chord][rnd1 + seq.seq_element_shift] + (seq.seq_oct_shift * 12), seq.seq_chord_velocity); + seq.arp_note_prev = seq.arp_note + seq.seq_arps[seq.arp_chord][rnd1 + seq.seq_element_shift] + (seq.seq_oct_shift * 12); } } } } } } - seq_noteoffsent[d] = false; + seq.seq_noteoffsent[d] = false; } - arp_counter++; - seq_step++; - if (arp_speed == 0) // Arp Speed 1/16 + seq.arp_counter++; + seq.seq_step++; + if (seq.arp_speed == 0) // Arp Speed 1/16 { - arp_step++; + seq.arp_step++; } else { // Arp Speed 1/8 - if (arp_counter > 1) { - arp_counter = 0; - arp_step++; + if (seq.arp_counter > 1) { + seq.arp_counter = 0; + seq.arp_step++; } } - if (arp_style != 2) { + if (seq.arp_style != 2) { - if ( (arp_step > 1 && seq_arps[arp_chord][arp_step] == 0) || arp_step == arp_lenght) + if ( (seq.arp_step > 1 && seq.seq_arps[seq.arp_chord][seq.arp_step] == 0) || seq.arp_step == seq.arp_lenght) { - arp_step = 0; + seq.arp_step = 0; } } - if (arp_style == 1 || arp_style == 2 ) + if (seq.arp_style == 1 || seq.arp_style == 2 ) { - if (arp_lenght == 0)arp_lenght = 9; + if (seq.arp_lenght == 0)seq.arp_lenght = 9; } - if ( arp_style == 2 ) //only for up&down + if ( seq.arp_style == 2 ) //only for up&down { - if ( (arp_step > 1 && seq_arps[arp_chord][arp_step] == 0) || arp_step == arp_lenght * 2) + if ( (seq.arp_step > 1 && seq.seq_arps[seq.arp_chord][seq.arp_step] == 0) || seq.arp_step == seq.arp_lenght * 2) { - arp_step = 0; + seq.arp_step = 0; } } - if (seq_step > 15) + if (seq.seq_step > 15) { - seq_step = 0; - if (seq_chain_lenght > 0) { - seq_chain_active_step++; - if (seq_chain_active_step > seq_chain_lenght) + seq.seq_step = 0; + if (seq.seq_chain_lenght > 0) { + seq.seq_chain_active_step++; + if (seq.seq_chain_active_step > seq.seq_chain_lenght) { - seq_chain_active_step = 0; + seq.seq_chain_active_step = 0; } } } @@ -191,27 +192,27 @@ void sequencer_part2(void) seq_live_recording(); for (uint8_t d = 0; d < NUM_SEQ_TRACKS; d++) { - if (seq_noteoffsent[d] == false) { - if ( seq_prev_note[d] > 0 && seq_track_type[d] > 0) + if (seq.seq_noteoffsent[d] == false) { + if ( seq.seq_prev_note[d] > 0 && seq.seq_track_type[d] > 0) { - if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] != 130) + if (seq.seq_data[ seq.seq_patternchain[seq.seq_chain_active_step][d] ][seq.seq_step] != 130) { - handleNoteOff(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_prev_note[d] , 0); - seq_noteoffsent[d] = true; + handleNoteOff(configuration.dexed[seq.seq_inst_dexed[d]].midi_channel, seq.seq_prev_note[d] , 0); + seq.seq_noteoffsent[d] = true; } - if (seq_track_type[d] == 2) { //Chords - if ( seq_prev_vel[d] > 199) { - for (uint8_t x = seq_element_shift; x < seq_element_shift + seq_chord_key_ammount; x++) //play chord notes + if (seq.seq_track_type[d] == 2) { //Chords + if ( seq.seq_prev_vel[d] > 199) { + for (uint8_t x = seq.seq_element_shift; x < seq.seq_element_shift + seq.seq_chord_key_ammount; x++) //play chord notes { - handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_arps[seq_prev_vel[d] - 200][x], 0); - seq_noteoffsent[d] = true; + handleNoteOff(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.seq_prev_note[d] + seq.seq_arps[seq.seq_prev_vel[d] - 200][x], 0); + seq.seq_noteoffsent[d] = true; } } } - else if (seq_track_type[d] == 3) + else if (seq.seq_track_type[d] == 3) { //Arp - handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note_prev, 0); - seq_noteoffsent[d] = true; + handleNoteOff(configuration.dexed[seq.seq_chord_dexed_inst].midi_channel, seq.arp_note_prev, 0); + seq.seq_noteoffsent[d] = true; } } } diff --git a/sequencer.h b/sequencer.h index a004732..ef71930 100644 --- a/sequencer.h +++ b/sequencer.h @@ -1,9 +1,11 @@ +#ifndef SEQUENCER_H +#define SEQUENCER_H + typedef struct sequencer_s { float drums_volume; uint8_t seq_active_track = 0; uint8_t seq_menu; - bool seq_button_r = false; #ifdef TEENSY4 bool seq_noteoffsent[NUM_SEQ_TRACKS] = {false, false, false, false, false, false}; uint8_t seq_inst_dexed[NUM_SEQ_TRACKS] = { 0, 0, 1, 1 , 1, 1 }; @@ -118,168 +120,4 @@ typedef struct sequencer_s { #endif } sequencer_t; -sequencer_t seq; - - - - - - - - -float drums_volume; -uint8_t seq_active_track = 0; -uint8_t seq_menu; -bool seq_button_r = false; -#ifdef TEENSY4 -bool seq_noteoffsent[NUM_SEQ_TRACKS] = {false, false, false, false, false, false}; -uint8_t seq_inst_dexed[NUM_SEQ_TRACKS] = { 0, 0, 1, 1 , 1, 1 }; -#else -bool seq_noteoffsent[NUM_SEQ_TRACKS] = {false, false}; -uint8_t seq_inst_dexed[NUM_SEQ_TRACKS] = { 0, 0 }; -#endif -uint8_t seq_step = 0; -bool seq_running = false; -bool seq_recording = false; -bool smartfilter = true; -uint8_t seq_state_last_loadsave = 200; -char seq_name[FILENAME_LEN]; -char seq_name_temp[FILENAME_LEN]; -uint8_t seq_note_in; -uint8_t seq_note_in_velocity; -int seq_transpose; - -uint8_t seq_chord_dexed_inst = 0; -uint8_t seq_chord_velocity = 60; -uint8_t seq_chord_key_ammount = 4; -uint8_t seq_element_shift = 0; -int seq_oct_shift = 0; -uint8_t arp_style = 0; // up, down, up&down, random - -uint8_t seq_arps[6][23] = { - 0, 4, 7, 12, 16, 19, 24, 28, 31, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 0, //major - 0, 3, 7, 12, 15, 19, 24, 27, 31, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 0, //minor - 0, 4, 7, 10, 12, 16, 19, 22, 24, 28, 31, 34, 36, 40, 43, 46, 48, 52, 55, 58, 60, 64, 0, //seventh - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 0, //augmented - 0, 3, 6, 12, 15, 18, 24, 27, 30, 36, 39, 42, 48, 51, 54, 60, 63, 66, 72, 75, 78, 84, 0, //dim - 0, 4, 7, 11, 12, 16, 19, 23, 24, 28, 31, 35, 36, 40, 43, 47, 48, 52, 55, 59, 60, 64, 0 //maj7 -}; - -char seq_chord_names[7][4] = { 'M', 'a', 'j', ' ' , //major - 'M', 'i', 'n', ' ' , - 's', 'e', 'v', ' ' , - 'a', 'u', 'g', ' ' , - 'd', 'i', 'm', ' ' , - 'M', 'a', 'j', '7' , - 'N', 'o', 'C', 'd' , - }; - -char arp_style_names[4][3] = { 'u', 'p', ' ', - 'd', 'w', 'n', - 'u', '&', 'd', - 'R', 'N', 'D', - }; -int seq_tempo_ms = 180000; -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_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[NUM_SEQ_TRACKS]; // note_offs for every (instr.) track -uint8_t seq_prev_vel[NUM_SEQ_TRACKS]; -uint8_t arp_step; -uint8_t arp_note; -uint8_t arp_chord = 6; -bool arp_play_basenote = true; -uint8_t arp_note_prev; -uint8_t arp_octave; -uint8_t arp_prev_oct; -uint8_t arp_speed = 0; -uint8_t arp_counter = 0; -uint8_t arp_lenght = 8; -uint8_t seq_data_buffer[16] = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t seq_data[NUM_SEQ_PATTERN][16] = {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 , - 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[NUM_SEQ_PATTERN][16] = {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, - 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_data[10][16] = {69 , 69 , 0 , 69 , 69 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -// 67 , 67 , 0 , 67 , 67 , 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 , -// 55 , 0 , 0 , 0 , 0 , 0 , 52 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -// 57 , 0 , 0 , 0 , 0 , 0 , 53 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -// 74 , 0 , 0 , 72 , 0 , 0 , 74 , 0 , 0 , 0 , 76 , 0 , 0 , 0 , 0 , 0 , -// 74 , 0 , 0 , 72 , 0 , 0 , 71 , 0 , 0 , 0 , 67 , 0 , 0 , 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] = {210, 210, 0, 210, 210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 210, 210, 0, 210, 210, 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, -// 213 , 0 , 0 , 0 , 0 , 0 , 213 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -// 213 , 0 , 0 , 0 , 0 , 0 , 213 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -// 211 , 0 , 0 , 211 , 0 , 0 , 211 , 0 , 0 , 0 , 211 , 0 , 0 , 0 , 0 , 0 , -// 211 , 0 , 0 , 211 , 0 , 0 , 211 , 0 , 0 , 0 , 211 , 0 , 0 , 0 , 0 , 0 , -// 211 , 0 , 0 , 211 , 0 , 0 , 211 , 0 , 0 , 0 , 0 , 0 , 0 , 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 , -// 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 , -// 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -// 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 77 , 0 , 0 , -// 55 , 0 , 0 , 0 , 0 , 0 , 52 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -// 57 , 0 , 0 , 0 , 0 , 0 , 53 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -// 74 , 0 , 0 , 72 , 0 , 0 , 74 , 0 , 0 , 0 , 76 , 130 , 130 , 130 , 130 , 0 , -// 74 , 0 , 0 , 72 , 0 , 0 , 71 , 0 , 0 , 0 , 67 , 130 , 0 , 0 , 0 , 0 , -// 69 , 0 , 0 , 76 , 0 , 0 , 69 , 130 , 130 , 130 , 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, -// 105, 80, 105, 70, 106, 98, 106, 70, 126, 97, 106, 70, 106, 99, 90, 65, -// 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 120, 60, 120, 120, 0, 0, -// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -// 0, 0, 1, 10, 30, 50, 70, 90, 100, 127, 100, 60, 40, 30, 0, 200, -// 200, 200, 200, 200, 200, 200, 201, 0, 0, 0, 0, 0, 0, 0, 0, 200, -// 201, 200, 200, 200, 200, 200, 200, 200, 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_content_type[NUM_SEQ_PATTERN] = { 0, 0, 0, 0 , 0, 0, 0 , 0 , 0 , 0 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord or Arpeggio -#ifdef TEENSY4 -uint8_t seq_patternchain[4][NUM_SEQ_TRACKS] = { 0 , 2 , 6 , 9 , 99, 99, - 1 , 2 , 5 , 8 , 99, 99, - 0 , 2 , 6 , 9 , 99, 99, - 1 , 2 , 5 , 7 , 99, 99 - }; - -uint8_t seq_track_type[NUM_SEQ_TRACKS] = { 0, 0, 1, 1, 1, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp -#else -uint8_t seq_patternchain[4][NUM_SEQ_TRACKS] = { 0 , 2 , - 1 , 2 , - 0 , 2 , - 1 , 2 , - }; -uint8_t seq_track_type[NUM_SEQ_TRACKS] = { 0, 0 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp #endif