mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
separate Input and Output impls
This commit is contained in:
parent
a6efde40f8
commit
0e821e098f
77 changed files with 465 additions and 454 deletions
|
|
@ -9,7 +9,7 @@ pub struct TransportTui {
|
|||
}
|
||||
has_clock!(|self: TransportTui|&self.clock);
|
||||
audio!(|self: TransportTui, client, scope|ClockAudio(self).process(client, scope));
|
||||
render!(Tui: (self: TransportTui) => TransportView {
|
||||
render!(TuiOut: (self: TransportTui) => TransportView {
|
||||
compact: false,
|
||||
clock: &self.clock
|
||||
});
|
||||
|
|
@ -25,7 +25,7 @@ impl<'a> TransportView<'a> {
|
|||
Self { compact, clock }
|
||||
}
|
||||
}
|
||||
render!(Tui: (self: TransportView<'a>) => Outer(
|
||||
render!(TuiOut: (self: TransportView<'a>) => Outer(
|
||||
Style::default().fg(TuiTheme::g(255))
|
||||
).enclose(row!(
|
||||
OutputStats::new(self.compact, self.clock),
|
||||
|
|
@ -36,7 +36,7 @@ render!(Tui: (self: TransportView<'a>) => Outer(
|
|||
)));
|
||||
|
||||
pub struct PlayPause { pub compact: bool, pub playing: bool }
|
||||
render!(Tui: (self: PlayPause) => Tui::bg(
|
||||
render!(TuiOut: (self: PlayPause) => Tui::bg(
|
||||
if self.playing{Color::Rgb(0,128,0)}else{Color::Rgb(128,64,0)},
|
||||
Either(self.compact,
|
||||
Thunk::new(||Fixed::x(9, Either(self.playing,
|
||||
|
|
@ -59,7 +59,7 @@ impl BeatStats {
|
|||
Self { compact, bpm: format!("{:.3}", clock.timebase.bpm.get()), beat, time }
|
||||
}
|
||||
}
|
||||
render!(Tui: (self: BeatStats) => Either(self.compact,
|
||||
render!(TuiOut: (self: BeatStats) => Either(self.compact,
|
||||
row!(
|
||||
FieldV(TuiTheme::g(128).into(), "BPM", &self.bpm),
|
||||
FieldV(TuiTheme::g(128).into(), "Beat", &self.beat),
|
||||
|
|
@ -88,7 +88,7 @@ impl OutputStats {
|
|||
}
|
||||
}
|
||||
}
|
||||
render!(Tui: (self: OutputStats) => Either(self.compact,
|
||||
render!(TuiOut: (self: OutputStats) => Either(self.compact,
|
||||
row!(
|
||||
FieldV(TuiTheme::g(128).into(), "SR", &self.sample_rate),
|
||||
FieldV(TuiTheme::g(128).into(), "Buf", &self.buffer_size),
|
||||
|
|
@ -100,7 +100,7 @@ render!(Tui: (self: OutputStats) => Either(self.compact,
|
|||
Bsp::e(Tui::fg(TuiTheme::g(255), format!("{:.3}ms", self.latency)), " latency"),
|
||||
)));
|
||||
|
||||
handle!(<Tui>|self: TransportTui, input|ClockCommand::execute_with_state(self, input.event()));
|
||||
handle!(TuiIn: |self: TransportTui, input|ClockCommand::execute_with_state(self, input.event()));
|
||||
keymap!(TRANSPORT_KEYS = |state: TransportTui, input: Event| ClockCommand {
|
||||
key(Char(' ')) =>
|
||||
if state.clock().is_stopped() { Play(None) } else { Pause(None) },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue