mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
fix time trait usage
This commit is contained in:
parent
dc38fd3d52
commit
799228e366
7 changed files with 36 additions and 47 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue