start implementing edn loader; remove PhantomData from some tek_layout constructs

This commit is contained in:
🪞👃🪞 2025-01-03 22:50:58 +01:00
parent f359768ba2
commit 2b07e7963e
20 changed files with 239 additions and 222 deletions

View file

@ -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
}