mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
transport compact mode
This commit is contained in:
parent
6776e2ec55
commit
92459b5f82
6 changed files with 134 additions and 83 deletions
34
src/sampler/sample_list.rs
Normal file
34
src/sampler/sample_list.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct SampleList<'a>(&'a Sampler, &'a MidiEditor);
|
||||
|
||||
impl<'a> SampleList<'a> {
|
||||
pub fn new (sampler: &'a Sampler, editor: &'a MidiEditor) -> Self {
|
||||
Self(sampler, editor)
|
||||
}
|
||||
}
|
||||
|
||||
render!(Tui: (self: SampleList<'a>) => {
|
||||
let Self(sampler, editor) = self;
|
||||
let note_lo = editor.note_lo().load(Relaxed);
|
||||
let note_pt = editor.note_point();
|
||||
let note_hi = editor.note_hi();
|
||||
Fill::xy(Tui::map(move||(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, _)) = sampler.recording {
|
||||
if note == index {
|
||||
bg = Color::Rgb(64,16,0);
|
||||
fg = Color::Rgb(224,64,32)
|
||||
}
|
||||
} else if sampler.mapped[note].is_some() {
|
||||
fg = TuiTheme::g(224);
|
||||
}
|
||||
let offset = |a|Push::y(i as u16, Align::n(Fixed::y(1, Fill::x(a))));
|
||||
offset(Tui::bg(bg, if let Some(sample) = &sampler.mapped[note] {
|
||||
Tui::fg(fg, format!("{note:3} ?????? "))
|
||||
} else {
|
||||
Tui::fg(fg, format!("{note:3} (none) "))
|
||||
}))
|
||||
}))
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue