move ClockModel to tek_api

This commit is contained in:
🪞👃🪞 2024-11-26 22:02:41 +01:00
parent 4fdc3911e4
commit a26a1f2967
13 changed files with 214 additions and 222 deletions

View file

@ -91,30 +91,6 @@ impl TuiTheme {
}
}
macro_rules! impl_clock_api {
($Struct:ident $(:: $field:ident)*) => {
impl ClockApi for $Struct {
fn quant (&self) -> &Arc<Quantize> {
&self$(.$field)*.quant
}
fn sync (&self) -> &Arc<LaunchSync> {
&self$(.$field)*.sync
}
fn current (&self) -> &Arc<Instant> {
&self$(.$field)*.current
}
fn transport_handle (&self) -> &Arc<Transport> {
&self$(.$field)*.transport
}
fn transport_state (&self) -> &Arc<RwLock<Option<TransportState>>> {
&self$(.$field)*.playing
}
fn transport_offset (&self) -> &Arc<RwLock<Option<(usize, usize)>>> {
&self$(.$field)*.started
}
}
}
}
macro_rules! impl_midi_player {
($Struct:ident $(:: $field:ident)*) => {
impl HasPhrase for $Struct {
@ -184,12 +160,6 @@ macro_rules! impl_midi_player {
}
}
impl_clock_api!(TransportTui::clock);
impl_clock_api!(SequencerTui::clock);
impl_clock_api!(ArrangerTui::clock);
impl_clock_api!(PhrasePlayerModel::clock);
impl_clock_api!(ArrangerTrack::player::clock);
impl_midi_player!(SequencerTui::player);
impl_midi_player!(ArrangerTrack::player);
impl_midi_player!(PhrasePlayerModel);
@ -197,18 +167,6 @@ impl_midi_player!(PhrasePlayerModel);
use std::fmt::{Debug, Formatter, Error};
type DebugResult = std::result::Result<(), Error>;
impl Debug for ClockModel {
fn fmt (&self, f: &mut Formatter<'_>) -> DebugResult {
f.debug_struct("editor")
.field("playing", &self.playing)
.field("started", &self.started)
.field("current", &self.current)
.field("quant", &self.quant)
.field("sync", &self.sync)
.finish()
}
}
impl Debug for TransportTui {
fn fmt (&self, f: &mut Formatter<'_>) -> DebugResult {
f.debug_struct("Measure")