Struct Delay Line
pub struct DelayLine { /* private fields */ }Expand description
A circular double-precision delay with linear fractional interpolation.
The cursor names the next write slot. Read before writing for a feedback
delay; write before reading for a zero-delay feedforward path. Advance once
after each sample. Delay zero reads the cursor slot, which contains the
oldest sample until written. Finite delays clamp to 0..=length-1;
nonfinite delays read zero without changing storage.
Implementations§
§impl DelayLine
impl DelayLine
pub fn new(length: usize) -> Result<Self, EmptyDelay>
pub fn new(length: usize) -> Result<Self, EmptyDelay>
Allocate zeroed storage outside the processing callback.
pub fn read(&self, delay: f64) -> f64
pub fn read_integer(&self, delay: usize) -> f64
pub fn read_integer(&self, delay: usize) -> f64
Read a whole-sample delay without fractional interpolation.
Delays beyond storage clamp to length-1; zero reads the cursor slot.
pub fn write(&mut self, sample: f64)
pub fn advance(&mut self)
pub fn reset(&mut self)
pub fn reset(&mut self)
Clear history and return the cursor to zero, retaining its allocation.