Search guides and the APICtrl K
  1. API reference
  2. Formats and wrappers

lv2_wrapper.h

The LV2 format wrapper.

#include <sonore/lv2_wrapper.h>
On this page

Design notes

LV2 is the open standard (ISC-licensed headers, vendored) that Linux DAWs (Ardour, Reaper on Linux, Carla, Zrythm) treat as native. The plugin is a shared library plus a bundle of Turtle (.ttl) metadata describing every port; hosts read the TTL to know the plugin's shape BEFORE loading any code.

Include it AFTER clap_wrapper.h, like the other formats: the CLAP wrapper owns the shared machinery (Instance, parameters, the UI queue) and this file adapts it, so one source builds .clap, .vst3 and .lv2 that cannot drift.

The TTL is GENERATED, never hand-written: compiling the same source with SONORE_LV2_TTLGEN yields a tiny program that emits manifest.ttl and the plugin's .ttl from the descriptor. Metadata written by hand drifts from the code the first time anyone adds a parameter: generating both from one table is the whole reason the descriptor exists.

Port layout (index order is the contract, and the TTL states it):

effect:      [0..P-1] control in | [P] audio in L | [P+1] in R
             | [P+2] out L | [P+3] out R
instrument:  [0..P-1] control in | [P] atom MIDI in | [P+1] out L | [P+2] out R

LV2's control ports are one float* each, connected by the host and read per run(): parameters land at block granularity, which the toolkit's smoothers exist to make inaudible (same story as every other format here).

Types 4

LV2_Worker_Schedule, the host's half: schedule_work() hands a job to the worker thread. Spelled here for its layout; see above.

LV2_Worker_Interface, the plugin's half: work() runs on the worker thread, work_response() back on the audio thread before the next run(), and end_run() after each run().

LV2_Log_Log: the host's log, for non-realtime contexts only.

One LV2 instance: the Instance every format wrapper shares, plus what LV2 adds -- the host's port pointers, the URIDs it mapped, the worker and the log it offered, and the MIDI and transport of the current run().

Functions 44

Enums 1

Constants 1

Macros 3

↑↓ to move↵ to openEvery public name in the headers, and every guide