Fixed unwanted offset when going from dividers to /1

This commit is contained in:
--global
2023-05-12 16:24:26 +03:00
parent c63418fb37
commit d067bbb8e0

View File

@ -58,6 +58,8 @@ byte masterClockMode = 0; // 0 - internal, 1 - external 24ppqn, 2 - external bea
unsigned long lastExtPulseTime; unsigned long lastExtPulseTime;
unsigned long newExtPulseTime; unsigned long newExtPulseTime;
bool needPulseReset[6] = {true, true, true, true, true, true};
unsigned int displayTab = 0; unsigned int displayTab = 0;
unsigned int displayTabOld; unsigned int displayTabOld;
unsigned int insideTab = 0; unsigned int insideTab = 0;
@ -151,10 +153,6 @@ void clock() {
sendTriggers(); sendTriggers();
} }
if (masterClockMode == 2) {
updateTiming();
}
//this part gets the Pulse and Ticks ticking //this part gets the Pulse and Ticks ticking
//it's placed after the triggers to avoid problems on the start (when pulseCount==0) //it's placed after the triggers to avoid problems on the start (when pulseCount==0)
tickCount++; tickCount++;
@ -201,6 +199,7 @@ void externalClock() {
} else { } else {
pulseCount = 0; pulseCount = 0;
} }
} else if (masterClockMode == 2) { // EXT-Beat } else if (masterClockMode == 2) { // EXT-Beat
if (!isPlaying) { if (!isPlaying) {
isPlaying = true; isPlaying = true;
@ -212,12 +211,23 @@ void externalClock() {
void sendTriggers() { void sendTriggers() {
//switching modes on the beat and resetting channel clock
if (pulseCount == 0) {
calculateCycles();
for (int i = 0; i<6; i++) { for (int i = 0; i<6; i++) {
if (playingModes[i] != clockModes[channels[i].mode]) { 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 (needPulseReset[i] == true) {
channelPulseCount[i] = 0; channelPulseCount[i] = 0;
needPulseReset[i] = false;
} }
} }
} }