AUDIO
Source snapshot · 11 November 2026

LV2

Generic LV2 export

Status: Prototype for 0.1.0. Design: decision 0281; LV2 choices: decision 0283. The support matrix separates macOS, Linux and Windows evidence (see also limits).

One LV2 module (ravet_lv2), one UI module (ravet_lv2_ui) and a Turtle generator (ravet_lv2_turtle) are written once against the product table RavetPlugin.h. The sources are in crates/ravet-plugin/lv2. A bundle contains:

File Content
ravet_lv2.{so,dylib,dll} The generic DSP module (lv2_descriptor)
ravet_lv2_ui.{so,dylib,dll} The generic UI module (lv2ui_descriptor), when the bundle has a UI
ravet_product.{so,dylib,dll} The product library, renamed; it exports ravet_plugin_v1
manifest.ttl, plugin.ttl Generated from the product's table at build time
LV2-SDK-LICENSE.txt, RAVET-LICENSE.txt, RAVET-LICENSING.md Notices (added by the bundle script)

Both modules find their own directory at run time (dladdr or GetModuleFileNameW) and load ravet_product from it. The product library is never unloaded.

Build a bundle

The LV2 headers are external and never vendored. Use the official source release (it has include/lv2/... and COPYING), or any flat tree with lv2/core/lv2.h, such as the one JUCE ships:

git clone --depth 1 --branch v1.18.10 https://gitlab.com/lv2/lv2.git target/sdks/lv2
CARGO_BUILD_JOBS=2 python3 scripts/bundle-lv2.py --plugin delay --sdk target/sdks/lv2

--plugin delay builds examples/delay-plugin, --plugin generic the gain plug-in (examples/gain-plugin) and --plugin mock the C++ test table only; --crate <package> selects any product crate. The script builds the crate with Cargo, configures and builds crates/ravet-plugin/lv2 with CMake, runs its tests with CTest, copies the bundle to target/lv2/<name>.lv2 (for example ravet_delay.lv2) with notices, signs the three binaries ad hoc on macOS and runs lv2_validate when it is installed. It installs nothing. --plugin gain, performance and note-routing still select the 0.0.1 references below.

The same build without the script:

cargo build --release --locked -p ravet-delay-plugin
cmake -S crates/ravet-plugin/lv2 -B target/lv2/generic-ravet_delay -DCMAKE_BUILD_TYPE=Release \
  -DRAVET_LV2_SDK="$PWD/target/sdks/lv2" \
  -DRAVET_PLUGIN_LIBRARY="$PWD/target/release/libravet_delay_plugin.so" \
  -DRAVET_LV2_BUNDLE_NAME=ravet_delay
cmake --build target/lv2/generic-ravet_delay --parallel 2
ctest --test-dir target/lv2/generic-ravet_delay --output-on-failure

The bundle is then in target/lv2/generic-ravet_delay/bundles/ravet_delay.lv2. The library is libravet_delay_plugin.dylib on macOS and ravet_delay_plugin.dll on Windows. Options: RAVET_LV2_LICENSE=<URI> writes doap:license; RAVET_LV2_UI ships and declares the UI (default on; the bundle scripts pass it explicitly; see the UI). The product must be built with the native feature of ravet-plugin, as the examples are. Turtle is generated by loading the built library, so it is generated for the platform the bundle is built for. A Windows cross-build (--target windows, below) runs the Windows generator under Wine through CMAKE_CROSSCOMPILING_EMULATOR; there is no other cross-compilation.

Generated metadata and ports

lv2:URI is the product's lv2_uri (by default urn:<plug-in ID>). The class is lv2:Plugin for effects, plus lv2:InstrumentPlugin or lv2:MIDIPlugin. doap:name and doap:maintainer (vendor and URL) come from the product, and version a.b.c becomes lv2:minorVersion a × 1000 + b and lv2:microVersion c. urid:map, options:options and bufsz:boundedBlockLength are optional features; state:interface is provided.

LV2 has one fixed port set per URI, so the adapter uses the product's preferred (first) layout only. Other layouts are not exported. Ports, in index order:

Ports Symbols Notes
Audio inputs, then outputs in_1…, out_1… Named Left/Right for two channels
Atom input events_in Always present. Supports time:Position, and midi:MidiEvent when the product takes notes. lv2:control designation, connection optional
Atom output midi_out Only when the product emits notes. Connection optional
Control output latency lv2:latency designation, integer frames
One control port per parameter the parameter key Declaration order

Parameter ports carry the physical minimum, maximum and default. Port properties follow the parameter:

Port symbols come from parameter keys and stay stable; port indices follow declaration order. Inserting, removing or reordering parameters therefore changes the indices of later ports, which hosts that store indices instead of symbols would misassign. Add parameters at the end, and keep a removed parameter as a hidden read-only entry if released sessions must keep loading (see the 0.1.0 upgrade notes).

A key that is not a valid LV2 symbol, or that clashes with a fixed symbol, becomes p<host ID>. The same code computes the layout at build time and at run time, so Turtle and the module always agree.

Processing

run does not allocate, lock or block; buffers are sized at instantiation and activation. Activation prepares the table; deactivation calls deactivate.

State

state:interface saves the product's whole state envelope (save_state) as one atom:Chunk property, urn:ravet:lv2:state, flagged POD and portable. Restore calls load_state, which applies all values or none and accepts earlier versions and the product's import format. A wrong type is LV2_STATE_ERR_BAD_TYPE, a rejected envelope LV2_STATE_ERR_UNKNOWN; a missing property leaves values unchanged, because the control ports carry them. Without urid:map, save and restore return LV2_STATE_ERR_NO_FEATURE.

Hosts also store control port values. After a restore, the port values present at the next block are taken as given, so ports still holding pre-restore values do not undo it; any later port change wins.

UI

The UI is an X11UI on Linux and other Unix systems, a CocoaUI on macOS and a WindowsUI on Windows. It requires ui:parent and ui:idleInterface, and uses ui:resize and ui:touch when offered. It opens the product's web editor with editor_open inside the host's parent view, reports the editor size through ui:resize, and forwards host resizes to editor_resize for resizable editors.

The UI never accesses the DSP instance. Hosts may run UIs out of process, and instance-access is not universal, so the UI creates its own mirror instance of the product table that is never prepared or processed:

Because of this, the editor sees parameter values only. Product messages that need the processor, telemetry and product extra state are not available in the LV2 editor.

The table hosts editors in Cocoa views on macOS, HWNDs on Windows and X11 windows on Linux (decision 0293), so product bundles declare ui:CocoaUI, ui:WindowsUI or ui:X11UI on every platform (RAVET_LV2_UI, default on). Products without an editor still get no UI. The UI's idle interface calls editor_idle, which pumps GTK on Linux. The Delay's UI ran in REAPER 7.82 on Linux (X11, inside REAPER's non-XEmbed child window) and Windows 11 (see work status); no other LV2 host was available, and hosts built on GTK 2 or GTK 4 (Ardour, for example) are refused by the Linux web view.

Linux build and validation

# Tools: cmake, a C++17 compiler, Rust; optional lilv (lv2ls, lv2info, lv2apply,
# lilv-0 development files), lv2_validate (sord), lv2lint, jalv.
git clone --depth 1 --branch v1.18.10 https://gitlab.com/lv2/lv2.git target/sdks/lv2
CARGO_BUILD_JOBS=2 python3 scripts/bundle-lv2.py --plugin mock --sdk target/sdks/lv2
CARGO_BUILD_JOBS=2 python3 scripts/bundle-lv2.py --plugin delay --sdk target/sdks/lv2
CARGO_BUILD_JOBS=2 python3 scripts/bundle-lv2.py --plugin generic --sdk target/sdks/lv2

mkdir -p target/lv2-path
ln -sfn "$PWD/target/lv2/ravet_delay.lv2" "$PWD/target/lv2/ravet_generic.lv2" target/lv2-path/
export LV2_PATH="$PWD/target/lv2-path:/usr/lib/lv2"
lv2ls
lv2info urn:org.ravet.delay
lv2_validate target/lv2/ravet_delay.lv2/manifest.ttl target/lv2/ravet_delay.lv2/plugin.ttl
lv2lint urn:org.ravet.delay
lv2apply -c gain 0.5 -i stereo.wav -o out.wav urn:org.ravet.gain-generic
lv2apply -c sync 0 -c time 100 -c mix 100 -c feedback 0 -i impulse.wav -o echo.wav urn:org.ravet.delay
jalv.gtk3 urn:org.ravet.delay

lv2apply hosts plug-ins without any features: the adapter then runs without urid:map, ignoring the Atom ports and state. For a DAW such as REAPER, link or copy the bundles into ~/.lv2 and rescan. Expected CTest output is ravet_lv2_mock_contracts, ravet_lv2_mock_aux_contracts (a mock with a sidechain and an auxiliary output), ravet_lv2_mock_turtle_unchanged (the plain mock's Turtle against a golden file), ravet_<name>_smoke and, with lilv development files, ravet_lv2_mock_lilv, ravet_lv2_mock_aux_lilv and ravet_<name>_lilv, all passing.

Windows cross-build

# Linux with cargo-xwin, clang-cl and Wine (see plugin-export.md):
python3 scripts/bundle-lv2.py --plugin delay --sdk target/sdks/lv2 --target windows
# Bundle: target/lv2/windows/ravet_delay.lv2 (ravet_lv2.dll, ravet_product.dll)
# Contract tool: target/lv2/windows/generic-ravet_delay/ravet_lv2_contracts.exe

The Turtle generator and the contract tests run under Wine; lv2_validate on the build machine checks the generated Turtle, which matches the Linux bundle's apart from the .dll binary name and CRLF line endings. The lilv host check is skipped (the build machine's lilv cannot load Windows modules). To check on Windows, copy the bundles and ravet_lv2_contracts.exe there and run ravet_lv2_contracts.exe ravet_lv2_mock.lv2 ravet_lv2.dll ravet_lv2_ui.dll --mock and ravet_lv2_contracts.exe ravet_delay.lv2 ravet_lv2.dll -. A native Windows build (MSVC) has not been run.

Tests

The mock product (mock/mock_plugin.cpp) is a small C++ table — gain, bypass, a four-value stepped mode, a read-only level, stereo and mono, notes in and out — with a test probe. Any adapter can test against it.

Limits of the generic export