mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
add HasJack; Arrangement
This commit is contained in:
parent
744ce21e24
commit
e73c31d494
12 changed files with 565 additions and 387 deletions
|
|
@ -2,31 +2,31 @@ use crate::*;
|
|||
use KeyCode::*;
|
||||
use ClockCommand::{Play, Pause};
|
||||
/// Transport clock app.
|
||||
pub struct TransportTui {
|
||||
pub struct ClockTui {
|
||||
pub jack: Arc<RwLock<JackConnection>>,
|
||||
pub clock: Clock,
|
||||
}
|
||||
handle!(TuiIn: |self: TransportTui, input|ClockCommand::execute_with_state(self, input.event()));
|
||||
keymap!(TRANSPORT_KEYS = |state: TransportTui, input: Event| ClockCommand {
|
||||
handle!(TuiIn: |self: ClockTui, input|ClockCommand::execute_with_state(self, input.event()));
|
||||
keymap!(TRANSPORT_KEYS = |state: ClockTui, input: Event| ClockCommand {
|
||||
key(Char(' ')) =>
|
||||
if state.clock().is_stopped() { Play(None) } else { Pause(None) },
|
||||
shift(key(Char(' '))) =>
|
||||
if state.clock().is_stopped() { Play(Some(0)) } else { Pause(Some(0)) }
|
||||
});
|
||||
has_clock!(|self: TransportTui|&self.clock);
|
||||
audio!(|self: TransportTui, client, scope|ClockAudio(self).process(client, scope));
|
||||
render!(TuiOut: (self: TransportTui) => TransportView {
|
||||
has_clock!(|self: ClockTui|&self.clock);
|
||||
audio!(|self: ClockTui, client, scope|ClockAudio(self).process(client, scope));
|
||||
render!(TuiOut: (self: ClockTui) => ClockView {
|
||||
compact: false,
|
||||
clock: &self.clock
|
||||
});
|
||||
|
||||
pub struct TransportView<'a> { pub compact: bool, pub clock: &'a Clock }
|
||||
impl<'a> TransportView<'a> {
|
||||
pub struct ClockView<'a> { pub compact: bool, pub clock: &'a Clock }
|
||||
impl<'a> ClockView<'a> {
|
||||
pub fn new (compact: bool, clock: &'a Clock) -> Self {
|
||||
Self { compact, clock }
|
||||
}
|
||||
}
|
||||
render!(TuiOut: (self: TransportView<'a>) => Outer(
|
||||
render!(TuiOut: (self: ClockView<'a>) => Outer(
|
||||
Style::default().fg(TuiTheme::g(255))
|
||||
).enclose(row!(
|
||||
OutputStats::new(self.compact, self.clock),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue