Skip to main content

PluginInstance

Trait PluginInstance 

Source
pub trait PluginInstance: Send {
    // Required methods
    fn descriptor(&self) -> &PluginDescriptor;
    fn prepare(&mut self, cfg: PrepareConfig);
    fn reset(&mut self);
    fn process(&mut self, block: &mut ProcessBlock<'_>);

    // Provided methods
    fn state(&self) -> PluginState { ... }
    fn set_state(&mut self, _state: PluginState) { ... }
    fn latency_frames(&self) -> u32 { ... }
}
Expand description

A live, format-agnostic plugin instance the host can prepare and run.

Implementors are the format-specific backends (vst3/clap/lv2 and the native sim format). The trait pairs a static PluginDescriptor with the mutable, real-time processing entry points shared by every backend and is Send so instances can move between threads.

Required Methods§

Source

fn descriptor(&self) -> &PluginDescriptor

Returns the descriptor that identifies this instance and its port and parameter layout.

Source

fn prepare(&mut self, cfg: PrepareConfig)

Prepares the instance for processing under the given configuration.

Source

fn reset(&mut self)

Clears any internal processing state without releasing resources.

Source

fn process(&mut self, block: &mut ProcessBlock<'_>)

Processes one audio block in place.

Provided Methods§

Source

fn state(&self) -> PluginState

Captures the instance’s current persistable state.

The default returns an empty PluginState; backends that carry parameter or opaque data override this.

Source

fn set_state(&mut self, _state: PluginState)

Restores the instance from a previously captured PluginState.

The default ignores the state; stateful backends override this.

Source

fn latency_frames(&self) -> u32

Returns the instance’s reported latency in frames.

The default reports the descriptor’s PluginDescriptor::latency_frames.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§