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

lv2_ui.h

The LV2 user interface.

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

Design notes

The same WebView page that CLAP, VST3 and AU show, presented the way LV2 asks for it. Without this an LV2 host draws a column of generic sliders and the plugin the seller designed simply does not appear.

LV2 keeps the interface and the DSP FURTHER APART than any other format here. They are separate objects with separate lifetimes, they may be in separate binaries, and a host is entitled to run them in separate PROCESSES. So this shares no state with the plugin instance: everything the interface knows arrives through port_event(), and everything it does leaves through the host's write_function. That is more restrictive than the CLAP path, which reaches into the instance directly, and it is the reason this is a separate file rather than a branch inside the wrapper.

WHAT IS HERE, and what is not:

Windows (ui:WindowsUI): complete, and tested by embedding it in a real
    window and driving a real message loop, exactly as the CLAP and VST3
    GUI tests do.
X11 (ui:X11UI): NOT built, and the reason is worth stating rather than
    leaving as an absence. The GTK backend this SDK carries embeds a
    GtkPlug INTO a parent window and never exposes an id of its own;
    LV2's X11 UI works the other way round, handing the host a window it
    will reparent. Bridging the two is a small change and an untestable
    one: WSL has no display, so it would ship having never been opened.
    The rest of this SDK does not claim what it has not run, and neither
    does this.
Cocoa (ui:CocoaUI): macOS, same argument, and macOS is unverified here
    for the separate reason that CI cannot run at all.

SONORE_LV2_UI is the one switch. Where it is undefined the plugin builds exactly as it did before this file existed and its manifest promises no interface, which is better than promising one that will not open.

Types 5

LV2_Feature, transcribed: one capability the host offers, named by URI, with data whose meaning that URI defines. A host hands instantiate() a null-terminated array of pointers to these, valid for that call; anything kept must be copied. The layout is the C ABI's and must not change.

LV2UI_Descriptor, transcribed: what lv2ui_descriptor() returns to the host -- the UI's URI and the four entry points. The layout is the C ABI's and must not change; this module's one instance is static and lives as long as the library.

The host calls idle() on the main thread, which is where a WebView's message loop has to be pumped and where anything the page said gets turned into a port write. Returning non-zero asks the host to close the UI.

LV2UI_Resize, transcribed: the ui:resize feature. A host that offers it is told the interface's size through ui_resize(handle, width, height); a host that does not simply takes the window at the size it is made.

One open LV2 interface, the handle instantiate() returns to the host: the webview, the host's write_function, and what the page and the plugin have said to each other that has not been delivered yet.

Shares nothing with the plugin instance (see the file comment): parameters arrive through port_event and leave through write_function, the state and notes as atoms. Every call on it is the host's UI thread -- instantiate, port_event, idle, cleanup -- and the host deletes it through cleanup(), except while a file dialog is open (see dialogsOpen).

Functions 11

Aliases 4

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