diff --git a/crates/tek_core/src/time.rs b/crates/tek_core/src/time.rs index 65d64d0b..cd58108d 100644 --- a/crates/tek_core/src/time.rs +++ b/crates/tek_core/src/time.rs @@ -80,12 +80,7 @@ impl Timebase { impl Default for Timebase { fn default () -> Self { Self::new(48000f64, 150f64, 96f64) } } impl Instant { pub fn zero (timebase: &Arc) -> Self { - Self { - usec: 0.into(), - sample: 0.into(), - pulse: 0.into(), - timebase: timebase.clone(), - } + Self { usec: 0.into(), sample: 0.into(), pulse: 0.into(), timebase: timebase.clone() } } pub fn from_usec (timebase: &Arc, usec: f64) -> Self { Self { @@ -271,14 +266,10 @@ impl UsecPosition for Instant { #[inline] fn usec (&self) -> &TimeUnit { &self.u /// Something that defines launch quantization pub trait LaunchSync { fn sync (&self) -> &TimeUnit; - #[inline] fn next_launch_pulse (&self) -> f64 where Self: PulsePosition { - let sync: f64 = self.sync().get(); - let pulse = self.pulse().get(); - if pulse % sync == 0. { - pulse - } else { - (pulse / sync + 1.) * sync - } + #[inline] fn next_launch_pulse (&self) -> usize where Self: PulsePosition { + let sync = self.sync().get() as usize; + let pulse = self.pulse().get() as usize; + if pulse % sync == 0 { pulse } else { (pulse / sync + 1) * sync } } } /// Something that defines note quantization