#[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>
impl<T: Plugin> PluginInstance<T>
Sourcepub unsafe fn ports(&self, sample_count: u32) -> Option<T::Ports>
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.
Sourcepub unsafe extern "C" fn instantiate(
descriptor: *const LV2_Descriptor,
sample_rate: f64,
bundle_path: *const c_char,
features: *const *const LV2_Feature,
) -> LV2_Handle
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.
Sourcepub unsafe extern "C" fn cleanup(instance: *mut c_void)
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.
Sourcepub unsafe extern "C" fn activate(instance: *mut c_void)
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.
Sourcepub unsafe extern "C" fn deactivate(instance: *mut c_void)
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.
Sourcepub unsafe extern "C" fn connect_port(
instance: *mut c_void,
port: u32,
data: *mut c_void,
)
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.
Sourcepub unsafe extern "C" fn run(instance: *mut c_void, sample_count: u32)
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.
Sourcepub unsafe extern "C" fn extension_data(
uri: *const c_char,
) -> *const c_void
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.
Sourcepub fn plugin_handle(&mut self) -> &mut T
pub fn plugin_handle(&mut self) -> &mut T
Retrieve the internal plugin.
Sourcepub fn init_class_handle(&mut self) -> (&mut T, &mut T::InitFeatures)
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.
Sourcepub fn audio_class_handle(&mut self) -> (&mut T, &mut T::AudioFeatures)
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.