Concept: Determine settings based on the MIDI CLOCK speed (bpm)
With this test code in passthrough_midi() I was able to get an accurate read up to 200bpm on laptop (but need to confirm on pi0)
MidiMessage::TimingClock => {
self.ticks += 1;
if self.ticks == 24 {
self.ticks = 0;
let now = Instant::now();
let ns = now.duration_since(self.last_tick).as_nanos();
self.last_tick = now;
let bpm = (60000000000.0 / ns as f64).round() as usize;
if bpm != self.last_bpm {
self.last_bpm = bpm;
println!("{}ns = {}bpm", ns, bpm);
}
}
Some(message)
}
Concept: Determine settings based on the MIDI CLOCK speed (bpm) With this test code in passthrough_midi() I was able to get an accurate read up to 200bpm on laptop (but need to confirm on pi0)