Expand description
LV2 format wrapper for the truce framework.
Exports a PluginExport implementation as an LV2 plugin via the
export_lv2! macro. LV2’s C ABI is small and stable, so we
hand-roll the bindings rather than pulling in a large lv2-sys crate.
Port layout (default):
0..num_in- audio input (one port per channel)num_in..num_in+num_out- audio output (one port per channel)- next N - control input (one port per parameter, float)
atom_in_port- singleAtomPortfor MIDI input (if plugin accepts MIDI)
MIDI, State, and UI support live in sibling modules.
Macros§
- export_
lv2 - Export a plugin as LV2.
Structs§
- Atom
Sequence - Full
LV2_Atom_Sequence- header then body then events. The port pointer the host hands us points here. - Descriptor
Holder - Holds the static LV2 descriptor plus its owned URI string. One per plugin type per process.
- LV2Descriptor
- LV2’s per-plugin descriptor struct. Matches the layout of
LV2_Descriptorfromlv2.h. - LV2Feature
LV2_Feature- passed by the host toinstantiatevia a null-terminated array. Each feature carries a URI identifying what it provides and an opaque data pointer defined by that extension.- Lv2Instance
- Live instance of an LV2 plugin. Held as
LV2_Handlefor the host. - Lv2Ui
Descriptor - Port
Layout - Describes where each logical port sits in the flat LV2 port-index space.
Filled in once at
instantiate()time.
Constants§
Functions§
- activate⚠
- Safety
- cleanup⚠
- Safety
- connect_
port ⚠ - Safety
- deactivate⚠
- Safety
- derive_
port_ layout - Build a
PortLayoutfrom a plugin instance’s declared bus layout + params. - extension_
data ⚠ - Safety
- instantiate⚠
- Safety
- plugin_
uri - Derive the plugin’s LV2 URI from its
PluginInfo. Thin wrapper aroundtruce_build::lv2::plugin_uri- the single source of truth shared with the manifest writer intruce-derive::lv2_emit. Both paths MUST produce the same string, or hosts will discover the plugin under one URI then fail to look up the saved project’s stored URI. - run⚠
- Safety
- ui_
descriptor - Build a static UI descriptor for this plugin type. Monomorphized per P.
- ui_uri
- Derive the plugin’s LV2 UI URI (plugin URI + “#ui”). Thin wrapper
around
truce_build::lv2::ui_uri- same single-source-of-truth posture asplugin_uri.
Type Aliases§
- Connect
Port Fn - Extension
Data Fn - Instantiate
Fn - Function pointer signatures for the descriptor’s methods.
- LV2Handle
- Plugin instance handle - opaque
void*on the C side. - Lifecycle
Fn - RunFn