mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 05:36:42 +01:00
wip: long awaited fixes to main sequencer
This commit is contained in:
parent
2837ffff4a
commit
78e5469b32
17 changed files with 391 additions and 563 deletions
|
|
@ -1,28 +1,41 @@
|
|||
use crate::core::*;
|
||||
use super::*;
|
||||
|
||||
pub fn plug (uri: &str) -> Usually<PluginKind> {
|
||||
let world = ::livi::World::with_load_bundle(&uri);
|
||||
let features = world.build_features(::livi::FeaturesBuilder {
|
||||
min_block_length: 1,
|
||||
max_block_length: 65536,
|
||||
});
|
||||
let mut plugin = None;
|
||||
for p in world.iter_plugins() {
|
||||
plugin = Some(p);
|
||||
break
|
||||
}
|
||||
let plugin = plugin.unwrap();
|
||||
let mut port_list = vec![];
|
||||
for port in plugin.ports() {
|
||||
port_list.push(port);
|
||||
}
|
||||
Ok(PluginKind::LV2 {
|
||||
instance: unsafe {
|
||||
plugin.instantiate(features.clone(), 48000.0).expect("boop")
|
||||
},
|
||||
port_list,
|
||||
features,
|
||||
world,
|
||||
})
|
||||
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>,
|
||||
}
|
||||
|
||||
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 features = world.build_features(features);
|
||||
let mut plugin = None;
|
||||
for p in world.iter_plugins() {
|
||||
plugin = Some(p);
|
||||
break
|
||||
}
|
||||
let plugin = plugin.unwrap();
|
||||
|
||||
// Instantiate
|
||||
Ok(Self {
|
||||
world,
|
||||
instance: unsafe {
|
||||
plugin.instantiate(features.clone(), 48000.0).expect("boop")
|
||||
},
|
||||
port_list: {
|
||||
let mut port_list = vec![];
|
||||
for port in plugin.ports() {
|
||||
port_list.push(port);
|
||||
}
|
||||
port_list
|
||||
},
|
||||
plugin,
|
||||
features,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue