Skip to main content

DevProcessorVTable

Struct DevProcessorVTable 

Source
#[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: u32

VTable version. Must equal DEV_PROCESSOR_VTABLE_VERSION.

§create: extern "C" fn() -> *mut c_void

Create 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 from create
  • channels: Pointer to an array of num_channels mutable f32 pointers
  • num_channels: Number of audio channels (typically 2)
  • num_samples: Number of samples per channel

§Safety

  • instance must be a valid pointer from create
  • channels[0..num_channels] must each point to num_samples valid 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

  • instance must be a valid pointer from create
  • 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

Source§

fn clone(&self) -> DevProcessorVTable

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DevProcessorVTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for DevProcessorVTable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.