Add MIDI clock-driven LED pulsing
- New MidiClock module: tracks 24 PPQN clock ticks, computes beat phase and smooth sine pulse from incoming MIDI Clock (0xF8) - midi_transport: detect CIN=0xF real-time packets, route 0xF8 to MidiClock::tick(), 0xFA/FB to start(), 0xFC to stop() - led_stub update(): every 20ms, modulates active LED brightness using pulse curve (50%-100%), pixel 6 always throbs when clock is running even if no loops active - Aligned set_led_state() all paths to use pad_base_colors - Removed dead activity flash code
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "midi_transport.h"
|
||||
#include "midi_clock.h"
|
||||
#include <Arduino.h>
|
||||
#include "Adafruit_TinyUSB.h"
|
||||
|
||||
@@ -51,6 +52,20 @@ void UsbMidiTransport::update() {
|
||||
while (usb_midi.available()) {
|
||||
uint8_t packet[4];
|
||||
if (usb_midi.readPacket(packet)) {
|
||||
uint8_t cin = packet[0] & 0x0F;
|
||||
|
||||
if (cin == 0x0F) {
|
||||
uint8_t rt = packet[1];
|
||||
if (rt == 0xF8) {
|
||||
MidiClock::tick();
|
||||
} else if (rt == 0xFA || rt == 0xFB) {
|
||||
MidiClock::start();
|
||||
} else if (rt == 0xFC) {
|
||||
MidiClock::stop();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
MidiEvent event;
|
||||
parse_midi_packet(packet, 4, event);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user