New config: MIDI_CLOCK_IN (default OFF) + MIDI_CLOCK_IN_TRANSPORT (default ON). _feed_midi now intercepts 0xF8 (clock tick) -> smoothed bpm tracker (exponential, a=1/8; rejects out-of-range intervals so noise can't drag bpm wild), 0xFA / 0xFB (Start / Continue) -> start playback without echoing 0xFA on output (would feedback), 0xFC -> stop. _slaved flag is True while ticks are arriving and decays after 1s of silence. While slaved: per-master-step continuous ramp is OFF (the master's tempo wins) and Clock Out emission is suppressed (no feedback loop if the user enables both). Verified in the harness: target 60/120/180 BPM all track exactly after 60 ticks (2.5 quarter notes of smoothing); 0xFA -> running, 0xFC -> stopped; slave flag correctly decays. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
95 KiB
95 KiB