mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
more half-fix. it's fucked.
This commit is contained in:
parent
d15fcf66cb
commit
967042e8a6
2 changed files with 60 additions and 62 deletions
|
|
@ -108,18 +108,15 @@ render!(TuiOut: (self: Arranger) => {
|
|||
let pool_w = if self.pool.visible { self.splits[1] } else { 0 };
|
||||
let color = self.color;
|
||||
self.size.of(
|
||||
Bsp::n(Fixed::y(2, ArrangerStatus::from(self)),
|
||||
Bsp::n(Fixed::y(1, MidiEditStatus(&self.editor)),
|
||||
Bsp::w(Fixed::x(pool_w, PoolView(self.pool.visible, &self.pool)),
|
||||
col!(
|
||||
TransportView::new(true, &self.clock),
|
||||
Fill::x(Fixed::y(20, lay!(
|
||||
Fill::xy(Tui::bg(color.darkest.rgb, "")),
|
||||
Fill::xy(Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb))),
|
||||
Self::render_mode(self),
|
||||
))),
|
||||
Fill::xy(&"FIXME: editor"),
|
||||
)))))
|
||||
Bsp::n(Fill::xy(ArrangerStatus::from(self)),
|
||||
Bsp::s(Fixed::y(1, MidiEditStatus(&self.editor)),
|
||||
Bsp::n(Fixed::x(pool_w, PoolView(self.pool.visible, &self.pool)),
|
||||
Bsp::n(TransportView::new(true, &self.clock),
|
||||
Bsp::n(Fill::x(Fixed::y(20, lay!(
|
||||
Fill::xy(Tui::bg(color.darkest.rgb, "")),
|
||||
Fill::xy(Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb))),
|
||||
Self::render_mode(self),
|
||||
))), Fill::y(&"fixme: self.editor")))))))
|
||||
});
|
||||
audio!(|self: Arranger, client, scope|{
|
||||
// Start profiling cycle
|
||||
|
|
@ -161,3 +158,54 @@ has_clock!(|self: Arranger|&self.clock);
|
|||
has_phrases!(|self: Arranger|self.pool.phrases);
|
||||
has_editor!(|self: Arranger|self.editor);
|
||||
handle!(TuiIn: |self: Arranger, input|ArrangerCommand::execute_with_state(self, input.event()));
|
||||
|
||||
/// Status bar for arranger app
|
||||
#[derive(Clone)]
|
||||
pub struct ArrangerStatus {
|
||||
pub(crate) width: usize,
|
||||
pub(crate) cpu: Option<String>,
|
||||
pub(crate) size: String,
|
||||
pub(crate) playing: bool,
|
||||
}
|
||||
from!(|state:&Arranger|ArrangerStatus = {
|
||||
let samples = state.clock.chunk.load(Relaxed);
|
||||
let rate = state.clock.timebase.sr.get();
|
||||
let buffer = samples as f64 / rate;
|
||||
let width = state.size.w();
|
||||
Self {
|
||||
width,
|
||||
playing: state.clock.is_rolling(),
|
||||
cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%")),
|
||||
size: format!("{}x{}│", width, state.size.h()),
|
||||
}
|
||||
});
|
||||
render!(TuiOut: (self: ArrangerStatus) => Fixed::y(2, lay!(
|
||||
Self::help(),
|
||||
Fill::xy(Align::se(Tui::fg_bg(TuiTheme::orange(), TuiTheme::g(25), self.stats()))),
|
||||
)));
|
||||
impl ArrangerStatus {
|
||||
fn help () -> impl Content<TuiOut> {
|
||||
let single = |binding, command|row!(" ", col!(
|
||||
Tui::fg(TuiTheme::yellow(), binding),
|
||||
command
|
||||
));
|
||||
let double = |(b1, c1), (b2, c2)|col!(
|
||||
row!(" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,),
|
||||
row!(" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,),
|
||||
);
|
||||
Tui::fg_bg(TuiTheme::g(255), TuiTheme::g(50), row!(
|
||||
single("SPACE", "play/pause"),
|
||||
single(" Ctrl", " scroll"),
|
||||
single(" ▲▼▶◀", " cell"),
|
||||
double(("p", "put"), ("g", "get")),
|
||||
double(("q", "enqueue"), ("e", "edit")),
|
||||
single(" wsad", " note"),
|
||||
double(("a", "append"), ("s", "set"),),
|
||||
double((",.", "length"), ("<>", "triplet"),),
|
||||
double(("[]", "phrase"), ("{}", "order"),),
|
||||
))
|
||||
}
|
||||
fn stats (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
row!(&self.cpu, &self.size)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,53 +49,3 @@ impl SequencerStatus {
|
|||
}
|
||||
}
|
||||
|
||||
/// Status bar for arranger app
|
||||
#[derive(Clone)]
|
||||
pub struct ArrangerStatus {
|
||||
pub(crate) width: usize,
|
||||
pub(crate) cpu: Option<String>,
|
||||
pub(crate) size: String,
|
||||
pub(crate) playing: bool,
|
||||
}
|
||||
from!(|state:&Arranger|ArrangerStatus = {
|
||||
let samples = state.clock.chunk.load(Relaxed);
|
||||
let rate = state.clock.timebase.sr.get();
|
||||
let buffer = samples as f64 / rate;
|
||||
let width = state.size.w();
|
||||
Self {
|
||||
width,
|
||||
playing: state.clock.is_rolling(),
|
||||
cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%")),
|
||||
size: format!("{}x{}│", width, state.size.h()),
|
||||
}
|
||||
});
|
||||
render!(TuiOut: (self: ArrangerStatus) => Fixed::y(2, lay!(
|
||||
Self::help(),
|
||||
Fill::xy(Align::se(Tui::fg_bg(TuiTheme::orange(), TuiTheme::g(25), self.stats()))),
|
||||
)));
|
||||
impl ArrangerStatus {
|
||||
fn help () -> impl Content<TuiOut> {
|
||||
let single = |binding, command|row!(" ", col!(
|
||||
Tui::fg(TuiTheme::yellow(), binding),
|
||||
command
|
||||
));
|
||||
let double = |(b1, c1), (b2, c2)|col!(
|
||||
row!(" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,),
|
||||
row!(" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,),
|
||||
);
|
||||
Tui::fg_bg(TuiTheme::g(255), TuiTheme::g(50), row!(
|
||||
single("SPACE", "play/pause"),
|
||||
single(" Ctrl", " scroll"),
|
||||
single(" ▲▼▶◀", " cell"),
|
||||
double(("p", "put"), ("g", "get")),
|
||||
double(("q", "enqueue"), ("e", "edit")),
|
||||
single(" wsad", " note"),
|
||||
double(("a", "append"), ("s", "set"),),
|
||||
double((",.", "length"), ("<>", "triplet"),),
|
||||
double(("[]", "phrase"), ("{}", "order"),),
|
||||
))
|
||||
}
|
||||
fn stats (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
row!(&self.cpu, &self.size)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue