Struct lilv::instance::Instance

source ·
pub struct Instance { /* private fields */ }
Expand description

An LV2 plugin instance.

Implementations§

source§

impl Instance

source

pub fn uri(&self) -> Option<&str>

Returns the URI of the plugin for the instance. This is a globally unique string for the plugin.

source

pub unsafe fn connect_port_mut<T>(&mut self, port_index: usize, data: *mut T)

Connect a port on a plugin instance to a memory location.

Plugin writers should be aware that the host may elect to use the same buffer for more than one port and even use the same buffer for both input and output (see lv2:inPlaceBroken in lv2.ttl).

If the plugin has the feature lv2:hardRTCapable then there are various things that the plugin MUST NOT do within the connect_port() function; see lv2core.ttl for details.

connect_port() MUST be called at least once for each port before run() is called, unless that port is lv2:connectionOptional. The plugin must pay careful attention to the block size passed to run() since the block allocated may only just be large enough to contain the data, and is not guaranteed to remain constant between run() calls.

connect_port() may be called more than once for a plugin instance to allow the host to change the buffers that the plugin is reading or writing.

The host MUST NOT try to connect a port_index that is not defined in the plugin’s RDF data. If it does, the plugin’s behaviour is undefined (a crash is likely).

data should point to data of the type defined by the port type in the plugin’s RDF data (e.g. an array of float for an lv2:AudioPort). This pointer must be stored by the plugin instance and used to read/write data when run() is called. Data present at the time of the connect_port() call MUST NOT be considered meaningful.

Safety

Connecting a port calls a plugin’s code, which itself may be unsafe.

source

pub unsafe fn connect_port<T>(&mut self, port_index: usize, data: *const T)

Connect data pointer to a port on a plugin instance. Similar to connect_port_mut but takes a const pointer instead.

Note

Although this takes a const pointer, it is not guaranteed that the plugin wants to treat the data as const. This method exists for convinience, but developers should still make sure double check that the port is an input and not an output port.

Safety

Connecting a port calls a plugin’s code, which itself may be unsafe.

source

pub unsafe fn activate(self) -> ActiveInstance

Activate a plugin instance.

This resets all state information in the plugin except for port connections.

Safety

Calling external code may be unsafe.

source

pub unsafe fn extension_data<T>(&self, uri: &str) -> Option<NonNull<T>>

Get the extension data for a 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.

Safety

Gathering extension data call’s a plugins code, which itself may be unsafe.

source

pub fn descriptor(&self) -> Option<&LV2Descriptor>

Get the raw descriptor for the plugin.

source

pub fn handle(&self) -> LV2Handle

Get the raw handle for the plugin instance.

Trait Implementations§

source§

impl Drop for Instance

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for Instance

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.