rewrite clock engine for more horse power process between clock calls

pull/5/head
midilab 3 years ago
parent f6d36e76aa
commit 31e632ccda
  1. 15
      README.md
  2. 2
      examples/LeonardoUsbSlaveMidiClockMonitor/LeonardoUsbSlaveMidiClockMonitor.ino
  3. 2
      examples/TeensyUsbMasterMidiClock/TeensyUsbMasterMidiClock.ino
  4. 2
      examples/TeensyUsbSlaveMidiClock/TeensyUsbSlaveMidiClock.ino
  5. 7
      examples/TeensyUsbSlaveMidiClockMonitor/TeensyUsbSlaveMidiClockMonitor.ino
  6. 6
      src/uClock.cpp
  7. 10
      src/uClock.h

@ -97,8 +97,6 @@ void onClockStop() {
}
void setup() {
// drift for USB Teensy
uClock.setDrift(1);
// Inits the clock
uClock.init();
// Set the callback function for the clock output to send MIDI Sync message.
@ -317,16 +315,3 @@ void loop()
//processYourPots();
}
```
## Troubleshooting
If you slave host are not showing correct of close bpm on sync, please try to use the drift variable to adjust. It normaly goes from value 4(good for clock over USB) to 11(good for common MIDI interfaces running at 31250 speed). The default value is 11.
To use MIDI via USB on Leonardo boards please start setting the drift to 4:
uClock.setDrift(4);
For teensy boards and USB Midi try:
uClock.setDrift(1);
Please use uClock.setDrift() before uClock.init();

@ -103,8 +103,6 @@ void setup() {
//
// uClock Setup
//
// Drift for arudino leonardo over USB as MIDI HID
uClock.setSlaveDrift(10);
uClock.init();
uClock.setClock96PPQNOutput(ClockOut96PPQN);
// For MIDI Sync Start and Stop

@ -55,8 +55,6 @@ void setup() {
pinMode(LED_BUILTIN, OUTPUT);
// Setup our clock system
// drift for USB Teensy
uClock.setDrift(1);
// Inits the clock
uClock.init();
// Set the callback function for the clock output to send MIDI Sync message.

@ -76,8 +76,6 @@ void setup() {
usbMIDI.setHandleStop(onExternalStop);
// Setup our clock system
// drift for USB Teensy
uClock.setDrift(1);
// Inits the clock
uClock.init();
// Set the callback function for the clock output to send MIDI Sync message.

@ -11,11 +11,6 @@
* - u8g2
* - uClock
*
* This example make use of drift values (6, 1)
* respectively for internal and external drift reference.
* This example was tested on a macbook
* running ableton live 9 as master clock
*
* This example code is in the public domain.
*/
@ -111,8 +106,6 @@ void setup() {
// uClock Setup
//
// Setup our clock system
// drift for USB Teensy
uClock.setDrift(1);
uClock.init();
uClock.setClock96PPQNOutput(ClockOut96PPQN);
// For MIDI Sync Start and Stop

@ -1,10 +1,10 @@
/*!
* @file uClock.cpp
* Project BPM clock generator for Arduino
* @brief A Library to implement BPM clock tick calls using hardware timer interruption. Tested on ATmega168/328, ATmega16u4/32u4 and ATmega2560.
* @version 0.10.6
* @brief A Library to implement BPM clock tick calls using hardware timer interruption. Tested on ATmega168/328, ATmega16u4/32u4 and ATmega2560 and Teensy LC.
* @version 1.0.0
* @author Romulo Silva
* @date 13/03/2022
* @date 01/04/2022
* @license MIT - (c) 2022 - Romulo Silva - contact@midilab.co
*
* Permission is hereby granted, free of charge, to any person obtaining a

@ -1,11 +1,10 @@
/*!
* @file uClock.cpp
* @file uClock.h
* Project BPM clock generator for Arduino
* @brief A Library to implement BPM clock tick calls using hardware timer1 interruption. Tested on ATmega168/328, ATmega16u4/32u4 and ATmega2560.
* Derived work from mididuino MidiClock class. (c) 2008 - 2011 - Manuel Odendahl - wesen@ruinwesen.com
* @version 0.10.6
* @brief A Library to implement BPM clock tick calls using hardware timer interruption. Tested on ATmega168/328, ATmega16u4/32u4 and ATmega2560 and Teensy LC.
* @version 1.0.0
* @author Romulo Silva
* @date 13/03/2022
* @date 01/04/2022
* @license MIT - (c) 2022 - Romulo Silva - contact@midilab.co
*
* Permission is hereby granted, free of charge, to any person obtaining a
@ -44,6 +43,7 @@ namespace umodular { namespace clock {
// for smooth slave tempo calculate display you should raise this value
// in between 64 to 128.
// note: this doesn't impact on sync time, only display time getTempo()
// if you dont want to use it, set it to 1 for memory save
#define EXT_INTERVAL_BUFFER_SIZE 24
#define SECS_PER_MIN (60UL)

Loading…
Cancel
Save