mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
start implementing edn loader; remove PhantomData from some tek_layout constructs
This commit is contained in:
parent
f359768ba2
commit
2b07e7963e
20 changed files with 239 additions and 222 deletions
|
|
@ -15,12 +15,13 @@ pub trait HasPlayPhrase: HasClock {
|
|||
None
|
||||
}
|
||||
}
|
||||
fn pulses_since_start_looped (&self) -> Option<f64> {
|
||||
fn pulses_since_start_looped (&self) -> Option<(f64, f64)> {
|
||||
if let Some((started, Some(phrase))) = self.play_phrase().as_ref() {
|
||||
let elapsed = self.clock().playhead.pulse.get() - started.pulse.get();
|
||||
let length = phrase.read().unwrap().length.max(1); // prevent div0 on empty phrase
|
||||
let times = (elapsed as usize / length) as f64;
|
||||
let elapsed = (elapsed as usize % length) as f64;
|
||||
Some(elapsed)
|
||||
Some((times, elapsed))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue