diff options
Diffstat (limited to 'slv2/plugininstance.h')
-rw-r--r-- | slv2/plugininstance.h | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/slv2/plugininstance.h b/slv2/plugininstance.h index 1b475c2..e704383 100644 --- a/slv2/plugininstance.h +++ b/slv2/plugininstance.h @@ -26,12 +26,17 @@ extern "C" { #include <assert.h> #include <dlfcn.h> #include <slv2/lv2.h> -#include <slv2/private_types.h> #include <slv2/plugin.h> #include <slv2/port.h> +typedef struct _InstanceImpl* SLV2InstanceImpl; -typedef const struct _Instance SLV2Instance; +/** Instance of a plugin */ +typedef struct _Instance { + const LV2_Descriptor* lv2_descriptor; + LV2_Handle lv2_handle; + SLV2InstanceImpl pimpl; ///< Opaque +} SLV2Instance; /** \defgroup lib Plugin Instance - Shared library access @@ -47,7 +52,7 @@ typedef const struct _Instance SLV2Instance; /** Instantiate a plugin. * * The returned object represents shared library objects loaded into memory, - * it must be cleaned up with slv2instance_free when no longer + * it must be cleaned up with slv2_instance_free when no longer * needed. * * \a plugin is not modified or directly referenced by the returned object @@ -84,9 +89,9 @@ static inline const char* slv2_instance_get_uri(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); - return instance->descriptor->URI; + return instance->lv2_descriptor->URI; } @@ -101,10 +106,10 @@ slv2_instance_connect_port(SLV2Instance* instance, void* data_location) { assert(instance); - assert(instance->descriptor); - assert(instance->descriptor->connect_port); + assert(instance->lv2_descriptor); + assert(instance->lv2_descriptor->connect_port); - instance->descriptor->connect_port + instance->lv2_descriptor->connect_port (instance->lv2_handle, port_index, data_location); } @@ -112,23 +117,23 @@ slv2_instance_connect_port(SLV2Instance* instance, /** Activate a plugin instance. * * This resets all state information in the plugin, except for port data - * locations (as set by slv2instance_connect_port). This MUST be called - * before calling slv2instance_run. + * locations (as set by slv2_instance_connect_port). This MUST be called + * before calling slv2_instance_run. */ static inline void slv2_instance_activate(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); - if (instance->descriptor->activate) - instance->descriptor->activate(instance->lv2_handle); + if (instance->lv2_descriptor->activate) + instance->lv2_descriptor->activate(instance->lv2_handle); } -/** Run \a instance for \a sample_count frames. +/** Run @a instance for @a sample_count frames. * - * If the hint lv2:realtimeSafe is set for this plugin, this function is + * If the hint lv2:hardRtCapable is set for this plugin, this function is * guaranteed not to block. */ static inline void @@ -136,11 +141,11 @@ slv2_instance_run(SLV2Instance* instance, uint32_t sample_count) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); assert(instance->lv2_handle), - assert(instance->descriptor->run); + assert(instance->lv2_descriptor->run); - instance->descriptor->run(instance->lv2_handle, sample_count); + instance->lv2_descriptor->run(instance->lv2_handle, sample_count); } @@ -153,18 +158,18 @@ static inline void slv2_instance_deactivate(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); assert(instance->lv2_handle); - if (instance->descriptor->deactivate) - instance->descriptor->deactivate(instance->lv2_handle); + if (instance->lv2_descriptor->deactivate) + instance->lv2_descriptor->deactivate(instance->lv2_handle); } /** Get the LV2_Descriptor of the plugin instance. * * Normally hosts should not need to access the LV2_Descriptor directly, - * use the slv2instance_* functions. + * use the slv2_instance_* functions. * * The returned descriptor is shared and must not be deleted. */ @@ -172,16 +177,16 @@ static inline const LV2_Descriptor* slv2_instance_get_descriptor(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); - return instance->descriptor; + return instance->lv2_descriptor; } /** Get the LV2_Handle of the plugin instance. * * Normally hosts should not need to access the LV2_Handle directly, - * use the slv2instance_* functions. + * use the slv2_instance_* functions. * * The returned handle is shared and must not be deleted. */ @@ -189,7 +194,7 @@ static inline LV2_Handle slv2_instance_get_handle(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); return instance->lv2_handle; } |