simplify groovebox module

This commit is contained in:
🪞👃🪞 2024-12-17 11:59:42 +01:00
parent c685621788
commit bd7e1d16d6

View file

@ -7,7 +7,7 @@ impl TryFrom<&Arc<RwLock<JackClient>>> for GrooveboxTui {
Ok(Self {
sequencer: SequencerTui::try_from(jack)?,
sampler: SamplerTui::try_from(jack)?,
focus: GrooveboxFocus::Sampler,
split: 20
})
}
}
@ -15,22 +15,9 @@ impl TryFrom<&Arc<RwLock<JackClient>>> for GrooveboxTui {
pub struct GrooveboxTui {
pub sequencer: SequencerTui,
pub sampler: SamplerTui,
pub focus: GrooveboxFocus,
pub split: u16,
}
/// Sections that may be focused
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum GrooveboxFocus {
/// The transport (toolbar) is focused
Transport(TransportFocus),
/// The phrase list (pool) is focused
PhraseList,
/// The phrase editor (sequencer) is focused
PhraseEditor,
/// The sample player is focused
Sampler
}
render!(|self:GrooveboxTui|"are we groovy yet?");
render!(|self:GrooveboxTui|Bsp::n(Tui::fixed_y(self.split, &self.sampler), &self.sequencer));
audio!(|self:GrooveboxTui,_client,_process|Control::Continue);
handle!(<Tui>|self:GrooveboxTui,input|Ok(None));