AuxiliaryBuffers

Struct AuxiliaryBuffers 

Source
pub struct AuxiliaryBuffers<'a, S: Sample = f32> { /* private fields */ }
Expand description

Auxiliary audio buffers for sidechain and multi-bus processing.

Contains all non-main audio buses. Most plugins don’t need this - they only use the main Buffer.

§Type Parameter

S is the sample type, defaulting to f32. Use AuxiliaryBuffers<f64> for 64-bit double precision processing.

§Bus Indexing

Auxiliary buses are indexed starting from 0:

  • Bus 0: Sidechain (most common aux use case)
  • Bus 1+: Additional auxiliary I/O

§Real-Time Safety

This struct uses fixed-size stack storage. No heap allocations occur during construction or use.

§Example: Sidechain Access

if let Some(sidechain) = aux.sidechain() {
    let key_signal = sidechain.channel(0);
    // Use for compression keying, ducking, etc.
}

Implementations§

Source§

impl<'a, S: Sample> AuxiliaryBuffers<'a, S>

Source

pub fn new( inputs: impl IntoIterator<Item = impl IntoIterator<Item = &'a [S]>>, outputs: impl IntoIterator<Item = impl IntoIterator<Item = &'a mut [S]>>, num_samples: usize, ) -> Self

Create new auxiliary buffers.

This is called by the VST3 wrapper, not by plugin code. Buses/channels beyond the limits are silently ignored.

Source

pub fn empty() -> Self

Create empty auxiliary buffers (no aux buses).

Source

pub fn num_samples(&self) -> usize

Number of samples in this processing block.

Source

pub fn num_input_buses(&self) -> usize

Number of auxiliary input buses.

Source

pub fn num_output_buses(&self) -> usize

Number of auxiliary output buses.

Source

pub fn is_empty(&self) -> bool

Returns true if there are no auxiliary buses.

Source

pub fn sidechain(&self) -> Option<AuxInput<'_, S>>

Get the sidechain input bus (auxiliary input bus 0).

This is the most common aux use case. Returns None if no sidechain is connected.

§Example
let key_level = aux.sidechain()
    .map(|sc| sc.rms(0))
    .unwrap_or(0.0);
Source

pub fn input(&self, bus: usize) -> Option<AuxInput<'_, S>>

Get an auxiliary input bus by index.

Returns None if the bus doesn’t exist or has no channels.

Source

pub fn output(&mut self, bus: usize) -> Option<AuxOutput<'_, 'a, S>>

Get a mutable auxiliary output bus by index.

Returns None if the bus doesn’t exist or has no channels.

Source

pub fn iter_inputs(&self) -> impl Iterator<Item = AuxInput<'_, S>> + '_

Iterate over all auxiliary input buses.

Source

pub fn iter_outputs( &mut self, ) -> impl Iterator<Item = AuxOutput<'_, 'a, S>> + '_

Iterate over all auxiliary output buses mutably.

Auto Trait Implementations§

§

impl<'a, S> Freeze for AuxiliaryBuffers<'a, S>

§

impl<'a, S> RefUnwindSafe for AuxiliaryBuffers<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for AuxiliaryBuffers<'a, S>

§

impl<'a, S> Sync for AuxiliaryBuffers<'a, S>

§

impl<'a, S> Unpin for AuxiliaryBuffers<'a, S>

§

impl<'a, S = f32> !UnwindSafe for AuxiliaryBuffers<'a, S>

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.