Skip to main content

BufferView

Trait BufferView 

Source
pub trait BufferView: Send + Sync {
    // Required methods
    fn num_input_channels(&self) -> usize;
    fn num_output_channels(&self) -> usize;
    fn read_input(&self, channel: usize, dst: &mut [f32]) -> usize;
    fn write_output(&self, channel: usize, src: &[f32]) -> usize;
}
Expand description

Backend-specific accessor for I/O ring buffers.

Encapsulates per-backend rules (interleave/deinterleave) for reading input samples from and writing output samples to cross-thread ring buffers. Each backend provides its own implementation.

Required Methods§

Source

fn num_input_channels(&self) -> usize

Number of input (capture) channels.

Source

fn num_output_channels(&self) -> usize

Number of output (playback) channels.

Source

fn read_input(&self, channel: usize, dst: &mut [f32]) -> usize

Read available input samples for one channel into dst.

Returns the number of samples actually read (may be less than dst.len() if insufficient data is available).

Source

fn write_output(&self, channel: usize, src: &[f32]) -> usize

Write output samples for one channel from src.

Returns the number of samples actually written (may be less than src.len() if insufficient space is available).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§