wip: fixed piano

This commit is contained in:
🪞👃🪞 2025-01-10 20:24:48 +01:00
parent 86188b59db
commit 1b82a957aa
9 changed files with 100 additions and 105 deletions

View file

@ -30,8 +30,9 @@ impl EdnViewData<TuiOut> for &Example {
fn get_content <'a> (&'a self, item: EdnItem<&'a str>) -> RenderBox<'a, TuiOut> {
use EdnItem::*;
match item {
Nil => Box::new(()),
Nil => Box::new(()),
Exp(items) => Box::new(EdnView::from_items(*self, items.as_slice())),
//Sym(name) => self.get_sym(name), TODO
Sym(":title") => Tui::bg(Color::Rgb(60,10,10), Push::y(1,
Align::n(format!("Example {}/{}:", self.0 + 1, EDN.len())))).boxed(),
Sym(":code") => Tui::bg(Color::Rgb(10,60,10), Push::y(2,

1
tek/src/sequencer.edn Normal file
View file

@ -0,0 +1 @@
:editor

View file

@ -22,12 +22,26 @@ pub struct Sequencer {
pub midi_buf: Vec<Vec<Vec<u8>>>,
pub perf: PerfModel,
}
render!(TuiOut: (self: Sequencer) => self.size.of(
Bsp::s(self.toolbar_view(),
Bsp::n(self.selector_view(),
Bsp::n(self.status_view(),
Bsp::w(self.pool_view(), Fill::xy(&self.editor)))))));
render!(TuiOut: (self: Sequencer) => self.size.of(EdnView::from_source(self, Self::EDN)));
impl EdnViewData<TuiOut> for &Sequencer {
fn get_content <'a> (&'a self, item: EdnItem<&'a str>) -> RenderBox<'a, TuiOut> {
use EdnItem::*;
match item {
Nil => Box::new(()),
Exp(items) => Box::new(EdnView::from_items(*self, items.as_slice())),
Sym(":editor") => (&self.editor).boxed(),
_ => panic!("no content for {item:?}")
}
}
}
//render!(TuiOut: (self: Sequencer) => self.size.of(
//Bsp::s(self.toolbar_view(),
//Bsp::n(self.selector_view(),
//Bsp::n(self.status_view(),
//Bsp::w(self.pool_view(), Fill::xy(&self.editor)))))));
impl Sequencer {
const EDN: &'static str = include_str!("sequencer.edn");
fn toolbar_view (&self) -> impl Content<TuiOut> + use<'_> {
Fill::x(Fixed::y(2, Align::x(TransportView::new(true, &self.player.clock))))
}