From 1222d7af54db0f87feb6b96592c1868d9cba0fd6 Mon Sep 17 00:00:00 2001 From: midilab Date: Sun, 30 Mar 2025 09:45:21 -0300 Subject: [PATCH] update new api call signatue on examples --- .../AcidStepSequencer/AcidStepSequencer.ino | 4 +- .../DefaultUserInterface.ino | 8 ++-- .../GenericMasterOrExternalSync.ino | 40 ++++++++++++++++--- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/examples/AcidStepSequencer/AcidStepSequencer.ino b/examples/AcidStepSequencer/AcidStepSequencer.ino index 41f3928..474a61e 100644 --- a/examples/AcidStepSequencer/AcidStepSequencer.ino +++ b/examples/AcidStepSequencer/AcidStepSequencer.ino @@ -101,7 +101,7 @@ void onStepCallback(uint32_t tick) } // The callback function wich will be called by uClock each Pulse of 96PPQN clock resolution. -void onPPQNCallback(uint32_t tick) +void onOutputPPQNCallback(uint32_t tick) { // handle note on stack for ( uint8_t i = 0; i < NOTE_STACK_SIZE; i++ ) { @@ -158,7 +158,7 @@ void setup() uClock.init(); // Set the callback function for the clock output to send MIDI Sync message. - uClock.setOnPPQN(onPPQNCallback); + uClock.setOnOutputPPQN(onOutputPPQNCallback); // for MIDI sync uClock.setOnSync24(onSync24Callback); diff --git a/examples/AcidStepSequencer/DefaultUserInterface.ino b/examples/AcidStepSequencer/DefaultUserInterface.ino index 904d651..ad8bed9 100644 --- a/examples/AcidStepSequencer/DefaultUserInterface.ino +++ b/examples/AcidStepSequencer/DefaultUserInterface.ino @@ -84,15 +84,15 @@ void processInterface() processPots(); } -void tempoInterface(uint32_t * tick) +void tempoInterface(uint32_t tick) { // BPM led indicator - if ( !(*tick % (96)) || (*tick == 0) ) { // first compass step will flash longer + if ( !(tick % (96)) || (tick == 0) ) { // first compass step will flash longer _bpm_blink_timer = 8; digitalWrite(PLAY_STOP_LED_PIN , HIGH); - } else if ( !(*tick % (24)) ) { // each quarter led on + } else if ( !(tick % (24)) ) { // each quarter led on digitalWrite(PLAY_STOP_LED_PIN , HIGH); - } else if ( !(*tick % _bpm_blink_timer) ) { // get led off + } else if ( !(tick % _bpm_blink_timer) ) { // get led off digitalWrite(PLAY_STOP_LED_PIN , LOW); _bpm_blink_timer = 1; } diff --git a/examples/GenericMasterOrExternalSync/GenericMasterOrExternalSync.ino b/examples/GenericMasterOrExternalSync/GenericMasterOrExternalSync.ino index 366e938..7cef51b 100644 --- a/examples/GenericMasterOrExternalSync/GenericMasterOrExternalSync.ino +++ b/examples/GenericMasterOrExternalSync/GenericMasterOrExternalSync.ino @@ -4,7 +4,7 @@ bool _external_sync_on = false; // the main uClock PPQN resolution ticking -void onPPQNCallback(uint32_t tick) { +void onOutputPPQNCallback(uint32_t tick) { // tick your sequencers or tickable devices... } @@ -12,11 +12,31 @@ void onStepCallback(uint32_t step) { // triger step data for sequencer device... } +// The callback function called by uClock each Pulse of 1PPQN clock resolution. +void onSync1Callback(uint32_t tick) { + // send sync signal to... +} + +// The callback function called by uClock each Pulse of 2PPQN clock resolution. +void onSync2Callback(uint32_t tick) { + // send sync signal to... +} + +// The callback function called by uClock each Pulse of 4PPQN clock resolution. +void onSync4Callback(uint32_t tick) { + // send sync signal to... +} + // The callback function called by uClock each Pulse of 24PPQN clock resolution. void onSync24Callback(uint32_t tick) { // send sync signal to... } +// The callback function called by uClock each Pulse of 48PPQN clock resolution. +void onSync48Callback(uint32_t tick) { + // send sync signal to... +} + // The callback function called when clock starts by using uClock.start() method. void onClockStartCallback() { // send start signal to... @@ -32,22 +52,30 @@ void setup() { // inits the clock library uClock.init(); - // avaliable resolutions - // [ uClock.PPQN_24, uClock.PPQN_48, uClock.PPQN_96, uClock.PPQN_384, uClock.PPQN_480, uClock.PPQN_960 ] + // avaliable output PPQN resolutions for this example + // [ uClock.PPQN_48, uClock.PPQN_96, uClock.PPQN_384, uClock.PPQN_480, uClock.PPQN_960 ] // not mandatory to call, the default is 96PPQN if not set - uClock.setPPQN(uClock.PPQN_96); + uClock.setOutputPPQN(uClock.PPQN_96); // you need to use at least one! - uClock.setOnPPQN(onPPQNCallback); + uClock.setOnOutputPPQN(onOutputPPQNCallback); uClock.setOnStep(onStepCallback); + // multi sync output signatures avaliable + // normaly used by eurorack modular modules + uClock.setOnSync1(onSync1Callback); + uClock.setOnSync2(onSync2Callback); + uClock.setOnSync4(onSync4Callback); + // midi sync standard uClock.setOnSync24(onSync24Callback); + // some korg machines do 48ppqn + uClock.setOnSync48(onSync48Callback); uClock.setOnClockStart(onClockStartCallback); uClock.setOnClockStop(onClockStopCallback); // set external sync mode? if (_external_sync_on) { - uClock.setMode(uClock.EXTERNAL_CLOCK); + uClock.setClockMode(uClock.EXTERNAL_CLOCK); } // starts clock