mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
wip: still trying to retain correct position
This commit is contained in:
parent
cfbb9722af
commit
29db79f806
3 changed files with 21 additions and 17 deletions
17
src/time.rs
17
src/time.rs
|
|
@ -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)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue