wip: refactor pt.42 (84e) lotta todo!

This commit is contained in:
🪞👃🪞 2024-11-15 22:06:52 +01:00
parent bf0e14c252
commit 638298ad32
11 changed files with 536 additions and 335 deletions

View file

@ -34,12 +34,24 @@ impl<T: PlayheadApi> Command<T> for PlayheadCommand {
}
pub trait PlayheadApi: ClockApi {
/// Current moment in time
fn current (&self) -> &Instant;
/// Handle to JACK transport
fn transport (&self) -> &jack::Transport;
/// Playback state
fn playing (&self) -> &RwLock<Option<TransportState>>;
/// Global sample and usec at which playback started
fn started (&self) -> &RwLock<Option<(usize, usize)>>;
fn is_stopped (&self) -> bool {
*self.playing().read().unwrap() == Some(TransportState::Stopped)
}
fn is_rolling (&self) -> bool {
*self.playing().read().unwrap() == Some(TransportState::Rolling)
}
/// Current pulse
fn pulse (&self) -> f64 {
self.current().pulse.get()
}
@ -67,13 +79,6 @@ pub trait PlayheadApi: ClockApi {
Ok(())
}
fn is_stopped (&self) -> bool {
*self.playing().read().unwrap() == Some(TransportState::Stopped)
}
fn is_rolling (&self) -> bool {
*self.playing().read().unwrap() == Some(TransportState::Rolling)
}
}
/// Hosts the JACK callback for updating the temporal pointer and playback status.