From c52b2262238009646ff336243fa1b29c55d98220 Mon Sep 17 00:00:00 2001 From: midilab Date: Fri, 6 Jul 2018 05:00:55 -0300 Subject: [PATCH] Change the calling order of callbacks to: 1- 96 PPQN 2- 32 PPQN 3- 16 PPQN For more complex process of sequencers this order makes more sense. --- src/uClock.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/uClock.cpp b/src/uClock.cpp index 061fe56..c73fc01 100755 --- a/src/uClock.cpp +++ b/src/uClock.cpp @@ -151,6 +151,11 @@ void uClockClass::setTempo(uint16_t _tempo) if ( tempo == _tempo ) { return; } + + if ( _tempo > 300 || _tempo == 0 ) { + return; + } + uint8_t tmpSREG = SREG; cli(); tempo = _tempo; @@ -240,12 +245,16 @@ void uClockClass::handleTimerInt() counter = interval; + if (onClock96PPQNCallback) { + onClock96PPQNCallback(&div96th_counter); + } + if (mod6_counter == 0) { - if (onClock16PPQNCallback) { - onClock16PPQNCallback(&div16th_counter); - } if (onClock32PPQNCallback) { onClock32PPQNCallback(&div32th_counter); + } + if (onClock16PPQNCallback) { + onClock16PPQNCallback(&div16th_counter); } div16th_counter++; div32th_counter++; @@ -257,10 +266,6 @@ void uClockClass::handleTimerInt() } div32th_counter++; } - - if (onClock96PPQNCallback) { - onClock96PPQNCallback(&div96th_counter); - } div96th_counter++; mod6_counter++;