Added basic External Beat clock mode. Still needs a lot of work

This commit is contained in:
--global
2023-05-12 01:38:46 +03:00
parent 2d3c3dd683
commit c63418fb37

View File

@ -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;
}
}