mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: lv2 support?
This commit is contained in:
parent
4b0055a21c
commit
1e395274f6
7 changed files with 153 additions and 10 deletions
|
|
@ -1,8 +1,18 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
mod lv2;
|
||||
mod vst2;
|
||||
mod vst3;
|
||||
|
||||
pub struct Plugin {
|
||||
name: String,
|
||||
plugin: Option<::vst::host::PluginInstance>
|
||||
plugin: Option<PluginKind>
|
||||
}
|
||||
|
||||
enum PluginKind {
|
||||
VST2(::vst::host::PluginInstance),
|
||||
VST3,
|
||||
LV2(::livi::Plugin),
|
||||
}
|
||||
|
||||
impl Plugin {
|
||||
|
|
@ -11,12 +21,9 @@ impl Plugin {
|
|||
name: name.into(),
|
||||
plugin: None,
|
||||
});
|
||||
let mut loader = ::vst::host::PluginLoader::load(
|
||||
&std::path::Path::new("/nix/store/ij3sz7nqg5l7v2dygdvzy3w6cj62bd6r-helm-0.9.0/lib/lxvst/helm.so"),
|
||||
device.state.clone()
|
||||
)?;
|
||||
let plugin = loader.instance()?;
|
||||
device.state.lock().unwrap().plugin = Some(plugin);
|
||||
device.state.lock().unwrap().plugin = Some(self::lv2::plug_in(
|
||||
"file:///nix/store/ij3sz7nqg5l7v2dygdvzy3w6cj62bd6r-helm-0.9.0/lib/lv2/helm.lv2"
|
||||
)?);
|
||||
Ok(device)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
17
src/device/plugin/lv2.rs
Normal file
17
src/device/plugin/lv2.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use crate::prelude::*;
|
||||
use super::*;
|
||||
|
||||
pub fn plug_in (path: &str) -> Usually<PluginKind> {
|
||||
let world = ::livi::World::with_load_bundle(&path);
|
||||
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 result = PluginKind::LV2(plugin.unwrap());
|
||||
Ok(result)
|
||||
}
|
||||
11
src/device/plugin/vst2.rs
Normal file
11
src/device/plugin/vst2.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use crate::prelude::*;
|
||||
use super::*;
|
||||
|
||||
fn set_vst_plugin (host: &Arc<Mutex<Plugin>>, path: &str) -> Usually<PluginKind> {
|
||||
let mut loader = ::vst::host::PluginLoader::load(
|
||||
&std::path::Path::new("/nix/store/ij3sz7nqg5l7v2dygdvzy3w6cj62bd6r-helm-0.9.0/lib/lxvst/helm.so"),
|
||||
host.clone()
|
||||
)?;
|
||||
Ok(PluginKind::VST2(loader.instance()?))
|
||||
}
|
||||
//"file:///nix/store/ij3sz7nqg5l7v2dygdvzy3w6cj62bd6r-helm-0.9.0/lib/lxvst/helm.so"
|
||||
0
src/device/plugin/vst3.rs
Normal file
0
src/device/plugin/vst3.rs
Normal file
Loading…
Add table
Add a link
Reference in a new issue