diff --git a/MicroDexed.ino b/MicroDexed.ino index 956893c..7eccab3 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -289,13 +289,15 @@ char g_voice_name[NUM_DEXED][VOICE_NAME_LEN]; char g_bank_name[NUM_DEXED][BANK_NAME_LEN]; char receive_bank_filename[FILENAME_LEN]; uint8_t selected_instance_id = 0; -uint8_t seqsteptimer=0; -uint32_t seqtimer_old=5000; +uint8_t seqsteptimer = 0; +uint32_t seqtimer_old = 0; +bool seq_running = false; //uint8_t seqdata[1][16]={48,48,54,48,49,54,54,48,54,54,48,54,49,54,54,54}; //uint8_t seqdata[1][16]={72,72,78,72,75,78,78,72,78,78,72,78,75,78,78,78}; -uint8_t seqdata[3][16]={72,72, 0,72,75, 0, 0,72, 0, 0,72, 0,75, 0, 0, 0, - 73,73, 0,73, 0, 0,73,73, 0, 0,73,73, 0, 0, 0, 0, - 78, 0, 0,78, 0, 0,78, 0,78,78, 0, 0, 0, 0, 0, 0}; +uint8_t seqdata[3][16] = {72, 72, 0, 72, 75, 0, 0, 72, 0, 0, 72, 0, 75, 0, 0, 0, + 73, 73, 0, 73, 0, 0, 73, 73, 0, 0, 73, 73, 0, 0, 0, 0, + 78, 0, 0, 78, 0, 0, 78, 0, 78, 78, 0, 0, 0, 0, 0, 0 + }; #ifdef TEENSY4 #if NUM_DEXED>1 int8_t midi_decay[NUM_DEXED] = { -1, -1}; @@ -606,22 +608,28 @@ void loop() ENCODER[ENC_L].update(); ENCODER[ENC_R].update(); - //sequencer - if (sequencer_timer > seqtimer_old +125) - - { + if (seq_running) { + + if (sequencer_timer > seqtimer_old + 125) -seqtimer_old=sequencer_timer; -if (seqdata[0][seqsteptimer]>0) {handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[0][seqsteptimer] , 99);} -if (seqdata[1][seqsteptimer]>0) {handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[1][seqsteptimer] , 99);} -if (seqdata[2][seqsteptimer]>0) {handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[2][seqsteptimer] , 99);} -seqsteptimer++; + { -} -if (seqsteptimer>15)seqsteptimer=0; + seqtimer_old = sequencer_timer; + if (seqdata[0][seqsteptimer] > 0) { + handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[0][seqsteptimer] , 99); + } + if (seqdata[1][seqsteptimer] > 0) { + handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[1][seqsteptimer] , 99); + } + if (seqdata[2][seqsteptimer] > 0) { + handleNoteOn(DRUM_MIDI_CHANNEL, seqdata[2][seqsteptimer] , 99); + } + seqsteptimer++; + + } + if (seqsteptimer > 15)seqsteptimer = 0; -//Serial.print(seqsteptimer); -//Serial.println(""); + } #ifdef ENABLE_LCD_UI LCDML.loop();