simplify sample mapping

This commit is contained in:
🪞👃🪞 2024-12-28 17:06:19 +01:00
parent 48f341ba2c
commit 2feb21bd1f
4 changed files with 40 additions and 23 deletions

View file

@ -61,6 +61,7 @@ render!(<Tui>|self:GrooveboxTui|{
let phrase_w = if w > 60 { 20 } else if w > 40 { 15 } else { 10 };
let pool_w = if self.pool.visible { phrase_w } else { 0 };
let sampler_w = 11;
let note_pt = self.editor.note_point();
Fill::wh(lay!([
&self.size,
Fill::wh(Align::s(Fixed::h(2, GrooveboxStatus::from(self)))),
@ -84,11 +85,14 @@ render!(<Tui>|self:GrooveboxTui|{
&format!("L/{:>+9.3}", self.sampler.input_meter[0]),
&format!("R/{:>+9.3}", self.sampler.input_meter[1]),
Fill::wh(col!(note in (self.editor.note_lo().load(Relaxed)..=self.editor.note_hi()).rev() => {
if self.sampler.mapped.contains_key(&u7::from(note as u8)) {
todo!()
} else {
Tui::fg(TuiTheme::g(96), format!("{note:3} (none)"))
}
Tui::bg(
if note == note_pt { TuiTheme::g(64) } else { Color::Reset },
if let Some(sample) = &self.sampler.mapped[note] {
todo!()
} else {
Tui::fg(TuiTheme::g(160), format!("{note:3} (none)"))
}
)
})),
])), Fill::h(&self.editor))
)
@ -188,6 +192,7 @@ command!(|self:GrooveboxCommand,state:GrooveboxTui|match self {
}
},
Self::Clock(cmd) => cmd.execute(state)?.map(Clock),
Self::Sampler(cmd) => cmd.execute(&mut state.sampler)?.map(Sampler),
Self::Enqueue(phrase) => {
state.player.enqueue_next(phrase.as_ref());
None
@ -195,7 +200,4 @@ command!(|self:GrooveboxCommand,state:GrooveboxTui|match self {
Self::History(delta) => {
todo!("undo/redo")
},
Self::Sampler(command) => {
todo!("sampler")
}
});