MIDI Controller w/ MIDI Clock Thru

I've researched this topic to death and can't find the answer to what I'm looking for, so here's a little background. I am building a MIDI controller project with these specs:

  • The unit has MIDI In and Thru/OUT ports.
  • The unit should respond MIDI Clock (with blinking LED to tempo)
  • MIDI Clock should pass to MIDI Thru to sync devices down the chain
  • 1 button on board should send Program Change (PC) command
  • 1 button to send a CC command

I am using the MIDI Library, and basing it off of this Sparkfun code

I have the MIDI Clock coming in and the LED is blinking in sync (which makes me happy). I do not have the buttons done, but I feel like I understand sending PC/CC messages.

I can't figure out how to allow MIDI Clock to pass through. I've seen things using the Serial.write, but as I said, I'm using the MIDI Library. Are there any examples of this? MIDI Library docs are very hard to read, and I'm even a programmer by trade.

As the clock is running, will pushing either of the buttons to send out a PC/CC message interrupt the clock. I've read up about using a queue or something. I'm looking for guidance in this matter as well.

Disclaimer: I'm a noob. Be gentle.

MIDI Thru and MIDI Out are different. MIDI Out is to carry signals originating from the device. MIDI Thru is electrically connected to MIDI In and simply passes the signal directly from In to Thru. If you're trying to use software to "echo" the clock from In to Out/Thru, you'll run into timing problems (the Out will be delayed slightly from the In).