Struct PluginInstance

Source
#[repr(C)]
pub struct PluginInstance<T: Plugin> { /* private fields */ }
Expand description

Plugin wrapper which translated between the host and the plugin.

The host interacts with the plugin via a C API, but the plugin is implemented with ideomatic, safe Rust. To bridge this gap, this wrapper is used to translate and abstract the communcation between the host and the plugin.

This struct is repr(C) and has the plugin as it’s first field. Therefore, a valid *mut PluginInstance<T> is also a valid *mut T.

Implementations§

Source§

impl<T: Plugin> PluginInstance<T>

Source

pub unsafe fn ports(&self, sample_count: u32) -> Option<T::Ports>

Try to create a port collection from the currently collected connections.

§Safety

This method is unsafe since it needs to dereference raw pointers, which are only valid if the method is called in the “Audio” threading class.

Source

pub unsafe extern "C" fn instantiate( descriptor: *const LV2_Descriptor, sample_rate: f64, bundle_path: *const c_char, features: *const *const LV2_Feature, ) -> LV2_Handle

Instantiate the plugin.

This method provides a required method for the C interface of a plugin and is used by the lv2_descriptors macro.

§Safety

This method is unsafe since it derefences multiple raw pointers and is part of the C interface.

Source

pub unsafe extern "C" fn cleanup(instance: *mut c_void)

Clean the plugin.

This method provides a required method for the C interface of a plugin and is used by the lv2_descriptors macro.

§Safety

This method is unsafe since it derefences multiple raw pointers and is part of the C interface.

Source

pub unsafe extern "C" fn activate(instance: *mut c_void)

Call activate.

This method provides a required method for the C interface of a plugin and is used by the lv2_descriptors macro.

§Safety

This method is unsafe since it derefences multiple raw pointers and is part of the C interface.

Source

pub unsafe extern "C" fn deactivate(instance: *mut c_void)

Call deactivate.

This method provides a required method for the C interface of a plugin and is used by the lv2_descriptors macro.

§Safety

This method is unsafe since it derefences multiple raw pointers and is part of the C interface.

Source

pub unsafe extern "C" fn connect_port( instance: *mut c_void, port: u32, data: *mut c_void, )

Update a port pointer.

This method provides a required method for the C interface of a plugin and is used by the lv2_descriptors macro.

§Safety

This method is unsafe since it derefences multiple raw pointers and is part of the C interface.

Source

pub unsafe extern "C" fn run(instance: *mut c_void, sample_count: u32)

Construct a port collection and call the run method.

This method provides a required method for the C interface of a plugin and is used by the lv2_descriptors macro.

§Safety

This method is unsafe since it derefences multiple raw pointers and is part of the C interface.

Source

pub unsafe extern "C" fn extension_data( uri: *const c_char, ) -> *const c_void

Dereference the URI, call the extension_data function and return the pointer.

This method provides a required method for the C interface of a plugin and is used by the lv2_descriptors macro.

§Safety

This method is unsafe since it derefences multiple raw pointers and is part of the C interface.

Source

pub fn plugin_handle(&mut self) -> &mut T

Retrieve the internal plugin.

Source

pub fn init_class_handle(&mut self) -> (&mut T, &mut T::InitFeatures)

Retrieve the required handles to execute an Initialization class method.

This method can be used by extensions to call an extension method in the Initialization threading class and provide it the host features for that class.

Source

pub fn audio_class_handle(&mut self) -> (&mut T, &mut T::AudioFeatures)

Retrieve the required handles to execute an Audio class method.

This method can be used by extensions to call an extension method in the Audio threading class and provide it the host features for that class.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.