diff --git a/crates/app/app.rs b/crates/app/app.rs index 42507a32..5b4c74d4 100644 --- a/crates/app/app.rs +++ b/crates/app/app.rs @@ -216,29 +216,19 @@ impl App { } fn render_dsl <'t, S> (state: &'t S, src: &str) -> Box> - where S: DslSymNs<'t, Box>> + DslExpNs<'t, Box>> +where S: DslSymNs<'t, Box>> + DslExpNs<'t, Box>> { - let sym_err: Option> = match state.from_sym(src) { - Ok(Some(value)) => return value, - Ok(None) => None, - Err(e) => Some(e), - }; - let exp_err = match state.from_exp(src) { - Ok(Some(value)) => return value, - Ok(None) => None, - Err(e) => Some(e), - }; - let (err_fg_1, err_bg_1) = (Color::Rgb(240, 160, 100), Color::Rgb(48, 0, 0)); - let (err_fg_2, err_bg_2) = (Color::Rgb(250, 200, 120), Color::Rgb(32, 0, 0)); - Box::new(Fill::x(col! { - Fill::x(Margin::x(1, Align::w(Tui::bold(true, Tui::fg_bg(err_fg_1, err_bg_1, "Could not render:"))))), - Fill::x(Margin::x(1, Tui::fg_bg(err_fg_2, err_bg_2, format!("{src}")))), - Fill::x(Margin::x(1, Tui::fg_bg(err_fg_2, err_bg_2, format!("{sym_err:?}")))), - Fill::x(Margin::x(1, Tui::fg_bg(err_fg_2, err_bg_2, format!("{exp_err:?}")))), - })) + if let Ok(Some(value)) = state.from_sym(src) { return value } + if let Ok(Some(value)) = state.from_exp(src) { return value } + Box::new(Bsp::s( + Fill::x(Align::w(Tui::bold(true, Tui::fg_bg(Color::Rgb(240,160,100), Color::Rgb(48,00,00), + "Could not render:")))), + Max::x(40, Tui::fg_bg(Color::Rgb(250,200,120), Color::Rgb(32,00,00), + format!("{src}"))) + )) } -dsl_exp_ns!(|app: App| -> Box> { +dsl_exp!(|app: App, tail| -> Box> { ("bold", value: bool, x: Box>) => Box::new(Tui::bold(value, x)), ("fg", color: Color, x: Box>) => Box::new(Tui::fg(color, x)), ("bg", color: Color, x: Box>) => Box::new(Tui::bg(color, x)), @@ -249,26 +239,24 @@ dsl_exp_ns!(|app: App| -> Box> { ("bsp/w", a: Box>, b: Box>) => Box::new(Bsp::w(a, b)), ("bsp/a", a: Box>, b: Box>) => Box::new(Bsp::a(a, b)), ("bsp/b", a: Box>, b: Box>) => Box::new(Bsp::b(a, b)), - ("align/n", x: Box>) => Box::new(Align::n(x)), - ("align/s", x: Box>) => Box::new(Align::s(x)), - ("align/e", x: Box>) => Box::new(Align::e(x)), - ("align/w", x: Box>) => Box::new(Align::w(x)), - ("align/x", x: Box>) => Box::new(Align::x(x)), - ("align/y", x: Box>) => Box::new(Align::y(x)), - ("align/c", x: Box>) => Box::new(Align::c(x)), + ("align/n", x: Box>) => Box::new(Align::n(a, b)), + ("align/s", x: Box>) => Box::new(Align::s(a, b)), + ("align/e", x: Box>) => Box::new(Align::e(a, b)), + ("align/w", x: Box>) => Box::new(Align::w(a, b)), + ("align/x", x: Box>) => Box::new(Align::x(a, b)), + ("align/y", x: Box>) => Box::new(Align::y(a, b)), + ("align/c", x: Box>) => Box::new(Align::c(a, b)), ("fill/x", x: Box>) => Box::new(Fill::x(x)), ("fill/y", x: Box>) => Box::new(Fill::y(x)), ("fill/xy", x: Box>) => Box::new(Fill::xy(x)), }); -dsl_exp_ns!(|app: App| -> Color { - ("g", n: u8) => - Color::Rgb(n, n, n), - ("rgb", r: u8, g: u8, b: u8) => - Color::Rgb(r, g, b), +dsl_exp!(|app: App, tail| -> Color { + ("rgb", r: u8, g: u8, b: u8) => Color::Rgb(r, g, b), + ("g", n: u8) => Color::Rgb(n. n. n), }); -dsl_sym_ns!(|app: App| -> Box> { +dsl_sym!(|app: App| -> Box> { ":view/menu" => app.view(stringify!((bg (rgb 0 0 0) (bsp/s :view/ports/outs (bsp/s (bg (rgb 33 33 33) (bold :true "tek 0.3.0-rc.0"))) @@ -579,24 +567,24 @@ handle!(TuiIn:|self: App, input|{ //None //}) }); -dsl_sym_ns!(|app: App| -> isize { +dsl_sym!(|app: App| -> isize { ":_isize_stub" => -1 }); -dsl_sym_ns!(|app: App| -> ItemTheme { +dsl_sym!(|app: App| -> ItemTheme { ":_theme_stub" => Default::default() }); -dsl_sym_ns!(|app: App| -> u16{ +dsl_sym!(|app: App| -> u16{ ":w/sidebar" => app.project.w_sidebar(app.editor().is_some()), ":h/sample-detail" => 6.max(app.height() as u16 * 3 / 9), }); -dsl_sym_ns!(|app: App| -> usize { +dsl_sym!(|app: App| -> usize { ":scene-count" => app.scenes().len(), ":track-count" => app.tracks().len(), ":device-kind" => app.dialog.device_kind().unwrap_or(0), ":device-kind/next" => app.dialog.device_kind_next().unwrap_or(0), ":device-kind/prev" => app.dialog.device_kind_prev().unwrap_or(0), }); -dsl_sym_ns!(|app: App| -> bool { +dsl_sym!(|app: App| -> bool { ":focused/editor" => app.project.editor.is_some(), ":focused/dialog" => !matches!(app.dialog, Dialog::None), ":focused/message" => matches!(app.dialog, Dialog::Message(..)), @@ -611,7 +599,7 @@ dsl_sym_ns!(|app: App| -> bool { ":focused/pool/rename" => matches!(app.pool.mode, Some(PoolMode::Rename(..))), ":focused/pool/length" => matches!(app.pool.mode, Some(PoolMode::Length(..))), }); -dsl_sym_ns!(|app: App| -> Dialog { +dsl_sym!(|app: App| -> Dialog { ":dialog/none" => Dialog::None, ":dialog/options" => Dialog::Options, ":dialog/device" => Dialog::Device(0), @@ -626,7 +614,7 @@ dsl_sym_ns!(|app: App| -> Dialog { ":dialog/import/sample" => Dialog::Browser(BrowserTarget::ImportSample(Default::default()), Browser::new(None).unwrap().into()), ":dialog/export/sample" => Dialog::Browser(BrowserTarget::ExportSample(Default::default()), Browser::new(None).unwrap().into()), }); -dsl_sym_ns!(|app: App| -> Selection { +dsl_sym!(|app: App| -> Selection { ":select/scene" => app.selection().select_scene(app.tracks().len()), ":select/scene/next" => app.selection().select_scene_next(app.scenes().len()), ":select/scene/prev" => app.selection().select_scene_prev(), @@ -634,14 +622,14 @@ dsl_sym_ns!(|app: App| -> Selection { ":select/track/next" => app.selection().select_track_next(app.tracks().len()), ":select/track/prev" => app.selection().select_track_prev(), }); -dsl_sym_ns!(|app: App| -> Option { +dsl_sym!(|app: App| -> Option { ":editor/pitch" => Some((app.editor().as_ref().map(|e|e.get_note_pos()).unwrap() as u8).into()) }); -dsl_sym_ns!(|app: App| -> Option { +dsl_sym!(|app: App| -> Option { ":selected/scene" => app.selection().scene(), ":selected/track" => app.selection().track(), }); -dsl_sym_ns!(|app: App| -> Option>> { +dsl_sym!(|app: App| -> Option>> { ":selected/clip" => if let Selection::TrackClip { track, scene } = app.selection() { app.scenes()[*scene].clips[*track].clone() } else { @@ -651,9 +639,9 @@ dsl_sym_ns!(|app: App| -> Option>> { #[derive(Debug)] pub enum AppCommand { } -dsl_exp_ns!(|app: App| -> AppCommand { - ("stop-all") => todo!(),//app.project.stop_all(), - ("enqueue", clip: Option>>) => todo!(), +dsl_exp!(|app: App| -> AppCommand { + ("stop-all") => app.project.stop_all(), + ("enqueue", clip?: Option>>) => todo!(), ("history", delta: isize) => todo!(), ("zoom", zoom: usize) => todo!(), ("select", selection: Selection) => todo!(), @@ -664,12 +652,12 @@ dsl_exp_ns!(|app: App| -> AppCommand { ("pool" / command: PoolCommand) => todo!(), ("pool" / editor: MidiEditCommand) => todo!(), }); -dsl_exp_ns!(|app: App| -> DialogCommand {}); -dsl_exp_ns!(|app: App| -> ArrangementCommand {}); -dsl_exp_ns!(|app: App| -> ClockCommand {}); -dsl_exp_ns!(|app: App| -> SamplerCommand {}); -dsl_exp_ns!(|app: App| -> PoolCommand {}); -dsl_exp_ns!(|app: App| -> MidiEditCommand {}); +dsl_exp!(|app: App| -> DialogCommand {}); +dsl_exp!(|app: App| -> ArrangementCommand {}); +dsl_exp!(|app: App| -> ClockCommand {}); +dsl_exp!(|app: App| -> SamplerCommand {}); +dsl_exp!(|app: App| -> PoolCommand {}); +dsl_exp!(|app: App| -> MidiEditCommand {}); impl App { pub fn focused_editor (&self) -> bool { false diff --git a/crates/device/src/arranger/arranger_api.rs b/crates/device/src/arranger/arranger_api.rs index c6576ac2..1df4dc13 100644 --- a/crates/device/src/arranger/arranger_api.rs +++ b/crates/device/src/arranger/arranger_api.rs @@ -96,7 +96,7 @@ impl ArrangementCommand { let index = arranger.track_add(None, None, &[], &[])?.0; *arranger.selection_mut() = match arranger.selection() { Selection::Track(_) => Selection::Track(index), - Selection::TrackClip { track: _, scene } => Selection::TrackClip { + Selection::TrackClip { track, scene } => Selection::TrackClip { track: index, scene: *scene }, _ => *arranger.selection() diff --git a/crates/device/src/arranger/arranger_tracks.rs b/crates/device/src/arranger/arranger_tracks.rs index 794646a7..332a1aa8 100644 --- a/crates/device/src/arranger/arranger_tracks.rs +++ b/crates/device/src/arranger/arranger_tracks.rs @@ -336,7 +336,7 @@ pub(crate) fn io_ports <'a, T: PortsSizes<'a>> ( fg: Color, bg: Color, iter: impl Fn()->T + Send + Sync + 'a ) -> impl Content + 'a { Map::new(iter, move|( - _index, name, connections, y, y2 + index, name, connections, y, y2 ): (usize, &'a Arc, &'a [Connect], usize, usize), _| map_south(y as u16, (y2-y) as u16, Bsp::s( Fill::x(Tui::bold(true, Tui::fg_bg(fg, bg, Align::w(Bsp::e(" 󰣲 ", name))))), @@ -349,11 +349,11 @@ pub(crate) fn io_conns <'a, T: PortsSizes<'a>> ( fg: Color, bg: Color, iter: impl Fn()->T + Send + Sync + 'a ) -> impl Content + 'a { Map::new(iter, move|( - _index, _name, connections, y, y2 + index, name, connections, y, y2 ): (usize, &'a Arc, &'a [Connect], usize, usize), _| map_south(y as u16, (y2-y) as u16, Bsp::s( Fill::x(Tui::bold(true, wrap(bg, fg, Fill::x(Align::w("▞▞▞▞ ▞▞▞▞"))))), - Map::new(||connections.iter(), move|_conn, index|map_south(index as u16, 1, + Map::new(||connections.iter(), move|connect, index|map_south(index as u16, 1, Fill::x(Align::w(Tui::bold(false, wrap(bg, fg, Fill::x("")))))))))) } //track_scroll: Fill::x(Fixed::y(1, ScrollbarH { diff --git a/crates/device/src/arranger/arranger_view.rs b/crates/device/src/arranger/arranger_view.rs index 1843f1de..89fef966 100644 --- a/crates/device/src/arranger/arranger_view.rs +++ b/crates/device/src/arranger/arranger_view.rs @@ -1,13 +1,18 @@ use crate::*; impl Arrangement { - pub fn view_inputs <'a> (&'a self, _theme: ItemTheme) -> impl Content + 'a { + pub fn view_inputs <'a> (&'a self, theme: ItemTheme) -> impl Content + 'a { + let mut h = 1u16; + for track in self.tracks().iter() { + h = h.max(self.midi_ins.len() as u16); + } + let h = h + 1; Stack::south(move|add: &mut dyn FnMut(&dyn Render)|{ add(&Fixed::y(1, Bsp::e(Fixed::x(20, Align::w(button_3("i", "nput ", format!("{}", self.midi_ins.len()), false))), Bsp::w(Fixed::x(4, button_2("I", "+", false)), Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ - for (_index, track, _x1, _x2) in self.tracks_with_sizes() { + for (index, track, x1, x2) in self.tracks_with_sizes() { add(&Tui::bg(track.color.dark.rgb, Align::w(Fixed::x(track.width as u16, row!( Either(track.sequencer.monitoring, Tui::fg(Green, "mon "), "mon "), Either(track.sequencer.recording, Tui::fg(Red, "rec "), "rec "), @@ -15,13 +20,13 @@ impl Arrangement { ))))) } }))))); - for (_index, port) in self.midi_ins().iter().enumerate() { + for (index, port) in self.midi_ins().iter().enumerate() { add(&Fixed::y(1, Bsp::e( Fixed::x(20, Align::w(Bsp::e(" ● ", Tui::bold(true, Tui::fg(Rgb(255,255,255), port.port_name()))))), Bsp::w(Fixed::x(4, ()), Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ - for (_index, track, _x1, _x2) in self.tracks_with_sizes() { + for (index, track, x1, x2) in self.tracks_with_sizes() { add(&Tui::bg(track.color.darker.rgb, Align::w(Fixed::x(track.width as u16, row!( Either(track.sequencer.monitoring, Tui::fg(Green, " ● "), " · "), Either(track.sequencer.recording, Tui::fg(Red, " ● "), " · "), @@ -41,7 +46,7 @@ impl Arrangement { let list = Bsp::s( Fixed::y(1, Fill::x(Align::w(button_3("o", "utput", format!("{}", self.midi_outs.len()), false)))), Fixed::y(h - 1, Fill::xy(Align::nw(Stack::south(|add: &mut dyn FnMut(&dyn Render)|{ - for (_index, port) in self.midi_outs().iter().enumerate() { + for (index, port) in self.midi_outs().iter().enumerate() { add(&Fixed::y(1,Fill::x(Bsp::e( Align::w(Bsp::e(" ● ", Tui::fg(Rgb(255,255,255),Tui::bold(true, port.port_name())))), Fill::x(Align::e(format!("{}/{} ", @@ -55,19 +60,20 @@ impl Arrangement { Fixed::y(h, self.view_track_row_section(theme, list, button_2("O", "+", false), Tui::bg(theme.darker.rgb, Align::w(Fill::x( Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ - for (index, track, _x1, _x2) in self.tracks_with_sizes() { + for (index, track, x1, x2) in self.tracks_with_sizes() { add(&Fixed::x(self.track_width(index, track), Stack::south(move|add: &mut dyn FnMut(&dyn Render)|{ + let index = 0; add(&Fixed::y(1, Align::w(Bsp::e( Either(true, Tui::fg(Green, "play "), "play "), Either(false, Tui::fg(Yellow, "solo "), "solo "), )))); - for (_index, port) in self.midi_outs().iter().enumerate() { + for (index, port) in self.midi_outs().iter().enumerate() { add(&Fixed::y(1, Align::w(Bsp::e( Either(true, Tui::fg(Green, " ● "), " · "), Either(false, Tui::fg(Yellow, " ● "), " · "), )))); - for (_index, _conn) in port.connections.iter().enumerate() { + for (index, conn) in port.connections.iter().enumerate() { add(&Fixed::y(1, Fill::x(""))); } }})))}})))))) @@ -82,10 +88,10 @@ impl Arrangement { button_3("d", "evice", format!("{}", self.track().map(|t|t.devices.len()).unwrap_or(0)), false), button_2("D", "+", false), Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ - for (index, track, _x1, _x2) in self.tracks_with_sizes() { + for (index, track, x1, x2) in self.tracks_with_sizes() { add(&Fixed::xy(self.track_width(index, track), h + 1, Tui::bg(track.color.dark.rgb, Align::nw(Map::south(2, move||0..h, - |_, _index|Fixed::xy(track.width as u16, 2, + |_, index|Fixed::xy(track.width as u16, 2, Tui::fg_bg( ItemTheme::G[32].lightest.rgb, ItemTheme::G[32].dark.rgb, @@ -121,8 +127,8 @@ pub trait TracksView: } /// Iterate over tracks with their corresponding sizes. fn tracks_with_sizes (&self) -> impl TracksSizes<'_> { - let _editor_width = self.editor().map(|e|e.width()); - let _active_track = self.selection().track(); + let editor_width = self.editor().map(|e|e.width()); + let active_track = self.selection().track(); let mut x = 0; self.tracks().iter().enumerate().map_while(move |(index, track)|{ let width = track.width.max(8); @@ -137,7 +143,7 @@ pub trait TracksView: } fn view_track_row_section <'a> ( &'a self, - _theme: ItemTheme, + theme: ItemTheme, button: impl Content, button_add: impl Content, content: impl Content @@ -171,7 +177,7 @@ pub trait TracksView: ), Tui::bg(theme.darker.rgb, Fixed::y(2, Fill::x( Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ - for (index, track, _x1, _x2) in self.tracks_with_sizes() { + for (index, track, x1, x2) in self.tracks_with_sizes() { add(&Fixed::x(self.track_width(index, track), Tui::bg(if self.selection().track() == Some(index) { track.color.light.rgb @@ -184,7 +190,7 @@ pub trait TracksView: } }))))) } - fn view_track_outputs <'a> (&'a self, theme: ItemTheme, _h: u16) -> impl Content { + fn view_track_outputs <'a> (&'a self, theme: ItemTheme, h: u16) -> impl Content { self.view_track_row_section(theme, Bsp::s( Fill::x(Align::w(button_2("o", "utput", false))), @@ -196,7 +202,7 @@ pub trait TracksView: button_2("O", "+", false), Tui::bg(theme.darker.rgb, Align::w(Fill::x( Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ - for (index, track, _x1, _x2) in self.tracks_with_sizes() { + for (index, track, x1, x2) in self.tracks_with_sizes() { add(&Fixed::x(self.track_width(index, track), Align::nw(Fill::y(Map::south(1, ||track.sequencer.midi_outs.iter(), |port, index|Tui::fg(Rgb(255, 255, 255), @@ -216,7 +222,7 @@ pub trait TracksView: button_2("I", "+", false), Tui::bg(theme.darker.rgb, Align::w(Fill::x( Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ - for (index, track, _x1, _x2) in self.tracks_with_sizes() { + for (index, track, x1, x2) in self.tracks_with_sizes() { add(&Fixed::xy(self.track_width(index, track), h + 1, Align::nw(Bsp::s( Tui::bg(track.color.base.rgb, @@ -275,7 +281,7 @@ pub trait ScenesView: })) } fn view_scene_name (&self, index: usize, scene: &Scene) -> impl Content { - let h = if self.selection().scene() == Some(index) && let Some(_editor) = self.editor() { + let h = if self.selection().scene() == Some(index) && let Some(editor) = self.editor() { 7 } else { Self::H_SCENE as u16 diff --git a/crates/device/src/browser.rs b/crates/device/src/browser.rs index 5a83e797..bba19e76 100644 --- a/crates/device/src/browser.rs +++ b/crates/device/src/browser.rs @@ -1,3 +1,3 @@ mod browser_api; pub use self::browser_api::*; mod browser_model; pub use self::browser_model::*; -mod browser_view; //pub use self::browser_view::*; +mod browser_view; pub use self::browser_view::*; diff --git a/crates/device/src/browser/browser_view.rs b/crates/device/src/browser/browser_view.rs index af84ba3a..45f42863 100644 --- a/crates/device/src/browser/browser_view.rs +++ b/crates/device/src/browser/browser_view.rs @@ -5,7 +5,7 @@ content!(TuiOut: |self: Browser|Map::south(1, ||EntriesIterator { index: 0, length: self.dirs.len() + self.files.len(), browser: self, -}, |entry, _index|Fill::x(Align::w(entry)))); +}, |entry, index|Fill::x(Align::w(entry)))); struct EntriesIterator<'a> { browser: &'a Browser, diff --git a/crates/device/src/editor/editor_view.rs b/crates/device/src/editor/editor_view.rs index 0a11c72c..c553cdfc 100644 --- a/crates/device/src/editor/editor_view.rs +++ b/crates/device/src/editor/editor_view.rs @@ -9,7 +9,7 @@ content!(TuiOut: |self: MidiEditor| { impl MidiEditor { pub fn clip_status (&self) -> impl Content + '_ { - let (_color, name, length, looped) = if let Some(clip) = self.clip().as_ref().map(|p|p.read().unwrap()) { + let (color, name, length, looped) = if let Some(clip) = self.clip().as_ref().map(|p|p.read().unwrap()) { (clip.color, clip.name.clone(), clip.length, clip.looped) } else { (ItemTheme::G[64], String::new().into(), 0, false) }; Fixed::x(20, col!( @@ -26,7 +26,7 @@ impl MidiEditor { } pub fn edit_status (&self) -> impl Content + '_ { - let (_color, length) = if let Some(clip) = self.clip().as_ref().map(|p|p.read().unwrap()) { + let (color, length) = if let Some(clip) = self.clip().as_ref().map(|p|p.read().unwrap()) { (clip.color, clip.length) } else { (ItemTheme::G[64], 0) }; let time_pos = self.get_time_pos(); diff --git a/crates/device/src/lib.rs b/crates/device/src/lib.rs index 0ccf3724..a12fea59 100644 --- a/crates/device/src/lib.rs +++ b/crates/device/src/lib.rs @@ -14,10 +14,10 @@ pub(crate) use std::error::Error; pub(crate) use std::ffi::OsString; pub(crate) use ::tengri::{from, has, maybe_has, Usually, Perhaps, Has, MaybeHas}; -pub(crate) use ::tengri::{dsl::*, input::*, output::*, tui::{*, ratatui::prelude::*}}; +pub(crate) use ::tengri::{dsl::*, input::*, output::{*, Margin}, tui::{*, ratatui::prelude::*}}; pub(crate) use ::tek_engine::*; pub(crate) use ::tek_engine::midi::{u7, LiveEvent, MidiMessage}; -pub(crate) use ::tek_engine::jack::{Control, ProcessScope, RawMidi}; +pub(crate) use ::tek_engine::jack::{Control, ProcessScope, MidiWriter, RawMidi}; pub(crate) use ratatui::{prelude::Rect, widgets::{Widget, canvas::{Canvas, Line}}}; pub(crate) use Color::*; diff --git a/crates/device/src/pool/pool_model.rs b/crates/device/src/pool/pool_model.rs index 166c4cbe..4dc7a5f5 100644 --- a/crates/device/src/pool/pool_model.rs +++ b/crates/device/src/pool/pool_model.rs @@ -18,7 +18,7 @@ pub struct Pool { //.flatten())); impl Default for Pool { fn default () -> Self { - //use PoolMode::*; + use PoolMode::*; Self { visible: true, clips: Arc::from(RwLock::from(vec![])), diff --git a/crates/device/src/pool/pool_view.rs b/crates/device/src/pool/pool_view.rs index 481a7dd9..39d868aa 100644 --- a/crates/device/src/pool/pool_view.rs +++ b/crates/device/src/pool/pool_view.rs @@ -7,7 +7,7 @@ content!(TuiOut: |self: PoolView<'a>| { //let color = self.1.clip().map(|c|c.read().unwrap().color).unwrap_or_else(||Tui::g(32).into()); //let on_bg = |x|x;//Bsp::b(Repeat(" "), Tui::bg(color.darkest.rgb, x)); //let border = |x|x;//Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb)).enclose(x); - //let height = pool.clips.read().unwrap().len() as u16; + let height = pool.clips.read().unwrap().len() as u16; Fixed::x(20, Fill::y(Align::n(Map::new( ||pool.clips().clone().into_iter(), move|clip: Arc>, i: usize|{ diff --git a/crates/device/src/port/port_midi_in.rs b/crates/device/src/port/port_midi_in.rs index b92f0c95..23c535c5 100644 --- a/crates/device/src/port/port_midi_in.rs +++ b/crates/device/src/port/port_midi_in.rs @@ -84,7 +84,7 @@ pub trait HasMidiIns { .collect::>() } fn midi_ins_with_sizes <'a> (&'a self) -> - impl Iterator, &'a [Connect], usize, usize)> + Send + Sync + 'a + impl Iterator, &[Connect], usize, usize)> + Send + Sync + 'a { let mut y = 0; self.midi_ins().iter().enumerate().map(move|(i, input)|{ diff --git a/crates/device/src/port/port_midi_out.rs b/crates/device/src/port/port_midi_out.rs index d32cafef..b27978bb 100644 --- a/crates/device/src/port/port_midi_out.rs +++ b/crates/device/src/port/port_midi_out.rs @@ -119,7 +119,7 @@ pub trait HasMidiOuts { fn midi_outs (&self) -> &Vec; fn midi_outs_mut (&mut self) -> &mut Vec; fn midi_outs_with_sizes <'a> (&'a self) -> - impl Iterator, &'a [Connect], usize, usize)> + Send + Sync + 'a + impl Iterator, &[Connect], usize, usize)> + Send + Sync + 'a { let mut y = 0; self.midi_outs().iter().enumerate().map(move|(i, output)|{ diff --git a/crates/device/src/sampler/sampler_view.rs b/crates/device/src/sampler/sampler_view.rs index 90999e2c..ef17810a 100644 --- a/crates/device/src/sampler/sampler_view.rs +++ b/crates/device/src/sampler/sampler_view.rs @@ -7,8 +7,8 @@ impl Sampler { let cells_y = 8u16; let cell_width = 10u16; let cell_height = 2u16; - //let width = cells_x * cell_width; - //let height = cells_y * cell_height; + let width = cells_x * cell_width; + let height = cells_y * cell_height; let cols = Map::east( cell_width, move||0..cells_x, @@ -205,8 +205,8 @@ fn draw_viewer (sample: Option<&Arc>>) -> impl Content + Canvas::default() .x_bounds([0.0, width as f64]) .y_bounds([0.0, height as f64]) - .paint(|_ctx| { - //let text = "press record to begin sampling"; + .paint(|ctx| { + let text = "press record to begin sampling"; //ctx.print( //(width - text.len() as u16) as f64 / 2.0, //height as f64 / 2.0, diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index e3ff52aa..4bbec40d 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -88,10 +88,12 @@ mod time; pub use self::time::*; mod note; pub use self::note::*; pub mod jack; pub use self::jack::*; pub mod midi; pub use self::midi::*; + pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicUsize, AtomicBool, Ordering::Relaxed}}; pub(crate) use std::fmt::Debug; pub(crate) use std::ops::{Add, Sub, Mul, Div, Rem}; -pub(crate) use ::tengri::{from, Usually}; + +pub(crate) use ::tengri::{from, Usually, tui::*, dsl::*}; pub use ::atomic_float; pub(crate) use atomic_float::*; diff --git a/crates/engine/src/midi.rs b/crates/engine/src/midi.rs index 55835404..62b132b7 100644 --- a/crates/engine/src/midi.rs +++ b/crates/engine/src/midi.rs @@ -1,3 +1,5 @@ +use crate::*; + pub use ::midly::{ Smf, TrackEventKind, diff --git a/deps/tengri b/deps/tengri index d7884f62..a1190a24 160000 --- a/deps/tengri +++ b/deps/tengri @@ -1 +1 @@ -Subproject commit d7884f6289ac6c7a88f806f4453fb7c246c87f0b +Subproject commit a1190a24a1bdea774cedf86fff7b7e407c0a4cc7