wip: still trying to retain correct position

This commit is contained in:
🪞👃🪞 2024-12-29 15:11:06 +01:00
parent cfbb9722af
commit 29db79f806
3 changed files with 21 additions and 17 deletions

View file

@ -199,6 +199,23 @@ impl ClockModel {
Ok(())
}
pub fn bbt (&self) -> ::jack::contrib::PositionBBT {
let pulse = self.playhead.pulse.get() as i32;
let ppq = self.timebase.ppq.get() as i32;
let bpm = self.timebase.bpm.get();
let bar = (pulse / ppq) / 4;
::jack::contrib::PositionBBT {
bar: 1 + bar,
beat: 1 + (pulse / ppq) % 4,
tick: (pulse % ppq),
bar_start_tick: (bar * 4 * ppq) as f64,
beat_type: 4.,
beats_per_bar: 4.,
beats_per_minute: bpm,
ticks_per_beat: ppq as f64
}
}
}
//#[cfg(test)]