Skip to main content

PluginLogicCore

Trait PluginLogicCore 

Source
pub trait PluginLogicCore<S = f32>: 'static
where S: Sample,
{ type Params: Params; type DspState: Send + 'static; const PRESERVE_DSP_STATE: bool = true; // Required methods fn init(params: &Self::Params, cx: &InitContext) -> Self::DspState; fn reset( state: &mut Self::DspState, params: &Self::Params, config: &AudioConfig, ); fn process( state: &mut Self::DspState, params: &Self::Params, buffer: &mut AudioBuffer<'_, S>, events: &EventList, context: &mut ProcessContext<'_>, ) -> ProcessStatus; // Provided methods fn supports_in_place() -> bool { ... } fn bus_layouts() -> Vec<BusLayout> { ... } fn save_state(state: &Self::DspState) -> Vec<u8> ⓘ { ... } fn snapshot_into(state: &Self::DspState, buf: &mut Vec<u8>) -> bool { ... } fn load_state( state: &mut Self::DspState, data: &[u8], ) -> Result<(), StateLoadError> { ... } fn migrate_state(foreign: &ForeignState<'_>) -> Option<MigratedState> { ... } fn state_changed(state: &mut Self::DspState, params: &Self::Params) { ... } fn latency(state: &Self::DspState) -> u32 { ... } fn tail(state: &Self::DspState) -> u32 { ... } }
Expand description

Wrapper-facing plugin trait, generic over the audio sample type.

Format wrappers (StaticShell, HotShell, CLAP / VST3 / etc.) bind on PluginLogicCore<S>. Plugin authors don’t implement this directly - they implement PluginLogic (f32) or PluginLogic64 (f64), and the blanket impls below route them into PluginLogicCore.

Method docs live on the leaf traits (PluginLogic / PluginLogic64); the shape mirrors them exactly.

Provided Associated Constants§

Source

const PRESERVE_DSP_STATE: bool = true

Whether the hot-reload shell may preserve live DSP state across a code-only reload. Default true (best-effort layout probe). Override to false on a state that must always re-init on reload.

Required Associated Types§

Source

type Params: Params

The plugin’s parameter struct; mirrors the leaf’s Params.

Source

type DspState: Send + 'static

The mutable per-block audio state. Owned by the shell, not by Self (the descriptor). Send because the shell moves it across threads; 'static because the shell may outlive any borrow. No layout trait is required: the hot-reload shell fingerprints the type at load time from its type_name / size_of / align_of.

Required Methods§

Source

fn init(params: &Self::Params, cx: &InitContext) -> Self::DspState

Build initial state from params. See PluginLogic::init.

Source

fn reset( state: &mut Self::DspState, params: &Self::Params, config: &AudioConfig, )

Source

fn process( state: &mut Self::DspState, params: &Self::Params, buffer: &mut AudioBuffer<'_, S>, events: &EventList, context: &mut ProcessContext<'_>, ) -> ProcessStatus

Provided Methods§

Source

fn supports_in_place() -> bool

Source

fn bus_layouts() -> Vec<BusLayout>

Source

fn save_state(state: &Self::DspState) -> Vec<u8> ⓘ

Source

fn snapshot_into(state: &Self::DspState, buf: &mut Vec<u8>) -> bool

Lock-free state-save opt-in. See PluginLogic::snapshot_into.

Source

fn load_state( state: &mut Self::DspState, data: &[u8], ) -> Result<(), StateLoadError>

Restore plugin-specific state. See PluginLogic::load_state.

§Errors

Forwards whatever the user impl returns - typically a malformed blob error decoded by bincode / serde / similar.

Source

fn migrate_state(foreign: &ForeignState<'_>) -> Option<MigratedState>

Translate foreign state into truce shape. See PluginLogic::migrate_state.

Source

fn state_changed(state: &mut Self::DspState, params: &Self::Params)

Source

fn latency(state: &Self::DspState) -> u32

Source

fn tail(state: &Self::DspState) -> u32

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> PluginLogicCore for T
where T: PluginLogic,

Source§

const PRESERVE_DSP_STATE: bool = <T as PluginLogic>::PRESERVE_DSP_STATE

Source§

type Params = <T as PluginLogic>::Params

Source§

type DspState = <T as PluginLogic>::DspState

Source§

impl<T> PluginLogicCore<f64> for T
where T: PluginLogic64,

Source§

const PRESERVE_DSP_STATE: bool = <T as PluginLogic64>::PRESERVE_DSP_STATE

Source§

type Params = <T as PluginLogic64>::Params

Source§

type DspState = <T as PluginLogic64>::DspState