pub trait PluginLogicCore<S: Sample = f32>: 'static {
type Params: Params;
type DspState: Send + 'static;
const PRESERVE_DSP_STATE: bool = true;
Show 14 methods
// 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 snapshot_version(state: &Self::DspState) -> Option<u64> { ... }
fn snapshot_prealloc_hint() -> usize { ... }
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§
Sourceconst PRESERVE_DSP_STATE: bool = true
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§
Sourcetype DspState: Send + 'static
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§
Sourcefn init(params: &Self::Params, cx: &InitContext) -> Self::DspState
fn init(params: &Self::Params, cx: &InitContext) -> Self::DspState
Build initial state from params. See PluginLogic::init.
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
Sourcefn bus_layouts() -> Vec<BusLayout>
fn bus_layouts() -> Vec<BusLayout>
Supported audio bus configurations. The host picks one. Default: the standard audio effect - stereo and mono - so it appears on both track widths. Override for instruments, surround, sidechains.
fn save_state(state: &Self::DspState) -> Vec<u8> ⓘ
Sourcefn snapshot_into(state: &Self::DspState, buf: &mut Vec<u8>) -> bool
fn snapshot_into(state: &Self::DspState, buf: &mut Vec<u8>) -> bool
Lock-free state-save opt-in. See PluginLogic::snapshot_into.
Sourcefn snapshot_version(state: &Self::DspState) -> Option<u64>
fn snapshot_version(state: &Self::DspState) -> Option<u64>
Snapshot generation token. See PluginLogic::snapshot_version.
Sourcefn snapshot_prealloc_hint() -> usize
fn snapshot_prealloc_hint() -> usize
Inline snapshot buffer pre-warm hint. See
PluginLogic::snapshot_prealloc_hint.
Sourcefn load_state(
state: &mut Self::DspState,
data: &[u8],
) -> Result<(), StateLoadError>
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.
Sourcefn migrate_state(foreign: &ForeignState<'_>) -> Option<MigratedState>
fn migrate_state(foreign: &ForeignState<'_>) -> Option<MigratedState>
Translate foreign state into truce shape. See
PluginLogic::migrate_state.
fn state_changed(state: &mut Self::DspState, params: &Self::Params)
fn latency(state: &Self::DspState) -> u32
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".