A library for hosting LV2 plugins.
Note: This is a work in progress and has not yet been full tested.
LV2 has a simple core interface but is accompanied by extensions that can add lots of functionality. This library aims to support as many features as possible out of the box.
http://lv2plug.in/ns/ext/urid#map
http://lv2plug.in/ns/ext/urid#unmap
http://lv2plug.in/ns/ext/options#options
http://lv2plug.in/ns/ext/buf-size#boundedBlockLength
Below is an example on how to run the mda EPiano plugin.
```rust use livi;
let mut world = livi::World::new();
const MINBLOCKSIZE: usize = 1;
const MAXBLOCKSIZE: usize = 256;
const SAMPLERATE: f64 = 44100.0;
world
.initializeblocklength(MINBLOCKSIZE, MAXBLOCKSIZE)
.unwrap();
let plugin = world
// This is the URI for mda EPiano. You can use the lv2ls
command line
// utility to see all available LV2 plugins.
.pluginbyuri("http://drobilla.net/plugins/mda/EPiano")
.expect("Plugin not found.");
let mut instance = unsafe {
plugin
.instantiate(SAMPLERATE)
.expect("Could not instantiate plugin.")
};
// Where midi events will be read from. let input = { let mut s = livi::event::LV2AtomSequence::new(&world, 1024); let playnotedata = [0x90, 0x40, 0x7f]; s.pushmidievent::<3>(1, world.midiurid(), &playnote_data) .unwrap(); s };
// Where parameters can be set. We initialize to the plugin's default values.
let params: Vec
// Set up the port configuration and run the plugin!
// The results will be stored in outputs
.
let ports = EmptyPortConnections::new(MAXBLOCKSIZE)
.withatomsequenceinputs(std::iter::once(&input))
.withaudiooutputs(outputs.itermut().map(|output| output.asmutslice()))
.withcontrolinputs(params.iter());
unsafe { instance.run(ports).unwrap() };
```
cargo build
cargo test
, requires mda LV2 plugins.cargo run --example livi-jack --release -- --plugin-uri=http://drobilla.net/plugins/mda/EPiano
.