diff --git a/crates/tek_sequencer/src/sequencer.rs b/crates/tek_sequencer/src/sequencer.rs index 3afe181b..cecabec7 100644 --- a/crates/tek_sequencer/src/sequencer.rs +++ b/crates/tek_sequencer/src/sequencer.rs @@ -1899,12 +1899,8 @@ impl TransportToolbar { Ok(()) } pub fn update (&mut self, scope: &ProcessScope) -> (bool, usize, usize, usize, usize, f64) { - let CycleTimes { - current_frames, - current_usecs, - next_usecs, - period_usecs - } = scope.cycle_times().unwrap(); + let times = scope.cycle_times().unwrap(); + let CycleTimes { current_frames, current_usecs, next_usecs, period_usecs } = times; let chunk_size = scope.n_frames() as usize; let transport = self.transport.as_ref().unwrap().query().unwrap(); self.frame = transport.pos.frame() as usize; @@ -1912,10 +1908,7 @@ impl TransportToolbar { if self.playing != Some(transport.state) { match transport.state { TransportState::Rolling => { - self.started = Some(( - current_frames as usize, - current_usecs as usize, - )); + self.started = Some((current_frames as usize, current_usecs as usize)); }, TransportState::Stopped => { self.started = None; @@ -2019,6 +2012,7 @@ impl Content for TransportToolbar { fn content (&self) -> impl Widget { row! { + // play/pause self.focus.wrap(self.focused, TransportToolbarFocus::PlayPause, &Styled( match self.playing { Some(TransportState::Stopped) => Some(GRAY_DIM.bold()), @@ -2034,19 +2028,23 @@ impl Content for TransportToolbar { } ).min_xy(11, 2).push_x(1)), + // bpm self.focus.wrap(self.focused, TransportToolbarFocus::Bpm, &Outset::X(1u16, col! { "BPM", format!("{}.{:03}", self.bpm as usize, (self.bpm * 1000.0) % 1000.0).as_str() })), + // quant self.focus.wrap(self.focused, TransportToolbarFocus::Quant, &Outset::X(1u16, col! { "QUANT", ppq_to_name(self.quant as usize) })), + // sync self.focus.wrap(self.focused, TransportToolbarFocus::Sync, &Outset::X(1u16, col! { "SYNC", ppq_to_name(self.sync as usize) })), + // clock self.focus.wrap(self.focused, TransportToolbarFocus::Clock, &{ let Self { frame: _frame, pulse, ppq, usecs, .. } = self; let (beats, pulses) = if *ppq > 0 { (pulse / ppq, pulse % ppq) } else { (0, 0) }; @@ -2073,7 +2071,7 @@ impl Focusable for TransportToolbar { } #[derive(Clone, Copy, PartialEq)] -enum TransportToolbarFocus { PlayPause, Bpm, Quant, Sync, Clock, } +pub enum TransportToolbarFocus { PlayPause, Bpm, Quant, Sync, Clock, } impl TransportToolbarFocus { pub fn wrap <'a, W: Widget> ( self, parent_focus: bool, focus: Self, widget: &'a W