Skip to main content

UniformPartitionEngine

Struct UniformPartitionEngine 

Source
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

Source

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.

Source

pub fn num_partitions(&self) -> usize

Number of IR tail partitions.

Source

pub fn block_size(&self) -> usize

Audio block size this engine was created with.

Source

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.

Source

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.

Source

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 tail

Both 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.

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.