Skip to main content

RawBufferScratch

Struct RawBufferScratch 

Source
pub struct RawBufferScratch {
    pub input_slices: Vec<&'static [f32]>,
    pub output_slices: Vec<&'static mut [f32]>,
}
Expand description

Scratch space for AudioBuffer::from_raw_ptrs.

Callers allocate this on the stack and pass it to from_raw_ptrs. The buffer borrows the slices stored here, so this struct must outlive the returned AudioBuffer.

Fields§

§input_slices: Vec<&'static [f32]>§output_slices: Vec<&'static mut [f32]>

Implementations§

Source§

impl RawBufferScratch

Source

pub unsafe fn build<'a>( &'a mut self, inputs: *const *const f32, outputs: *mut *mut f32, num_in: u32, num_out: u32, num_frames: u32, ) -> AudioBuffer<'a>

Build an AudioBuffer from raw C pointers.

This is the common FFI pattern used by VST3, VST2, AU, and AAX wrappers. It:

  1. Converts raw *const f32 / *mut f32 channel pointers to slices
  2. Copies input channels to output channels (in-place effect processing)
  3. Returns an AudioBuffer borrowing the scratch slices
§Safety
  • inputs must point to num_in valid *const f32 pointers, each pointing to num_frames samples.
  • outputs must point to num_out valid *mut f32 pointers, each pointing to num_frames samples.
  • The pointed-to memory must remain valid for the lifetime of the returned AudioBuffer.

Trait Implementations§

Source§

impl Default for RawBufferScratch

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> 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, 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.