mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 13:16:44 +01:00
remove vec allocation from plugin callback
This commit is contained in:
parent
828436745c
commit
672d81f353
5 changed files with 150 additions and 116 deletions
|
|
@ -40,9 +40,14 @@ impl Plugin {
|
|||
}
|
||||
pub fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
|
||||
match self.plugin.as_mut() {
|
||||
Some(PluginKind::LV2(LV2Plugin { features, ref mut instance, .. })) => {
|
||||
Some(PluginKind::LV2(LV2Plugin {
|
||||
features,
|
||||
ref mut instance,
|
||||
ref mut input_buffer,
|
||||
..
|
||||
})) => {
|
||||
let urid = features.midi_urid();
|
||||
let mut inputs = vec![];
|
||||
input_buffer.clear();
|
||||
for port in self.ports.midi_ins.values() {
|
||||
let mut atom = ::livi::event::LV2AtomSequence::new(
|
||||
&features,
|
||||
|
|
@ -58,7 +63,7 @@ impl Plugin {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
inputs.push(atom);
|
||||
input_buffer.push(atom);
|
||||
}
|
||||
let mut outputs = vec![];
|
||||
for _ in self.ports.midi_outs.iter() {
|
||||
|
|
@ -69,7 +74,7 @@ impl Plugin {
|
|||
}
|
||||
let ports = ::livi::EmptyPortConnections::new()
|
||||
.with_atom_sequence_inputs(
|
||||
inputs.iter()
|
||||
input_buffer.iter()
|
||||
)
|
||||
.with_atom_sequence_outputs(
|
||||
outputs.iter_mut()
|
||||
|
|
|
|||
|
|
@ -1,18 +1,29 @@
|
|||
use crate::core::*;
|
||||
|
||||
use ::livi::{
|
||||
World,
|
||||
Instance,
|
||||
Plugin,
|
||||
Features,
|
||||
FeaturesBuilder,
|
||||
Port,
|
||||
event::LV2AtomSequence,
|
||||
};
|
||||
|
||||
pub struct LV2Plugin {
|
||||
pub world: ::livi::World,
|
||||
pub instance: ::livi::Instance,
|
||||
pub plugin: ::livi::Plugin,
|
||||
pub features: Arc<::livi::Features>,
|
||||
pub port_list: Vec<::livi::Port>,
|
||||
pub world: World,
|
||||
pub instance: Instance,
|
||||
pub plugin: Plugin,
|
||||
pub features: Arc<Features>,
|
||||
pub port_list: Vec<Port>,
|
||||
pub input_buffer: Vec<LV2AtomSequence>
|
||||
}
|
||||
|
||||
impl LV2Plugin {
|
||||
pub fn new (uri: &str) -> Usually<Self> {
|
||||
// Get 1st plugin at URI
|
||||
let world = ::livi::World::with_load_bundle(&uri);
|
||||
let features = ::livi::FeaturesBuilder { min_block_length: 1, max_block_length: 65536 };
|
||||
let world = World::with_load_bundle(&uri);
|
||||
let features = FeaturesBuilder { min_block_length: 1, max_block_length: 65536 };
|
||||
let features = world.build_features(features);
|
||||
let mut plugin = None;
|
||||
for p in world.iter_plugins() {
|
||||
|
|
@ -39,6 +50,7 @@ impl LV2Plugin {
|
|||
},
|
||||
plugin,
|
||||
features,
|
||||
input_buffer: Vec::with_capacity(1024)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue