diff --git a/software/GToE/GToE.ino b/software/GToE/GToE.ino index 2374be8..6bbb6ed 100644 --- a/software/GToE/GToE.ino +++ b/software/GToE/GToE.ino @@ -58,6 +58,8 @@ byte masterClockMode = 0; // 0 - internal, 1 - external 24ppqn, 2 - external bea unsigned long lastExtPulseTime; unsigned long newExtPulseTime; +bool needPulseReset[6] = {true, true, true, true, true, true}; + unsigned int displayTab = 0; unsigned int displayTabOld; unsigned int insideTab = 0; @@ -151,10 +153,6 @@ 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++; @@ -201,6 +199,7 @@ void externalClock() { } else { pulseCount = 0; } + } else if (masterClockMode == 2) { // EXT-Beat if (!isPlaying) { isPlaying = true; @@ -212,12 +211,23 @@ void externalClock() { void sendTriggers() { + + for (int i = 0; i<6; i++) { + if (playingModes[i] != clockModes[channels[i].mode]) { + needPulseReset[i] = true; + } + } + //switching modes on the beat and resetting channel clock if (pulseCount == 0) { + if (masterClockMode == 2) { + updateTiming(); + } calculateCycles(); for (int i = 0; i<6; i++) { - if (playingModes[i] != clockModes[channels[i].mode]) { + if (needPulseReset[i] == true) { channelPulseCount[i] = 0; + needPulseReset[i] = false; } } }