From 7bd9969040cbe018f5a5b9d66ba991862206f27e Mon Sep 17 00:00:00 2001 From: midilab Date: Fri, 3 Jun 2022 05:04:38 -0400 Subject: [PATCH 1/2] xiao example for test --- .../XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino b/examples/XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino index 66d5fb0..6b335cc 100644 --- a/examples/XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino +++ b/examples/XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino @@ -1,10 +1,7 @@ /* USB MIDI Sync Box * * This example demonstrates how to change the USB MIDI - * device name on Teensy LC and 3.x. When creating more - * that one MIDI device, custom names are much easier to - * use when selecting each device in MIDI software on - * your PC or Mac. The custom name is in the "name.c" tab. + * device name on Seeedstudio XIAO M0. * * Windows and Macintosh systems often cache USB info. * After changing the name, you may need to test on a @@ -43,16 +40,16 @@ void handle_bpm_led(uint32_t tick) // Internal clock handlers void ClockOut96PPQN(uint32_t tick) { // Send MIDI_CLOCK to external gears - //MIDI.sendRealTime(MIDI.Clock); + MIDI.sendRealTime(MIDI.Clock); //handle_bpm_led(tick); } void onClockStart() { - //MIDI.sendRealTime(MIDI.Start); + MIDI.sendRealTime(MIDI.Start); } void onClockStop() { - //MIDI.sendRealTime(MIDI.Stop); + MIDI.sendRealTime(MIDI.Stop); } void setup() { From 8d3823cd9523261dbb7a3ceb8aba6d4639a32918 Mon Sep 17 00:00:00 2001 From: midilab Date: Fri, 10 Jun 2022 15:13:08 -0400 Subject: [PATCH 2/2] fix tinyusb midi freeze problem with uclock --- .../XiaoUsbMasterMidiClock.ino | 28 +++++++------------ src/uClock.cpp | 5 ++-- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/examples/XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino b/examples/XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino index 6b335cc..1c8515d 100644 --- a/examples/XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino +++ b/examples/XiaoUsbMasterMidiClock/XiaoUsbMasterMidiClock.ino @@ -2,13 +2,6 @@ * * This example demonstrates how to change the USB MIDI * device name on Seeedstudio XIAO M0. - * - * Windows and Macintosh systems often cache USB info. - * After changing the name, you may need to test on a - * different computer to observe the new name, or take - * steps to get your operating system to "forget" the - * cached info. (TODO: wanted... can anyone contribute - * instructions for these systems) * * This example code is in the public domain. */ @@ -16,47 +9,46 @@ #include Adafruit_USBD_MIDI usb_midi; -MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI); +MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI_USB); +//MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI); #include -/* uint8_t bpm_blink_timer = 1; void handle_bpm_led(uint32_t tick) { // BPM led indicator if ( !(tick % (96)) || (tick == 1) ) { // first compass step will flash longer - bpm_blink_timer = 8; + bpm_blink_timer = 4; digitalWrite(LED_BUILTIN, HIGH); } else if ( !(tick % (24)) ) { // each quarter led on + bpm_blink_timer = 1; digitalWrite(LED_BUILTIN, HIGH); } else if ( !(tick % bpm_blink_timer) ) { // get led off digitalWrite(LED_BUILTIN, LOW); - bpm_blink_timer = 1; } } -*/ // Internal clock handlers void ClockOut96PPQN(uint32_t tick) { // Send MIDI_CLOCK to external gears - MIDI.sendRealTime(MIDI.Clock); - //handle_bpm_led(tick); + MIDI_USB.sendRealTime(midi::Clock); + handle_bpm_led(tick); } void onClockStart() { - MIDI.sendRealTime(MIDI.Start); + MIDI_USB.sendRealTime(midi::Start); } void onClockStop() { - MIDI.sendRealTime(MIDI.Stop); + MIDI_USB.sendRealTime(midi::Stop); } void setup() { - MIDI.begin(MIDI_CHANNEL_OMNI); + MIDI_USB.begin(MIDI_CHANNEL_OMNI); // A led to count bpms - //pinMode(LED_BUILTIN, OUTPUT); + pinMode(LED_BUILTIN, OUTPUT); // Setup our clock system // Inits the clock diff --git a/src/uClock.cpp b/src/uClock.cpp index 40a117d..147fe1e 100755 --- a/src/uClock.cpp +++ b/src/uClock.cpp @@ -121,14 +121,13 @@ uClockClass::uClockClass() onClock16PPQNCallback = NULL; onClockStartCallback = NULL; onClockStopCallback = NULL; - - // first interval calculus - setTempo(tempo); } void uClockClass::init() { uclockInitTimer(); + // first interval calculus + setTempo(tempo); } void uClockClass::start()