fix time trait usage

This commit is contained in:
🪞👃🪞 2024-11-01 15:27:06 +02:00
parent dc38fd3d52
commit 799228e366
7 changed files with 36 additions and 47 deletions

View file

@ -400,14 +400,14 @@ impl PhrasePlayer {
}
pub fn samples_since_start (&self) -> Option<usize> {
self.phrase.as_ref()
.map(|(started,_)|started.sample())
.map(|started|started - self.clock.instant.sample())
.map(|(started,_)|started.sample().get())
.map(|started|(started - self.clock.instant.sample().get()) as usize)
}
pub fn playing_phrase (&self) -> Option<(usize, Arc<RwLock<Phrase>>)> {
if let (
Some(TransportState::Rolling), Some((started, Some(ref phrase)))
) = (*self.clock.playing.read().unwrap(), &self.phrase) {
Some((started.sample(), phrase.clone()))
Some((started.sample().get() as usize, phrase.clone()))
} else {
None
}