Skip to main content

PluginParamLoader

Struct PluginParamLoader 

Source
pub struct PluginParamLoader { /* private fields */ }
Expand description

Plugin loader that extracts parameter metadata and the dev audio processor vtable via FFI.

§Safety

This struct manages the lifecycle of a dynamically loaded library. The library must remain loaded while any data from it is in use. The PluginParamLoader ensures proper cleanup via Drop.

§Drop Ordering

Struct fields are dropped in declaration order (first declared = first dropped). _library is the last field so it is dropped last, ensuring the dynamic library remains loaded while parameters and dev_processor_vtable are cleaned up.

External invariant: any FfiProcessor created from the vtable must be dropped before this loader to keep vtable function pointers valid. The caller must ensure this via local variable declaration order (later declared = first dropped).

Implementations§

Source§

impl PluginParamLoader

Source

pub fn load_params_from_file<P: AsRef<Path>>( json_path: P, ) -> Result<Vec<ParameterInfo>, PluginLoaderError>

Load parameters from a sidecar JSON file (bypasses FFI/dlopen).

Used by wavecraft start to read cached parameter metadata without loading the plugin dylib (which triggers nih-plug static initializers).

Source

pub fn load<P: AsRef<Path>>(dylib_path: P) -> Result<Self, PluginLoaderError>

Load a plugin from the given path and extract its parameter metadata.

Source

pub fn load_params_only<P: AsRef<Path>>( dylib_path: P, ) -> Result<Vec<ParameterInfo>, PluginLoaderError>

Load parameters only (skip processor vtable loading).

Used by hot-reload where only parameter metadata is needed. Avoids potential side effects from vtable construction.

Source

pub fn parameters(&self) -> &[ParameterInfo]

Get the loaded parameter information.

Source

pub fn get_parameter(&self, id: &str) -> Option<&ParameterInfo>

Get a parameter by ID.

Source

pub fn dev_processor_vtable(&self) -> &DevProcessorVTable

Returns the validated dev processor vtable.

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.