launch pt.9: fix beats_per_second

This commit is contained in:
🪞👃🪞 2024-11-01 23:59:39 +02:00
parent e149d777ed
commit e7dce0f84b
4 changed files with 87 additions and 85 deletions

View file

@ -416,15 +416,12 @@ impl PhrasePlayer {
));
self.reset = true;
}
pub fn samples_since_start (&self) -> Option<usize> {
self.phrase.as_ref()
.map(|(started,_)|started.sample().get())
.map(|started|(self.clock.instant.sample().get() - started) as usize)
}
pub fn pulses_since_start (&self) -> Option<f64> {
self.phrase.as_ref()
.map(|(started,_)|started.pulse().get())
.map(|started|self.clock.instant.pulse().get() - started)
if let Some((started, Some(_))) = self.phrase.as_ref() {
Some(self.clock.instant.pulse().get() - started.pulse().get())
} else {
None
}
}
}
impl<E: Engine> PhraseLength<E> {