Skip to main content

AudioBuffer

Struct AudioBuffer 

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

Borrowed host channel buffers for one process block.

Channel ordering is [main inputs] [sidechain inputs] / [main outputs] [aux outputs].

Implementations§

Source§

impl<'a, S> AudioBuffer<'a, S>
where S: Sample,

Source

pub unsafe fn from_slices( inputs: &'a [&'a [S]], outputs: &'a mut [&'a mut [S]], num_samples: usize, ) -> AudioBuffer<'a, S>

§Safety

Slices must be valid for 'a; num_samples must not exceed any channel length. Treats all inputs as main inputs and all outputs as main outputs.

Source

pub fn from_slices_checked( inputs: &'a [&'a [S]], outputs: &'a mut [&'a mut [S]], num_samples: usize, ) -> AudioBuffer<'a, S>

Checked variant of from_slices.

§Panics

Panics if any channel has fewer than num_samples elements.

Source

pub fn from_slices_checked_with_sidechain( inputs: &'a [&'a [S]], outputs: &'a mut [&'a mut [S]], num_samples: usize, main_input_count: usize, sidechain_input_count: usize, ) -> AudioBuffer<'a, S>

Build a buffer with separated main + sidechain inputs (all outs = main).

§Panics

Panics if counts don’t match inputs / channel lengths.

Source

pub unsafe fn from_slices_with_sidechain_unchecked( inputs: &'a [&'a [S]], outputs: &'a mut [&'a mut [S]], num_samples: usize, main_input_count: usize, sidechain_input_count: usize, ) -> AudioBuffer<'a, S>

§Safety

Same as from_slices; all outputs count as main.

Source

pub unsafe fn from_slices_with_buses_unchecked( inputs: &'a [&'a [S]], outputs: &'a mut [&'a mut [S]], num_samples: usize, main_input_count: usize, sidechain_input_count: usize, main_output_count: usize, ) -> AudioBuffer<'a, S>

§Safety

Caller ensures counts match slice lengths; main_output_count ≤ outputs.len().

Source

pub fn num_samples(&self) -> usize

Source

pub fn num_inputs(&self) -> usize

Source

pub fn num_main_inputs(&self) -> usize

Source

pub fn num_sidechain_inputs(&self) -> usize

Source

pub fn num_outputs(&self) -> usize

Source

pub fn num_main_outputs(&self) -> usize

Source

pub fn num_aux_outputs(&self) -> usize

Source

pub fn input(&self, ch: usize) -> &[S]

Source

pub fn main_input(&self, ch: usize) -> &[S]

Source

pub fn sidechain_input(&self, ch: usize) -> &[S]

Source

pub fn output(&mut self, ch: usize) -> &mut [S]

Source

pub fn main_output(&mut self, ch: usize) -> &mut [S]

Source

pub fn aux_output(&mut self, ch: usize) -> &mut [S]

Auto Trait Implementations§

§

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

§

impl<'a, S> Forget for AudioBuffer<'a, S>

§

impl<'a, S> Freeze for AudioBuffer<'a, S>
where &'a [&'a [S]]: Freeze, &'a mut [&'a mut [S]]: Freeze,

§

impl<'a, S> RefUnwindSafe for AudioBuffer<'a, S>
where &'a [&'a [S]]: RefUnwindSafe, &'a mut [&'a mut [S]]: RefUnwindSafe,

§

impl<'a, S> Send for AudioBuffer<'a, S>
where &'a [&'a [S]]: Send, &'a mut [&'a mut [S]]: Send,

§

impl<'a, S> Sync for AudioBuffer<'a, S>
where &'a [&'a [S]]: Sync, &'a mut [&'a mut [S]]: Sync,

§

impl<'a, S> Unpin for AudioBuffer<'a, S>
where &'a [&'a [S]]: Unpin, &'a mut [&'a mut [S]]: Unpin,

§

impl<'a, S> UnsafeUnpin for AudioBuffer<'a, S>
where &'a [&'a [S]]: UnsafeUnpin, &'a mut [&'a mut [S]]: UnsafeUnpin,

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more