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
impl PluginParamLoader
Sourcepub fn load_params_from_file<P: AsRef<Path>>(
json_path: P,
) -> Result<Vec<ParameterInfo>, PluginLoaderError>
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).
Sourcepub fn load<P: AsRef<Path>>(dylib_path: P) -> Result<Self, PluginLoaderError>
pub fn load<P: AsRef<Path>>(dylib_path: P) -> Result<Self, PluginLoaderError>
Load a plugin from the given path and extract its parameter metadata.
Sourcepub fn load_params_only<P: AsRef<Path>>(
dylib_path: P,
) -> Result<Vec<ParameterInfo>, PluginLoaderError>
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.
Sourcepub fn parameters(&self) -> &[ParameterInfo]
pub fn parameters(&self) -> &[ParameterInfo]
Get the loaded parameter information.
Sourcepub fn get_parameter(&self, id: &str) -> Option<&ParameterInfo>
pub fn get_parameter(&self, id: &str) -> Option<&ParameterInfo>
Get a parameter by ID.
Sourcepub fn dev_processor_vtable(&self) -> &DevProcessorVTable
pub fn dev_processor_vtable(&self) -> &DevProcessorVTable
Returns the validated dev processor vtable.