Skip to main content

Crate truce_lv2

Crate truce_lv2 

Source
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 - single AtomPort for MIDI input (if plugin accepts MIDI)

MIDI, State, and UI support live in sibling modules.

Macros§

export_lv2
Export a plugin as LV2.

Structs§

AtomSequence
Full LV2_Atom_Sequence - header then body then events. The port pointer the host hands us points here.
DescriptorHolder
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_Descriptor from lv2.h.
LV2Feature
LV2_Feature - passed by the host to instantiate via 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_Handle for the host.
Lv2UiDescriptor
PortLayout
Describes where each logical port sits in the flat LV2 port-index space. Filled in once at instantiate() time.

Constants§

LV2_ATOM__SEQUENCE
LV2_MIDI__MIDI_EVENT
LV2_URID__MAP
LV2_URID__UNMAP

Functions§

activate
Safety
cleanup
Safety
connect_port
Safety
deactivate
Safety
derive_port_layout
Build a PortLayout from 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 around truce_build::lv2::plugin_uri - the single source of truth shared with the manifest writer in truce-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 as plugin_uri.

Type Aliases§

ConnectPortFn
ExtensionDataFn
InstantiateFn
Function pointer signatures for the descriptor’s methods.
LV2Handle
Plugin instance handle - opaque void* on the C side.
LifecycleFn
RunFn