mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 13:16:44 +01:00
wip: refactor pt.35 (16e) even more traits, even fewer structs
This commit is contained in:
parent
beca1a6ade
commit
7af5bbd02b
12 changed files with 121 additions and 191 deletions
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue