down to 28e, sane ones

This commit is contained in:
🪞👃🪞 2024-12-31 15:50:53 +01:00
parent 46609855eb
commit 16e6a0397c
15 changed files with 91 additions and 87 deletions

View file

@ -149,13 +149,14 @@ render!(Tui: (self: Groovebox) => {
struct EditStatus<'a, T: Content<Tui>>(&'a Sampler, &'a MidiEditor, usize, T);
impl<'a, T: Content<Tui>> Content<Tui> for EditStatus<'a, T> {
fn content (&self) -> Option<impl Content<Tui>> {
Some(Split::n(false, 9, col!(
fn content (&self) -> impl Content<Tui> {
Split::n(false, 9, col!(
row!(
Cond::opt(
&self.0.mapped[self.2],
|sample|format!("Sample {}", sample.read().unwrap().end)
),
self.0.mapped[self.2].as_ref().map(|sample|format!(
"Sample {}-{}",
sample.read().unwrap().start,
sample.read().unwrap().end,
)),
MidiEditStatus(&self.1),
),
lay!(
@ -168,7 +169,7 @@ impl<'a, T: Content<Tui>> Content<Tui> for EditStatus<'a, T> {
SampleViewer(None)
})),
),
), &self.3))
), &self.3)
}
}
@ -177,7 +178,7 @@ render!(Tui: (self: GrooveboxSamples<'a>) => {
let note_lo = self.0.editor.note_lo().load(Relaxed);
let note_pt = self.0.editor.note_point();
let note_hi = self.0.editor.note_hi();
Fill::xy(Coll::map((note_lo..=note_hi).rev(), |note, i| {
Fill::xy(Coll::map((note_lo..=note_hi).rev(), move|note, i| {
let mut bg = if note == note_pt { TuiTheme::g(64) } else { Color::Reset };
let mut fg = TuiTheme::g(160);
if let Some((index, _)) = self.0.sampler.recording {
@ -188,7 +189,7 @@ render!(Tui: (self: GrooveboxSamples<'a>) => {
} else if self.0.sampler.mapped[note].is_some() {
fg = TuiTheme::g(224);
}
Push::y(i, Tui::bg(bg, if let Some(sample) = &self.0.sampler.mapped[note] {
Push::y(i as u16, Tui::bg(bg, if let Some(sample) = &self.0.sampler.mapped[note] {
Tui::fg(fg, format!("{note:3} ?????? "))
} else {
Tui::fg(fg, format!("{note:3} (none) "))