LV2 module
LV2 plugin related code.
Classes
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_to_file(Lv2Plugin* pl, bool is_backup) -> LilvState*
- Saves the plugin state to the filesystem and returns the state.
- auto lv2_state_save_to_memory(Lv2Plugin* plugin) -> LilvState*
- Saves the plugin state into a new LilvState that can be applied to any plugin with the same URI (like clones).
- auto lv2_state_save_to_string(Lv2Plugin* pl, bool is_backup) -> LilvState*
- Saves the plugin state to a string after writing the required files.
- auto lv2_state_make_path_save(LV2_State_Make_Path_Handle handle, const char* path) -> char*
- LV2 State makePath feature for save only.
- auto lv2_state_make_path_temp(LV2_State_Make_Path_Handle handle, const char* path) -> char*
- LV2 State makePath feature for temporary files.
- 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* self, bool project, bool use_state_file, char* preset_uri, LilvState* state) -> 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_has_deprecated_ui(const char* uri) -> char*
- Returns whether the plugin has a custom UI that is deprecated (GtkUI, QtUI, etc.).
- 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_get_port_value(const char* port_sym, void* user_data, uint32_t* size, uint32_t* type) -> const void*
- Function to get a port value.
- 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
#include <plugins/lv2_plugin.h>
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 Lv2Plugin Lv2Plugin
#include <plugins/lv2_plugin.h>
LV2 plugin.
typedef enum Lv2PluginPickUiFlag Lv2PluginPickUiFlag
#include <plugins/lv2_plugin.h>
In order of preference.
typedef struct Lv2Plugin Lv2Plugin
#include <plugins/lv2/lv2_control.h>
LV2 plugin.
Function documentation
void lv2_log_set_printf_funcs(LV2_Log_Log* log)
#include <plugins/lv2/lv2_log.h>
Needed because we can't set them directly when gi18n.h is included.
LilvState* lv2_state_save_to_file(Lv2Plugin* pl,
bool is_backup)
#include <plugins/lv2/lv2_state.h>
Saves the plugin state to the filesystem and returns the state.
LilvState* lv2_state_save_to_memory(Lv2Plugin* plugin)
#include <plugins/lv2/lv2_state.h>
Saves the plugin state into a new LilvState that can be applied to any plugin with the same URI (like clones).
Must be free'd with lilv_state_free().
LilvState* lv2_state_save_to_string(Lv2Plugin* pl,
bool is_backup)
#include <plugins/lv2/lv2_state.h>
Saves the plugin state to a string after writing the required files.
char* lv2_state_make_path_save(LV2_State_Make_Path_Handle handle,
const char* path)
#include <plugins/lv2/lv2_state.h>
LV2 State makePath feature for save only.
Should be passed to LV2_State_Interface::save(). and this function must return an absolute path.
char* lv2_state_make_path_temp(LV2_State_Make_Path_Handle handle,
const char* path)
#include <plugins/lv2/lv2_state.h>
LV2 State makePath feature for temporary files.
Should be passed to LV2_Descriptor::instantiate() and this function must return an absolute path.
int lv2_state_save_preset(Lv2Plugin* plugin,
const char* dir,
const char* uri,
const char* label,
const char* filename)
#include <plugins/lv2/lv2_state.h>
Saves the preset.
int lv2_state_delete_current_preset(Lv2Plugin* plugin)
#include <plugins/lv2/lv2_state.h>
Deletes the current preset.
int lv2_ui_is_resizable(Lv2Plugin* plugin)
#include <plugins/lv2/lv2_ui.h>
Returns if the UI of the plugin is resizable.
void lv2_ui_init(Lv2Plugin* plugin)
#include <plugins/lv2/lv2_ui.h>
Inits the LV2 plugin UI.
void lv2_ui_instantiate(Lv2Plugin* plugin,
const char* native_ui_type,
void* parent)
#include <plugins/lv2/lv2_ui.h>
Instantiates the plugin UI.
void lv2_ui_read_and_apply_events(Lv2Plugin* plugin,
uint32_t nframes)
#include <plugins/lv2/lv2_ui.h>
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)
#include <plugins/lv2/lv2_ui.h>
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)
#include <plugins/lv2/lv2_ui.h>
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)
#include <plugins/lv2/lv2_ui.h>
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)
#include <plugins/lv2_plugin.h>
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)
#include <plugins/lv2_plugin.h>
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* self,
bool project,
bool use_state_file,
char* preset_uri,
LilvState* state)
#include <plugins/lv2_plugin.h>
Instantiate the plugin.
Parameters | |
---|---|
self | Plugin to instantiate. |
project | |
use_state_file | Whether to use the plugin's state file to instantiate the plugin. |
preset_uri | URI of preset to load. |
state | State to load, if loading from a state. This is used when cloning plugins for example. The state of the original plugin is passed here. |
Returns | 0 if OK, non-zero if error. |
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)
#include <plugins/lv2_plugin.h>
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)
#include <plugins/lv2_plugin.h>
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)
#include <plugins/lv2_plugin.h>
Returns the plugin's latency in samples.
This will be 0 if the plugin does not report latency.
char* lv2_plugin_has_deprecated_ui(const char* uri)
#include <plugins/lv2_plugin.h>
Returns whether the plugin has a custom UI that is deprecated (GtkUI, QtUI, etc.).
Returns | If the plugin has a deprecated UI, returns the UI URI, otherwise NULL. |
---|
bool lv2_plugin_pick_ui(const LilvUIs* uis,
Lv2PluginPickUiFlag flag,
const LilvUI** out_ui,
const LilvNode** out_ui_type)
#include <plugins/lv2_plugin.h>
Pick the most preferable UI.
Returns | Whether a UI was picked. |
---|
const void* lv2_plugin_get_port_value(const char* port_sym,
void* user_data,
uint32_t* size,
uint32_t* type)
#include <plugins/lv2_plugin.h>
Function to get a port value.
Used when saving the state. This function MUST set size and type appropriately.
void lv2_plugin_update_port_identifiers(Lv2Plugin* self)
#include <plugins/lv2_plugin.h>
Updates theh PortIdentifier's in the Lv2Plugin.
void lv2_plugin_allocate_port_buffers(Lv2Plugin* plugin)
#include <plugins/lv2_plugin.h>
Allocate port buffers (only necessary for MIDI).
void lv2_plugin_populate_banks(Lv2Plugin* self)
#include <plugins/lv2_plugin.h>
Populates the banks in the plugin instance.
void lv2_plugin_free(Lv2Plugin* plugin)
#include <plugins/lv2_plugin.h>
Frees the Lv2Plugin and all its components.