Added basic External Beat clock mode. Still needs a lot of work
This commit is contained in:
@ -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,6 +183,8 @@ void externalClock() {
|
||||
lastExtPulseTime = newExtPulseTime;
|
||||
newExtPulseTime = millis();
|
||||
|
||||
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++) {
|
||||
@ -186,7 +192,6 @@ void externalClock() {
|
||||
}
|
||||
}
|
||||
|
||||
if (masterClockMode == 1) { // EXT-24
|
||||
if (!isPlaying) {
|
||||
isPlaying = true;
|
||||
}
|
||||
@ -196,6 +201,12 @@ void externalClock() {
|
||||
} else {
|
||||
pulseCount = 0;
|
||||
}
|
||||
} else if (masterClockMode == 2) { // EXT-Beat
|
||||
if (!isPlaying) {
|
||||
isPlaying = true;
|
||||
}
|
||||
pulseCount = 0;
|
||||
tickCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user