LV2 module

LV2 plugin related code.

Contents

Classes

struct Lv2URIDs
Standard URIDs to be used by every plugin.
struct Lv2Plugin
LV2 plugin.

Enums

enum Lv2PluginPickUiFlag { LV2_PLUGIN_UI_WRAPPABLE, LV2_PLUGIN_UI_EXTERNAL, LV2_PLUGIN_UI_FOR_BRIDGING }
In order of preference.

Typedefs

using Lv2URIDs = struct Lv2URIDs
Standard URIDs to be used by every plugin.
using Lv2Plugin = struct Lv2Plugin
LV2 plugin.
using Lv2PluginPickUiFlag = enum Lv2PluginPickUiFlag
In order of preference.
using Lv2Plugin = struct Lv2Plugin
LV2 plugin.

Functions

void lv2_log_set_printf_funcs(LV2_Log_Log* log)
Needed because we can't set them directly when gi18n.h is included.
auto lv2_state_save_preset(Lv2Plugin* plugin, const char* dir, const char* uri, const char* label, const char* filename) -> int
Saves the preset.
auto lv2_state_delete_current_preset(Lv2Plugin* plugin) -> int
Deletes the current preset.
auto lv2_ui_is_resizable(Lv2Plugin* plugin) -> int
Returns if the UI of the plugin is resizable.
void lv2_ui_init(Lv2Plugin* plugin)
Inits the LV2 plugin UI.
void lv2_ui_instantiate(Lv2Plugin* plugin, const char* native_ui_type, void* parent)
Instantiates the plugin UI.
void lv2_ui_read_and_apply_events(Lv2Plugin* plugin, uint32_t nframes)
Read and apply control change events from UI, for plugins that have their own UIs.
void lv2_ui_send_event_from_ui_to_plugin(Lv2Plugin* plugin, uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void* buffer)
Write events from the plugin's UI to the plugin.
auto lv2_ui_send_event_from_plugin_to_ui(Lv2Plugin* plugin, uint32_t port_index, uint32_t type, uint32_t size, const void* body) -> int
Send event to UI, called during the real time audio thread when processing the plugin.
void lv2_ui_send_control_val_event_from_plugin_to_ui(Lv2Plugin* lv2_plugin, Lv2Port* lv2_port)
Similar to lv2_ui_send_event_from_plugin_to_ui except that it passes a float instead of an LV2 atom.
auto lv2_urid_map_uri(LV2_URID_Map_Handle handle, const char* uri) -> LV2_URID
URID feature map implementation.
auto lv2_urid_unmap_uri(LV2_URID_Unmap_Handle handle, LV2_URID urid) -> const char*
URID feature unmap implementation.
auto lv2_plugin_create_descriptor_from_lilv(const LilvPlugin* lp) -> PluginDescriptor*
Returns a newly allocated plugin descriptor for the given LilvPlugin if it can be hosted, otherwise NULL.
auto lv2_plugin_new_from_uri(Plugin* plugin, const char* uri) -> Lv2Plugin*
Creates an LV2 plugin from given uri.
auto lv2_plugin_instantiate(Lv2Plugin* plugin, char* preset_uri) -> int
Instantiate the plugin.
auto lv2_plugin_new(Plugin* plugin) -> Lv2Plugin*
Creates a new LV2 plugin using the given Plugin instance.
void lv2_plugin_process(Lv2Plugin* lv2_plugin, const long g_start_frames, const nframes_t nframes)
Processes the plugin for this cycle.
auto lv2_plugin_get_latency(Lv2Plugin* pl) -> nframes_t
Returns the plugin's latency in samples.
auto lv2_plugin_pick_ui(const LilvUIs* uis, Lv2PluginPickUiFlag flag, const LilvUI** out_ui, const LilvNode** out_ui_type) -> bool
Pick the most preferable UI.
auto lv2_plugin_save_state_to_file(Lv2Plugin* lv2_plugin, const char* dir) -> int
Saves the current state in given dir.
auto lv2_plugin_save_state_to_str(Lv2Plugin* lv2_plugin) -> int
Saves the current state to a string (returned).
void lv2_plugin_update_port_identifiers(Lv2Plugin* self)
Updates theh PortIdentifier's in the Lv2Plugin.
void lv2_plugin_allocate_port_buffers(Lv2Plugin* plugin)
Allocate port buffers (only necessary for MIDI).
void lv2_plugin_populate_banks(Lv2Plugin* self)
Populates the banks in the plugin instance.
void lv2_plugin_free(Lv2Plugin* plugin)
Frees the Lv2Plugin and all its components.

Enum documentation

enum Lv2PluginPickUiFlag

In order of preference.

Enumerators
LV2_PLUGIN_UI_WRAPPABLE

Plugin UI wrappable using Suil.

LV2_PLUGIN_UI_EXTERNAL

External/KxExternal UI.

LV2_PLUGIN_UI_FOR_BRIDGING

Gtk2.

Typedef documentation

typedef struct Lv2PluginLv2Plugin

LV2 plugin.

typedef enum Lv2PluginPickUiFlagLv2PluginPickUiFlag

In order of preference.

typedef struct Lv2PluginLv2Plugin

LV2 plugin.

Function documentation

void lv2_log_set_printf_funcs(LV2_Log_Log* log)

Needed because we can't set them directly when gi18n.h is included.

int lv2_state_save_preset(Lv2Plugin* plugin, const char* dir, const char* uri, const char* label, const char* filename)

Saves the preset.

int lv2_state_delete_current_preset(Lv2Plugin* plugin)

Deletes the current preset.

int lv2_ui_is_resizable(Lv2Plugin* plugin)

Returns if the UI of the plugin is resizable.

void lv2_ui_init(Lv2Plugin* plugin)

Inits the LV2 plugin UI.

void lv2_ui_instantiate(Lv2Plugin* plugin, const char* native_ui_type, void* parent)

Instantiates the plugin UI.

void lv2_ui_read_and_apply_events(Lv2Plugin* plugin, uint32_t nframes)

Read and apply control change events from UI, for plugins that have their own UIs.

Parameters
plugin
nframes Used for event ports.

Called in the real-time audio thread during plugin processing.

void lv2_ui_send_event_from_ui_to_plugin(Lv2Plugin* plugin, uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void* buffer)

Write events from the plugin's UI to the plugin.

int lv2_ui_send_event_from_plugin_to_ui(Lv2Plugin* plugin, uint32_t port_index, uint32_t type, uint32_t size, const void* body)

Send event to UI, called during the real time audio thread when processing the plugin.

Parameters
plugin
port_index
type Atom type.
size
body

void lv2_ui_send_control_val_event_from_plugin_to_ui(Lv2Plugin* lv2_plugin, Lv2Port* lv2_port)

Similar to lv2_ui_send_event_from_plugin_to_ui except that it passes a float instead of an LV2 atom.

Parameters
lv2_plugin
lv2_port The port to pass the value of.

LV2_URID lv2_urid_map_uri(LV2_URID_Map_Handle handle, const char* uri)

URID feature map implementation.

LV2_URID is just an int (uint32_t) for the given uri.

PluginDescriptor* lv2_plugin_create_descriptor_from_lilv(const LilvPlugin* lp)

Returns a newly allocated plugin descriptor for the given LilvPlugin if it can be hosted, otherwise NULL.

Lv2Plugin* lv2_plugin_new_from_uri(Plugin* plugin, const char* uri)

Creates an LV2 plugin from given uri.

Parameters
plugin A newly created Plugin with its descriptor filled in.
uri The URI.

Used when populating the plugin browser.

int lv2_plugin_instantiate(Lv2Plugin* plugin, char* preset_uri)

Instantiate the plugin.

Parameters
plugin
preset_uri URI of preset to load.

All of the actual initialization is done here. If this is a new plugin, preset_uri should be empty. If the project is being loaded, preset uri should be the state file path.

Lv2Plugin* lv2_plugin_new(Plugin* plugin)

Creates a new LV2 plugin using the given Plugin instance.

Parameters
plugin A newly allocated Plugin instance.

The given plugin instance must be a newly allocated one.

void lv2_plugin_process(Lv2Plugin* lv2_plugin, const long g_start_frames, const nframes_t nframes)

Processes the plugin for this cycle.

Parameters
lv2_plugin
g_start_frames The global start frames.
nframes The number of frames to process.

nframes_t lv2_plugin_get_latency(Lv2Plugin* pl)

Returns the plugin's latency in samples.

This will be 0 if the plugin does not report latency.

bool lv2_plugin_pick_ui(const LilvUIs* uis, Lv2PluginPickUiFlag flag, const LilvUI** out_ui, const LilvNode** out_ui_type)

Pick the most preferable UI.

Returns Whether a UI was picked.

int lv2_plugin_save_state_to_file(Lv2Plugin* lv2_plugin, const char* dir)

Saves the current state in given dir.

Used when saving the project.

int lv2_plugin_save_state_to_str(Lv2Plugin* lv2_plugin)

Saves the current state to a string (returned).

MUST be free'd by caller.

void lv2_plugin_allocate_port_buffers(Lv2Plugin* plugin)

Allocate port buffers (only necessary for MIDI).

void lv2_plugin_populate_banks(Lv2Plugin* self)

Populates the banks in the plugin instance.

void lv2_plugin_free(Lv2Plugin* plugin)

Frees the Lv2Plugin and all its components.