mod handle; mod jack; mod render; pub use self::handle::*; pub use self::jack::*; pub use self::render::*; use crate::prelude::*; pub const ACTIONS: [(&'static str, &'static str);3] = [ ("(Shift-)Tab", "Switch pane"), ("Arrows", "Navigate"), ("(Shift-)Space", "⯈ Play/pause"), ]; pub struct Transport { exited: bool, title: String, transport: ::jack::Transport, } impl Transport { pub fn new (client: &Client) -> Result> { Ok(Self { exited: false, title: String::from("Untitled project"), transport: client.transport(), }) } pub fn play_from_start_or_stop_and_rewind (&mut self) { } pub fn play_or_pause (&mut self) -> Result<(), Box> { match self.transport.query_state()? { TransportState::Stopped => self.play(), TransportState::Rolling => self.stop(), _ => Ok(()) } } pub fn play (&mut self) -> Result<(), Box> { Ok(self.transport.start()?) } pub fn stop (&mut self) -> Result<(), Box> { Ok(self.transport.stop()?) } } impl Exitable for Transport { fn exit (&mut self) { self.exited = true } fn exited (&self) -> bool { self.exited } }