mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
comments and formatting
This commit is contained in:
parent
0574eb79ef
commit
4dcb9abef1
1 changed files with 9 additions and 11 deletions
|
|
@ -1899,12 +1899,8 @@ impl<E: Engine> TransportToolbar<E> {
|
|||
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<E: Engine> TransportToolbar<E> {
|
|||
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<Tui> {
|
|||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
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<Tui> {
|
|||
}
|
||||
).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<Tui> for TransportToolbar<Tui> {
|
|||
}
|
||||
|
||||
#[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<Engine = Tui>> (
|
||||
self, parent_focus: bool, focus: Self, widget: &'a W
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue