Expand description
Audio buffer abstractions for plugin processing.
This module provides Buffer for main audio I/O and AuxiliaryBuffers
for sidechain and auxiliary bus access.
§Architecture
Audio processing in Beamer uses two separate buffer types:
Buffer: Main stereo/surround I/O - used by all pluginsAuxiliaryBuffers: Sidechain and aux buses - used by multi-bus plugins
This separation solves Rust’s lifetime variance constraints with nested mutable references while providing a clean, ergonomic API.
§Real-Time Safety
All buffer types use fixed-size stack storage with no heap allocations. This guarantees real-time safety in audio processing callbacks.
§Generic Sample Type
All buffer types are generic over S: Sample, defaulting to f32. This enables
zero-cost generic processing for both 32-bit and 64-bit audio.
§Example: Simple Gain Plugin
ⓘ
fn process(&mut self, buffer: &mut Buffer, _aux: &mut AuxiliaryBuffers) {
let gain = self.params.gain();
for (input, output) in buffer.zip_channels() {
for (i, o) in input.iter().zip(output.iter_mut()) {
*o = *i * gain;
}
}
}§Example: Sidechain Compressor
ⓘ
fn process(&mut self, buffer: &mut Buffer, aux: &mut AuxiliaryBuffers) {
// Analyze sidechain input
let key_level = aux.sidechain()
.map(|sc| sc.rms(0)) // RMS of first channel
.unwrap_or(0.0);
// Apply compression based on sidechain
let reduction = self.compute_gain_reduction(key_level);
for output in buffer.outputs_mut() {
for sample in output {
*sample *= reduction;
}
}
}Structs§
- AuxInput
- Immutable view of an auxiliary input bus.
- AuxOutput
- Mutable view of an auxiliary output bus.
- Auxiliary
Buffers - Auxiliary audio buffers for sidechain and multi-bus processing.
- Buffer
- Main audio buffer for plugin processing.
Type Aliases§
- Audio
Buffer Deprecated - DEPRECATED: Use
BufferandAuxiliaryBuffersinstead. - Bus
Deprecated - DEPRECATED: Use
AuxInputorAuxOutputinstead.