diff --git a/software/GToE/GToE.ino b/software/GToE/GToE.ino index c83a20c..a0b6dce 100644 --- a/software/GToE/GToE.ino +++ b/software/GToE/GToE.ino @@ -189,20 +189,26 @@ void externalClock() { pulseCount = 0; } } + + //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; + } + } } void sendTriggers() { + calculateCycles(); //switching modes on the beat and resetting channel clock if (pulseCount == 0) { for (int i = 0; i<6; i++) { if (playingModes[i] != clockModes[channels[i].mode]) { - // calculateCycles(); this shouldn't be inside the loop. but it was here and it worked channelPulseCount[i] = 0; } } - // calculateCycles(); } //multiplier @@ -221,20 +227,6 @@ void sendTriggers() { } void calculateCycles() { - /*modulation - for (int i = 0; i<6; i++) { - if (channels[i].modulationRange != 0) { - int mod; - if (!channels[i].modulationChannel) { - mod = a1Input; - } else { - mod = a2Input; - } - mod = map (mod, 0, 1023, 0, channels[i].modulationRange); - playingModes[i] = clockModes[channels[i].mode - mod]; //subtracting because the innitiall array is backwards - } - }*/ - for (int i = 0; i<6; i++) { if (channels[i].modulationRange == 0) {