High-level Rust hosting library for VST2/3 and CLAP. Largely based on EasyVst and vst-rs.
- Download the VST SDK and unzip it.
- Set the environment variable
VSTSDK_DIRto the path of the unzipped SDK. To clarify, it should point to a directory calledVST_SDKwith multiple other files and directories inside it.
For full examples see the examples directory.
let host = host::Host::new(
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"),
env!("CARGO_PKG_AUTHORS"),
);
thread_check::mark_current_as_main();
let descriptors = discovery::get_descriptor_from_file(&plugin_path);
println!("{:?}", descriptors);
let mut plugin = plugin::load(
&plugin_path,
&descriptors.first().expect("No plugins in file").id,
&host,
)
.unwrap();
println!("{:?}", plugin.get_io_configuration());// Audio thread
let process_details = ProcessDetails {
block_size: 512,
sample_rate: 44100,
nanos: start_time
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_nanos() as f64,
..Default::default()
};
plugin.process(
&input_buses,
&mut output_buses,
events,
&process_details,
);// Main thread
let (width, height) = plugin.show_editor(window_id, WindowIDType::this_platform()).unwrap();
window.set_size(width as u32, height as u32).unwrap();
loop {
let events = plugin.get_events();
if !events.is_empty() {
println!("Received events: {:?}", events);
}
for event in events {
match event {
PluginIssuedEvent::ResizeWindow(width, height) => {
window.set_size(width as u32, height as u32).unwrap();
}
PluginIssuedEvent::Parameter(param) => {
let param = plugin.get_parameter(param.parameter_id);
println!("Parameter updated {:?}", param);
}
_ => {}
}
}
}future-thread-pool: Abstracts the CLAP thread pool behind an awaitableFuture.serde: AddsSerializeandDeserializeto various structures.
You may use this in any project, proprietary or open source but if you vendor it or make modifications, those changes must be made public.