#[repr(C)]pub struct DevProcessorVTable {
pub version: u32,
pub create: extern "C" fn() -> *mut c_void,
pub process: extern "C" fn(instance: *mut c_void, channels: *mut *mut f32, num_channels: u32, num_samples: u32),
pub set_sample_rate: extern "C" fn(instance: *mut c_void, sample_rate: f32),
pub reset: extern "C" fn(instance: *mut c_void),
pub drop: extern "C" fn(instance: *mut c_void),
}Expand description
C-ABI stable vtable for dev-mode audio processing.
This struct is returned by the wavecraft_dev_create_processor FFI symbol
exported from user plugins. It provides function pointers for creating,
using, and destroying a processor instance across the dylib boundary.
§ABI Stability
This struct uses #[repr(C)] and only extern "C" function pointers,
making it safe across separately compiled Rust binaries. All data passes
through primitive types (f32, u32, *mut c_void, *mut *mut f32).
§Versioning
A version field allows the CLI to detect incompatible vtable changes
and provide clear upgrade guidance instead of undefined behavior.
§Memory Ownership
create() → Box::into_raw(Box::new(Processor)) [dylib allocates]
process() → &mut *(ptr as *mut Processor) [dylib borrows]
drop() → Box::from_raw(ptr as *mut Processor) [dylib deallocates]The CLI never allocates or frees the processor memory; it only passes the opaque pointer back into vtable functions.
Fields§
§version: u32VTable version. Must equal DEV_PROCESSOR_VTABLE_VERSION.
create: extern "C" fn() -> *mut c_voidCreate a new processor instance.
Returns an opaque pointer to a heap-allocated processor.
The caller must eventually pass this pointer to drop to free it.
process: extern "C" fn(instance: *mut c_void, channels: *mut *mut f32, num_channels: u32, num_samples: u32)Process audio in deinterleaved (per-channel) format.
§Arguments
instance: Opaque processor pointer fromcreatechannels: Pointer to an array ofnum_channelsmutable f32 pointersnum_channels: Number of audio channels (typically 2)num_samples: Number of samples per channel
§Safety
instancemust be a valid pointer fromcreatechannels[0..num_channels]must each point tonum_samplesvalid f32s- Must be called from a single thread (not thread-safe)
set_sample_rate: extern "C" fn(instance: *mut c_void, sample_rate: f32)Update the processor’s sample rate.
reset: extern "C" fn(instance: *mut c_void)Reset processor state (clear delay lines, filters, etc.).
drop: extern "C" fn(instance: *mut c_void)Destroy the processor instance and free its memory.
§Safety
instancemust be a valid pointer fromcreate- Must not be called more than once for the same pointer
- No other vtable function may be called after
drop
Trait Implementations§
Source§impl Clone for DevProcessorVTable
impl Clone for DevProcessorVTable
Source§fn clone(&self) -> DevProcessorVTable
fn clone(&self) -> DevProcessorVTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more