mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 21:56:42 +01:00
wip: borrow checker battles
This commit is contained in:
parent
1d4db3c629
commit
7fbb40fad6
38 changed files with 778 additions and 708 deletions
|
|
@ -12,12 +12,12 @@ pub struct Plugin {
|
|||
handle!(Plugin |self, e| handle_keymap(self, e, KEYMAP_PLUGIN));
|
||||
process!(Plugin = Plugin::process);
|
||||
impl<'a> Render<TuiOutput<'a>, Rect> for Plugin {
|
||||
fn render (&self, to: &mut TuiOutput<'a>) -> Usually<Rect> {
|
||||
let Rect { x, y, height, .. } = area;
|
||||
fn render (&self, to: &mut TuiOutput<'a>) -> Perhaps<Rect> {
|
||||
let Rect { x, y, height, .. } = to.area;
|
||||
let mut width = 20u16;
|
||||
match &state.plugin {
|
||||
match &self.plugin {
|
||||
Some(PluginKind::LV2(LV2Plugin { port_list, instance, .. })) => {
|
||||
let start = state.selected.saturating_sub((height as usize / 2).saturating_sub(1));
|
||||
let start = self.selected.saturating_sub((height as usize / 2).saturating_sub(1));
|
||||
let end = start + height as usize - 2;
|
||||
//draw_box(buf, Rect { x, y, width, height });
|
||||
for i in start..end {
|
||||
|
|
@ -30,11 +30,12 @@ impl<'a> Render<TuiOutput<'a>, Rect> for Plugin {
|
|||
//let label = &format!("C·· M·· {:25} = {value:.03}", port.name);
|
||||
let label = &format!("{:25} = {value:.03}", port.name);
|
||||
width = width.max(label.len() as u16 + 4);
|
||||
label.blit(buf, x + 2, y + 1 + i as u16 - start as u16, if i == state.selected {
|
||||
let style = if i == self.selected {
|
||||
Some(Style::default().green())
|
||||
} else {
|
||||
None
|
||||
})?;
|
||||
} ;
|
||||
label.blit(to.buffer, x + 2, y + 1 + i as u16 - start as u16, style)?;
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
|
@ -42,8 +43,8 @@ impl<'a> Render<TuiOutput<'a>, Rect> for Plugin {
|
|||
},
|
||||
_ => {}
|
||||
};
|
||||
draw_header(state, buf, area.x, area.y, width)?;
|
||||
Ok(Some(Rect { width, ..area }))
|
||||
draw_header(self, to.buffer, to.area.x, to.area.y, width)?;
|
||||
Ok(Some(Rect { width, ..to.area }))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +57,7 @@ pub enum PluginKind {
|
|||
VST3,
|
||||
}
|
||||
impl Plugin {
|
||||
pub fn new_lv2 (name: &str, path: &str) -> Usually<JackDevice> {
|
||||
pub fn new_lv2 <T, U> (name: &str, path: &str) -> Usually<JackDevice<T, U>> {
|
||||
let plugin = LV2Plugin::new(path)?;
|
||||
jack_from_lv2(name, &plugin.plugin)?
|
||||
.run(|ports|Box::new(Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue