pub struct UniformPartitionEngine { /* private fields */ }Expand description
Uniform partitioned convolution engine for the IR tail.
Split the IR tail into equal partitions of block_size samples, then
process each audio block using the overlap-save algorithm in the frequency
domain.
Construct once on a non-real-time thread, then call process from the
audio render thread for each block.
Implementations§
Source§impl UniformPartitionEngine
impl UniformPartitionEngine
Sourcepub fn new(ir_tail: &[f32], block_size: usize) -> Self
pub fn new(ir_tail: &[f32], block_size: usize) -> Self
Create an engine loaded with the given IR tail coefficients.
ir_tail is the portion of the IR that comes after the head handled
by a DirectConvolver — i.e. ir[head_len..]. Pass &[] to
create a no-op (silence) engine.
block_size must equal the number of samples per audio render callback
and must be > 0.
Allocates — call from a non-real-time thread.
§Panics
Panics if block_size == 0.
Sourcepub fn num_partitions(&self) -> usize
pub fn num_partitions(&self) -> usize
Number of IR tail partitions.
Sourcepub fn block_size(&self) -> usize
pub fn block_size(&self) -> usize
Audio block size this engine was created with.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Clear all delay lines and input history without reallocating.
Call between song sections or preset changes to prevent clicks from stale tail energy.
Real-time safe — no allocation.
Sourcepub fn load_ir(&mut self, ir_tail: &[f32])
pub fn load_ir(&mut self, ir_tail: &[f32])
Replace the IR tail and reset all internal state.
block_size is preserved from construction.
Allocates — call from a non-real-time thread.
Sourcepub fn process(&mut self, input: &[f32], output: &mut [f32])
pub fn process(&mut self, input: &[f32], output: &mut [f32])
Process one block of block_size input samples, adding the
convolved tail into output.
output is accumulated into, not overwritten. The typical usage is:
output.fill(0.0);
direct.process(input, output); // zero-latency head
tail_engine.process(input, output); // add FFT tailBoth slices must have length equal to Self::block_size().
If the IR tail is empty this is a no-op (output is not touched).
Real-time safe — no allocation, no locking, no panics in release builds.