Skip to main content

AsioBufferSwitchBridge

Struct AsioBufferSwitchBridge 

Source
pub struct AsioBufferSwitchBridge<P> { /* private fields */ }
Expand description

Drives a processor from an ASIO-style buffer switch callback.

Implementations§

Source§

impl<P: Processor> AsioBufferSwitchBridge<P>

Source

pub fn new( processor: P, timing: AsioTiming, input_channels: usize, output_channels: usize, ) -> Result<Self>

Builds a bridge over processor, calling its prepare with the timing’s sample rate, buffer size, and channel counts, and sizing scratch for the wider of the input/output lane counts.

Returns an error if both channel counts are zero, the buffer size does not fit in u32, or either channel count does not fit in u16.

Source

pub fn process_planar_f32( &mut self, input: Option<&[&[f32]]>, frames: usize, ) -> Result<Vec<Vec<f32>>>

Runs one buffer switch: wraps the planar f32 input (or silence when None) and frames count into a ProcessBlock, validates lanes, runs the processor, advances the sample position, and returns the planar output lanes.

Returns an error if frames exceeds the prepared maximum block size or the supplied input does not match the configured channel count and frame length.

Source

pub fn sample_pos(&self) -> u64

Returns the number of frames processed since construction or the last reset.

Source

pub fn timing(&self) -> AsioTiming

Returns the timing this bridge was constructed with.

Source

pub fn reset(&mut self)

Resets the wrapped processor, rewinds the sample position to zero, and clears the scratch arena.

Trait Implementations§

Source§

impl<P: Debug> Debug for AsioBufferSwitchBridge<P>

Source§

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

Formats the value using the given formatter. 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.