Release v0.5
Pre-releaseWe are happy to release the new version 0.5.0 of rust-lv2, a safe, fast, and ergonomic framework to create LV2 plugins for audio processing, written in Rust.
What has changed?
- The Worker features and extensions were implemented and are ready to be used now.
- The
uriattribute was introduced, which implementsUriBoundfor the attributed type. - The
lv2crate has been expanded to a powerful and configurable re-export crate. - Host features are now accessible from all plugin methods and a second feature collection type was introduced. All methods in the audio threading class (e.g.
run) have access to an instance of this second collection. - The
UriBoundandURIDtypes as well as code that belongs to them has moved to their own crate, calledurid. This change was made to make this code more reusable and to flatten the dependency graph.
Porting projects to version 0.5
Updating your dependencies
First of all, you're advised to use the lv2 crate to access the framework. This crate has optional dependencies to all sub-crates now, which can be activated via features. Let's assume that your dependency section looked like this before:
[dependencies]
wmidi = "3.1.0"
lv2-core = "1.0.0"
lv2-urid = "1.0.0"
lv2-atom = "1.0.0"
lv2-units = "0.1.0"
lv2-midi = { version = "1.0.0", features = ["wmidi"]}This dependency section translates to the following:
[dependencies]
wmidi = "3.1.0"
lv2 = { version = "0.5.0", features = ["wmidi", "lv2-units"] }The features lv2-core, lv2-atom, lv2-midi, lv2-urid, and urid are enabled by default and therefore don't need to be listed.
Using the re-export crate
After the update, you can not directly use the sub-crates anymore. Instead, you should use them via the lv2 re-export crate. A use lv2_core becomes a lv2::core now. lv2 also provides the super-prelude, which includes the preludes of all enabled sub-crates. You can simply use lv2::prelude::* to get all you need!
Using the uri attribute
Previously, you had to implement the unsafe, but very useful UriBound trait manually. Now, you can write something neat like this:
#[uri("urn:rust-lv2-book:eg-amp-rs")]
pub struct Amp;This attribute can implement UriBound for structs, enums, unions and type definitions and is safe to use since it always adds the null terminator to the generated URI.
API changes
The following types were renamed that were commonly used in plugins:
lv2_urid::Map->lv2_urid::LV2Maplv2_urid::Unmap->lv2_urid::LV2Umap
The lv2_core::plugin::Plugin trait has had some changes too:
- All feature collections are mutably borrowed now.
- There are two different feature collection types now, one for instantiation class methods and one for audio class methods.
Assuming that your previous Plugin implementation looks like this:
impl Plugin for MyPlugin {
type Ports = Ports;
type Features = Features<'static>;
fn new(plugin_info: &PluginInfo, features: Features<'static>) -> Option<Self> {
...
}
fn run(&mut self, ports: &mut Ports) {
...
}
}You should now use something like this:
impl Plugin for MyPlugin {
type Ports = Ports;
type InitFeatures = Features<'static>;
type AudioFeatures = ();
fn new(plugin_info: &PluginInfo, features: &mut Features<'static>) -> Option<Self> {
...
}
fn run(&mut self, ports: &mut Ports, _: &mut ()) {
...
}
}