wip: refactor pt.35 (16e) even more traits, even fewer structs

This commit is contained in:
🪞👃🪞 2024-11-15 02:01:09 +01:00
parent beca1a6ade
commit 7af5bbd02b
12 changed files with 121 additions and 191 deletions

View file

@ -19,11 +19,12 @@ impl<T: ClockApi> Command<T> for ClockCommand {
}
pub trait ClockApi {
fn quant (&self) -> &Quantize;
fn sync (&self) -> &LaunchSync;
/// Current moment in time
fn current (&self) -> &Instant;
/// Note quantization factor
fn quant (&self) -> &Quantize;
/// Launch quantization factor
fn sync (&self) -> &LaunchSync;
fn timebase (&self) -> &Timebase {
&self.current().timebase
@ -38,19 +39,3 @@ pub trait ClockApi {
&self.timebase().ppq
}
}
pub trait HasClock {
fn clock (&self) -> &impl ClockApi;
}
impl<T: HasClock> ClockApi for T {
fn quant (&self) -> &Quantize {
self.clock().quant()
}
fn sync (&self) -> &LaunchSync {
self.clock().sync()
}
fn current (&self) -> &Instant {
self.clock().current()
}
}