device picker
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-05-04 16:23:50 +03:00
parent 55b6745d4d
commit a77536c234
6 changed files with 93 additions and 13 deletions

View file

@ -383,16 +383,50 @@ impl Tek {
})
}
pub(crate) fn add_midi_in (&mut self) -> Usually<()> {
pub(crate) fn midi_in_add (&mut self) -> Usually<()> {
self.midi_ins.push(JackMidiIn::new(&self.jack, &format!("M/{}", self.midi_ins.len()), &[])?);
Ok(())
}
pub(crate) fn add_midi_out (&mut self) -> Usually<()> {
pub(crate) fn midi_out_add (&mut self) -> Usually<()> {
self.midi_outs.push(JackMidiOut::new(&self.jack, &format!("{}/M", self.midi_outs.len()), &[])?);
Ok(())
}
pub(crate) fn device_picker_show (&mut self) {
self.modal = Some(Modal::Device(0));
}
pub(crate) fn device_pick (&mut self, index: usize) {
self.modal = Some(Modal::Device(index));
}
pub(crate) fn device_add (&mut self, index: usize) -> Usually<()> {
match index {
0 => {
let jack = self.jack.clone();
self.track_mut()
.expect("no active track")
.devices
.push({
let sampler = Sampler::new(&jack, &"sampler", &[], &[&[], &[]], &[&[], &[]])?;
Device::Sampler(sampler)
});
self.modal = None;
Ok(())
},
1 => todo!(),
_ => unreachable!(),
}
}
pub(crate) fn device_kinds (&self) -> &'static [&'static str] {
&[
"Sampler",
"Plugin (LV2)",
]
}
}
has_size!(<TuiOut>|self: Tek|&self.size);
@ -424,6 +458,7 @@ pub trait HasSelection {
pub enum Modal {
Help,
Menu,
Device(usize)
}
/// Represents the current user selection in the arranger