Lv2 module

Contents

Classes

struct Lv2URIDs
Standard URIDs to be used by every plugin.

Typedefs

using Lv2URIDs = struct Lv2URIDs
Standard URIDs to be used by every plugin.

Functions

auto urid_map_uri(LV2_URID_Map_Handle handle, const char* uri) -> LV2_URID
URID feature map implementation.
auto urid_unmap_uri(LV2_URID_Unmap_Handle handle, LV2_URID urid) -> const char*
URID feature unmap implementation.
auto lv2_plugin_get_lv2_port_by_symbol(Lv2Plugin* plugin, const char* sym) -> Lv2Port*
Returns the Lv2Port corresponding to the given symbol.
void lv2_ui_write(SuilController controller, uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void* buffer)
Write from ui.
auto lv2_ui_port_index(SuilController controller, const char* symbol) -> uint32_t
Returns the index of the Lv2Port corresponding to the given symbol.
void lv2_ui_instantiate(Lv2Plugin* plugin, const char* native_ui_type, void* parent)
Instantiates the Lv2Plugin UI.
auto lv2_plugin_run(Lv2Plugin* plugin, const nframes_t nframes) -> bool
Runs the plugin for this cycle.
void lv2_allocate_port_buffers(Lv2Plugin* plugin)
Allocate port buffers (only necessary for MIDI).
void lv2_backend_activate_port(Lv2Plugin* plugin, uint32_t port_index)
Expose a port to the system (if applicable) and connect it to its buffer.
auto lv2_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_create_from_uri(Plugin* plugin, const char* uri) -> Lv2Plugin*
Creates an LV2 plugin from given uri.
auto lv2_create_from_state(Plugin* plugin, const char* _path) -> Lv2Plugin*
Creates an LV2 plugin from a state file.
auto lv2_load_from_state(Plugin* plugin) -> Lv2Plugin*
Loads an LV2 plugin from its state file.
auto lv2_plugin_instantiate(Lv2Plugin* plugin, char* preset_uri) -> int
Instantiate the plugin.
auto lv2_new(Plugin* plugin) -> Lv2Plugin*
Creates a new LV2 plugin using the given Plugin instance.
void lv2_cleanup(Lv2Plugin* plugin)
TODO.
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_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_free(Lv2Plugin* plugin)
Frees the Lv2Plugin.

Function documentation

LV2_URID 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.

Lv2Port* lv2_plugin_get_lv2_port_by_symbol(Lv2Plugin* plugin, const char* sym)

Returns the Lv2Port corresponding to the given symbol.

Returns the Lv2Port corresponding to the given symbol.

TODO

Used when retrieving the state. FIXME is this needed? Returns the Lv2Port corresponding to the given symbol.

TODO: Build an index to make this faster, currently O(n) which may be a problem when restoring the state of plugins with many ports.

uint32_t lv2_ui_port_index(SuilController controller, const char* symbol)

Returns the index of the Lv2Port corresponding to the given symbol.

For LV2 UIs.

Lv2Plugin* lv2_create_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.

Note that this does not instantiate the plugin. For instantiating the plugin using a preset or state file, see lv2_plugin_instantiate.

Lv2Plugin* lv2_create_from_state(Plugin* plugin, const char* _path)

Creates an LV2 plugin from a state file.

Parameters
plugin A newly created plugin.
_path Path for state to load.

Lv2Plugin* lv2_load_from_state(Plugin* plugin)

Loads an LV2 plugin from its state file.

Parameters
plugin A newly created plugin.

Used when loading project files.

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_new(Plugin* plugin)

Creates a new LV2 plugin using the given Plugin instance.

The given plugin instance must be a newly allocated one.

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.

Searches for a port marked as reportsLatency and gets it value when a 0-size buffer is passed.

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.