diff --git a/software/GToE/GToE.ino b/software/GToE/GToE.ino index a7b7d37..2374be8 100644 --- a/software/GToE/GToE.ino +++ b/software/GToE/GToE.ino @@ -151,15 +151,19 @@ void clock() { sendTriggers(); } + if (masterClockMode == 2) { + updateTiming(); + } + //this part gets the Pulse and Ticks ticking //it's placed after the triggers to avoid problems on the start (when pulseCount==0) tickCount++; - if (masterClockMode == 0) { + if (masterClockMode == 0 || 2) { if (tickCount == pulsePeriod) { tickCount = 0; if (pulseCount < (PPQN-1)) { //-1 is here to avoid extra IF to reset to 0 pulseCount++; - } else { + } else if (masterClockMode == 0) { pulseCount = 0; } } @@ -179,14 +183,15 @@ void externalClock() { lastExtPulseTime = newExtPulseTime; newExtPulseTime = millis(); - //reset cycles if there was no pulses for a while - if ((newExtPulseTime - lastExtPulseTime) > 125) { //125ms is 20bpm - for (int i = 0; i<6; i++) { - channelPulseCount[i] = 0; - } - } - if (masterClockMode == 1) { // EXT-24 + + //reset cycles if there was no pulses for a while + if ((newExtPulseTime - lastExtPulseTime) > 125) { //125ms is 20bpm + for (int i = 0; i<6; i++) { + channelPulseCount[i] = 0; + } + } + if (!isPlaying) { isPlaying = true; } @@ -195,7 +200,13 @@ void externalClock() { pulseCount++; } else { pulseCount = 0; - } + } + } else if (masterClockMode == 2) { // EXT-Beat + if (!isPlaying) { + isPlaying = true; + } + pulseCount = 0; + tickCount = 0; } }