pub struct Instance { /* private fields */ }Expand description
An LV2 plugin instance.
Implementations§
source§impl Instance
impl Instance
sourcepub fn uri(&self) -> Option<&str>
pub fn uri(&self) -> Option<&str>
Returns the URI of the plugin for the instance. This is a globally unique string for the plugin.
sourcepub unsafe fn connect_port_mut<T>(&mut self, port_index: usize, data: *mut T)
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.
sourcepub unsafe fn connect_port<T>(&mut self, port_index: usize, data: *const T)
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.
sourcepub unsafe fn activate(self) -> ActiveInstance
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.
sourcepub unsafe fn extension_data<T>(&self, uri: &str) -> Option<NonNull<T>>
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.
sourcepub fn descriptor(&self) -> Option<&LV2Descriptor>
pub fn descriptor(&self) -> Option<&LV2Descriptor>
Get the raw descriptor for the plugin.