Added basic External Beat clock mode. Still needs a lot of work
This commit is contained in:
@ -151,15 +151,19 @@ 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++;
|
||||||
if (masterClockMode == 0) {
|
if (masterClockMode == 0 || 2) {
|
||||||
if (tickCount == pulsePeriod) {
|
if (tickCount == pulsePeriod) {
|
||||||
tickCount = 0;
|
tickCount = 0;
|
||||||
if (pulseCount < (PPQN-1)) { //-1 is here to avoid extra IF to reset to 0
|
if (pulseCount < (PPQN-1)) { //-1 is here to avoid extra IF to reset to 0
|
||||||
pulseCount++;
|
pulseCount++;
|
||||||
} else {
|
} else if (masterClockMode == 0) {
|
||||||
pulseCount = 0;
|
pulseCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,14 +183,15 @@ void externalClock() {
|
|||||||
lastExtPulseTime = newExtPulseTime;
|
lastExtPulseTime = newExtPulseTime;
|
||||||
newExtPulseTime = millis();
|
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
|
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) {
|
if (!isPlaying) {
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
}
|
}
|
||||||
@ -196,6 +201,12 @@ void externalClock() {
|
|||||||
} else {
|
} else {
|
||||||
pulseCount = 0;
|
pulseCount = 0;
|
||||||
}
|
}
|
||||||
|
} else if (masterClockMode == 2) { // EXT-Beat
|
||||||
|
if (!isPlaying) {
|
||||||
|
isPlaying = true;
|
||||||
|
}
|
||||||
|
pulseCount = 0;
|
||||||
|
tickCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user