pub trait PluginLogicCore<S: Sample = f32>: Send + 'static {
// Required methods
fn supports_in_place() -> bool
where Self: Sized;
fn bus_layouts() -> Vec<BusLayout>
where Self: Sized;
fn reset(&mut self, sample_rate: f64, max_block_size: usize);
fn process(
&mut self,
buffer: &mut AudioBuffer<'_, S>,
events: &EventList,
context: &mut ProcessContext<'_>,
) -> ProcessStatus;
fn save_state(&self) -> Vec<u8> ⓘ;
fn load_state(&mut self, data: &[u8]) -> Result<(), StateLoadError>;
fn migrate_state(foreign: &ForeignState<'_>) -> Option<MigratedState>
where Self: Sized;
fn state_changed(&mut self);
fn latency(&self) -> u32;
fn tail(&self) -> u32;
// Provided method
fn snapshot_into(&self, buf: &mut Vec<u8>) -> bool { ... }
}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.
Required Methods§
fn supports_in_place() -> boolwhere
Self: Sized,
fn bus_layouts() -> Vec<BusLayout>where
Self: Sized,
fn reset(&mut self, sample_rate: f64, max_block_size: usize)
fn process( &mut self, buffer: &mut AudioBuffer<'_, S>, events: &EventList, context: &mut ProcessContext<'_>, ) -> ProcessStatus
fn save_state(&self) -> Vec<u8> ⓘ
Sourcefn load_state(&mut self, data: &[u8]) -> Result<(), StateLoadError>
fn load_state(&mut self, 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>where
Self: Sized,
fn migrate_state(foreign: &ForeignState<'_>) -> Option<MigratedState>where
Self: Sized,
Translate foreign state into truce shape. See
PluginLogic::migrate_state.
fn state_changed(&mut self)
fn latency(&self) -> u32
fn tail(&self) -> u32
Provided Methods§
Sourcefn snapshot_into(&self, buf: &mut Vec<u8>) -> bool
fn snapshot_into(&self, buf: &mut Vec<u8>) -> bool
Lock-free state-save opt-in. See PluginLogic::snapshot_into.
Called on the audio thread each block when supported; the shell
publishes the result into a SnapshotSlot the host reads without
the plugin lock. Default false; the leaf bridge overrides it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".