---
name: "slv2_library"
section: "3"
platform: "linux"
package: "slv2-doc"
version: "0.6.6+dfsg1-2"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/slv2_library"
---

# slv2\_library(3)

An SLV2Instance is an instantiated SLV2Plugin (ie a loaded dynamic library).

## NAME

Plugin\_library\_access - An SLV2Instance is an instantiated SLV2Plugin (ie a loaded dynamic library).

### Functions

SLV2Instance **slv2\_plugin\_instantiate** (SLV2Plugin plugin, double sample\_rate, const LV2\_Feature \*const \*features)\
 void **slv2\_instance\_free** (SLV2Instance instance)\
 static const char \* **slv2\_instance\_get\_uri** (SLV2Instance instance)\
 static void **slv2\_instance\_connect\_port** (SLV2Instance instance, uint32\_t port\_index, void \*data\_location)\
 static void **slv2\_instance\_activate** (SLV2Instance instance)\
 static void **slv2\_instance\_run** (SLV2Instance instance, uint32\_t sample\_count)\
 static void **slv2\_instance\_deactivate** (SLV2Instance instance)\
 static const void \* **slv2\_instance\_get\_extension\_data** (SLV2Instance instance, const char \*uri)\
 static const LV2\_Descriptor \* **slv2\_instance\_get\_descriptor** (SLV2Instance instance)\
 static LV2\_Handle **slv2\_instance\_get\_handle** (SLV2Instance instance)\
 SLV2UIInstance **slv2\_ui\_instantiate** (SLV2Plugin plugin, SLV2UI ui, LV2UI\_Write\_Function write\_function, LV2UI\_Controller controller, const LV2\_Feature \*const \*features)\
 void **slv2\_ui\_instance\_free** (SLV2UIInstance instance)\
 const LV2UI\_Descriptor \* **slv2\_ui\_instance\_get\_descriptor** (SLV2UIInstance instance)\
 LV2UI\_Handle **slv2\_ui\_instance\_get\_handle** (SLV2UIInstance instance)\

## Detailed Description

These functions interact with the binary library code only, they do not read data files in any way.

## Function Documentation

### SLV2Instance slv2\_plugin\_instantiate (SLV2Plugin plugin, double sample\_rate, const LV2\_Feature \*const \* features)

Instantiate a plugin.

The returned object represents shared library objects loaded into memory, it must be cleaned up with slv2\_instance\_free when no longer needed.

*plugin* is not modified or directly referenced by the returned object (instances store only a copy of the plugin's URI).

*host\_features* NULL-terminated array of features the host supports. NULL may be passed if the host supports no additional features (unlike the LV2 specification - SLV2 takes care of it).

**Returns:**

NULL if instantiation failed.

### void slv2\_instance\_free (SLV2Instance instance)

Free a plugin instance.

*instance* is invalid after this call.

### static const char\* slv2\_instance\_get\_uri (SLV2Instance instance)` [inline, static]`

Get the URI of the plugin which *instance* is an instance of.

Returned string is shared and must not be modified or deleted.

### static void slv2\_instance\_connect\_port (SLV2Instance instance, uint32\_t port\_index, void \* data\_location)` [inline, static]`

Connect a port to a data location.

This may be called regardless of whether the plugin is activated, activation and deactivation does not destroy port connections.

### static void slv2\_instance\_activate (SLV2Instance instance)` [inline, static]`

Activate a plugin instance.

This resets all state information in the plugin, except for port data locations (as set by slv2\_instance\_connect\_port). This MUST be called before calling slv2\_instance\_run.

### static void slv2\_instance\_run (SLV2Instance instance, uint32\_t sample\_count)` [inline, static]`

Run *instance* for *sample\_count* frames.

If the hint lv2:hardRtCapable is set for this plugin, this function is guaranteed not to block.

### static void slv2\_instance\_deactivate (SLV2Instance instance)` [inline, static]`

Deactivate a plugin instance.

Note that to run the plugin after this you must activate it, which will reset all state information (except port connections).

### static const void\* slv2\_instance\_get\_extension\_data (SLV2Instance instance, const char \* uri)` [inline, static]`

Get extension data from the plugin instance.

The type and semantics of the data returned is specific to the particular extension, though in all cases it is shared and must not be deleted.

### static const LV2\_Descriptor\* slv2\_instance\_get\_descriptor (SLV2Instance instance)` [inline, static]`

Get the LV2\_Descriptor of the plugin instance.

Normally hosts should not need to access the LV2\_Descriptor directly, use the slv2\_instance\_\* functions.

The returned descriptor is shared and must not be deleted.

### static LV2\_Handle slv2\_instance\_get\_handle (SLV2Instance instance)` [inline, static]`

Get the LV2\_Handle of the plugin instance.

Normally hosts should not need to access the LV2\_Handle directly, use the slv2\_instance\_\* functions.

The returned handle is shared and must not be deleted.

### SLV2UIInstance slv2\_ui\_instantiate (SLV2Plugin plugin, SLV2UI ui, LV2UI\_Write\_Function write\_function, LV2UI\_Controller controller, const LV2\_Feature \*const \* features)

Instantiate a plugin UI.

The returned object represents shared library objects loaded into memory, it must be cleaned up with slv2\_ui\_instance\_free when no longer needed.

*plugin* is not modified or directly referenced by the returned object (instances store only a copy of the plugin's URI).

*host\_features* NULL-terminated array of features the host supports. NULL may be passed if the host supports no additional features (unlike the LV2 specification - SLV2 takes care of it).

**Returns:**

NULL if instantiation failed.

### void slv2\_ui\_instance\_free (SLV2UIInstance instance)

Free a plugin UI instance.

It is the caller's responsibility to ensure all references to the UI instance (including any returned widgets) are cut before calling this function.

*instance* is invalid after this call.

### LV2UI\_Widget slv2\_ui\_instance\_get\_widget (SLV2UIInstance instance)

Get the widget for the UI instance.

### const LV2UI\_Descriptor\* slv2\_ui\_instance\_get\_descriptor (SLV2UIInstance instance)

Get the LV2UI\_Descriptor of the plugin UI instance.

Normally hosts should not need to access the LV2UI\_Descriptor directly, use the slv2\_ui\_instance\_\* functions.

The returned descriptor is shared and must not be deleted.

### LV2UI\_Handle slv2\_ui\_instance\_get\_handle (SLV2UIInstance instance)

Get the LV2UI\_Handle of the plugin UI instance.

Normally hosts should not need to access the LV2UI\_Handle directly, use the slv2\_ui\_instance\_\* functions.

The returned handle is shared and must not be deleted.

## Author

Generated automatically by Doxygen for SLV2 from the source code.
