pub struct ConversionBuffers {
pub main_input_f32: Vec<Vec<f32>>,
pub main_output_f32: Vec<Vec<f32>>,
pub aux_input_f32: Vec<Vec<Vec<f32>>>,
pub aux_output_f32: Vec<Vec<Vec<f32>>>,
}Expand description
Pre-allocated buffers for f64↔f32 conversion.
Avoids heap allocation during audio processing when the processor only supports f32 but the host provides f64 buffers.
Fields are public for direct iteration access in format wrappers.
Fields§
§main_input_f32: Vec<Vec<f32>>Main input bus conversion buffers: [channel][samples]
main_output_f32: Vec<Vec<f32>>Main output bus conversion buffers: [channel][samples]
aux_input_f32: Vec<Vec<Vec<f32>>>Auxiliary input buses: [bus_index][channel_index][samples]
aux_output_f32: Vec<Vec<Vec<f32>>>Auxiliary output buses: [bus_index][channel_index][samples]
Implementations§
Source§impl ConversionBuffers
impl ConversionBuffers
Sourcepub fn new() -> Self
pub fn new() -> Self
Create empty conversion buffers (no capacity reserved).
Use this when you don’t know the configuration yet.
Call allocate() or allocate_from_buses() later.
Sourcepub fn allocate_from_buses(
input_buses: &[BusInfo],
output_buses: &[BusInfo],
max_frames: usize,
) -> Self
pub fn allocate_from_buses( input_buses: &[BusInfo], output_buses: &[BusInfo], max_frames: usize, ) -> Self
Pre-allocate buffers from bus information.
This is the preferred allocation method when you have access to BusInfo.
Extracts channel counts from main bus (index 0) and auxiliary buses (index 1+).
§Arguments
input_buses- Slice of input bus informationoutput_buses- Slice of output bus informationmax_frames- Maximum number of samples per buffer
Sourcepub fn allocate(
main_input_channels: usize,
main_output_channels: usize,
aux_input_channels: &[usize],
aux_output_channels: &[usize],
max_frames: usize,
) -> Self
pub fn allocate( main_input_channels: usize, main_output_channels: usize, aux_input_channels: &[usize], aux_output_channels: &[usize], max_frames: usize, ) -> Self
Pre-allocate buffers with explicit channel counts.
Use this when you have channel counts directly rather than BusInfo.
§Arguments
main_input_channels- Number of main input channelsmain_output_channels- Number of main output channelsaux_input_channels- Channel count for each auxiliary input busaux_output_channels- Channel count for each auxiliary output busmax_frames- Maximum number of samples per buffer
Sourcepub fn main_input_mut(&mut self, channel: usize) -> Option<&mut [f32]>
pub fn main_input_mut(&mut self, channel: usize) -> Option<&mut [f32]>
Get mutable reference to a main input channel buffer.
Returns None if the channel index is out of bounds.
Sourcepub fn main_input(&self, channel: usize) -> Option<&[f32]>
pub fn main_input(&self, channel: usize) -> Option<&[f32]>
Get reference to a main input channel buffer.
Sourcepub fn main_output_mut(&mut self, channel: usize) -> Option<&mut [f32]>
pub fn main_output_mut(&mut self, channel: usize) -> Option<&mut [f32]>
Get mutable reference to a main output channel buffer.
Sourcepub fn main_output(&self, channel: usize) -> Option<&[f32]>
pub fn main_output(&self, channel: usize) -> Option<&[f32]>
Get reference to a main output channel buffer.
Sourcepub fn main_input_channel_count(&self) -> usize
pub fn main_input_channel_count(&self) -> usize
Get number of main input channels.
Sourcepub fn main_output_channel_count(&self) -> usize
pub fn main_output_channel_count(&self) -> usize
Get number of main output channels.
Sourcepub fn aux_input_mut(
&mut self,
bus: usize,
channel: usize,
len: usize,
) -> Option<&mut [f32]>
pub fn aux_input_mut( &mut self, bus: usize, channel: usize, len: usize, ) -> Option<&mut [f32]>
Get mutable slice of an auxiliary input channel buffer.
§Arguments
bus- Auxiliary bus index (0 = first aux bus, not main bus)channel- Channel index within the buslen- Number of samples to access
Sourcepub fn aux_input(
&self,
bus: usize,
channel: usize,
len: usize,
) -> Option<&[f32]>
pub fn aux_input( &self, bus: usize, channel: usize, len: usize, ) -> Option<&[f32]>
Get slice of an auxiliary input channel buffer.
Sourcepub fn aux_output_mut(
&mut self,
bus: usize,
channel: usize,
len: usize,
) -> Option<&mut [f32]>
pub fn aux_output_mut( &mut self, bus: usize, channel: usize, len: usize, ) -> Option<&mut [f32]>
Get mutable slice of an auxiliary output channel buffer.
Sourcepub fn aux_output(
&self,
bus: usize,
channel: usize,
len: usize,
) -> Option<&[f32]>
pub fn aux_output( &self, bus: usize, channel: usize, len: usize, ) -> Option<&[f32]>
Get slice of an auxiliary output channel buffer.
Sourcepub fn aux_input_bus_count(&self) -> usize
pub fn aux_input_bus_count(&self) -> usize
Get number of auxiliary input buses.
Sourcepub fn aux_output_bus_count(&self) -> usize
pub fn aux_output_bus_count(&self) -> usize
Get number of auxiliary output buses.
Sourcepub fn aux_input_channel_count(&self, bus: usize) -> usize
pub fn aux_input_channel_count(&self, bus: usize) -> usize
Get number of channels in an auxiliary input bus.
Sourcepub fn aux_output_channel_count(&self, bus: usize) -> usize
pub fn aux_output_channel_count(&self, bus: usize) -> usize
Get number of channels in an auxiliary output bus.