Struct synfx_dsp::DelayBuffer
source · [−]pub struct DelayBuffer<F: Flt> { /* private fields */ }
Expand description
This is a delay buffer/line with linear and cubic interpolation.
It’s the basic building block underneath the all-pass filter, comb filters and delay effects. You can use linear and cubic and no interpolation to access samples in the past. Either by sample offset or time (millisecond) based.
Implementations
sourceimpl<F: Flt> DelayBuffer<F>
impl<F: Flt> DelayBuffer<F>
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a delay buffer with about 5 seconds of capacity at 8*48000Hz sample rate.
sourcepub fn new_with_size(size: usize) -> Self
pub fn new_with_size(size: usize) -> Self
Creates a delay buffer with the given amount of samples capacity.
sourcepub fn set_sample_rate(&mut self, srate: F)
pub fn set_sample_rate(&mut self, srate: F)
Sets the sample rate that is used for milliseconds => sample conversion.
sourcepub fn feed(&mut self, input: F)
pub fn feed(&mut self, input: F)
Feed one sample into the delay line and increment the write pointer. Please note: For sample accurate feedback you need to retrieve the output of the delay line before feeding in a new signal.
sourcepub fn next_cubic(&mut self, delay_time_ms: F, input: F) -> F
pub fn next_cubic(&mut self, delay_time_ms: F, input: F) -> F
Combines DelayBuffer::cubic_interpolate_at and DelayBuffer::feed into one convenient function.
sourcepub fn next_linear(&mut self, delay_time_ms: F, input: F) -> F
pub fn next_linear(&mut self, delay_time_ms: F, input: F) -> F
Combines DelayBuffer::linear_interpolate_at and DelayBuffer::feed into one convenient function.
sourcepub fn next_nearest(&mut self, delay_time_ms: F, input: F) -> F
pub fn next_nearest(&mut self, delay_time_ms: F, input: F) -> F
Combines DelayBuffer::nearest_at and DelayBuffer::feed into one convenient function.
sourcepub fn tap_c(&self, delay_time_ms: F) -> F
pub fn tap_c(&self, delay_time_ms: F) -> F
Shorthand for DelayBuffer::cubic_interpolate_at.
sourcepub fn tap_n(&self, delay_time_ms: F) -> F
pub fn tap_n(&self, delay_time_ms: F) -> F
Shorthand for DelayBuffer::cubic_interpolate_at.
sourcepub fn tap_l(&self, delay_time_ms: F) -> F
pub fn tap_l(&self, delay_time_ms: F) -> F
Shorthand for DelayBuffer::cubic_interpolate_at.
sourcepub fn linear_interpolate_at(&self, delay_time_ms: F) -> F
pub fn linear_interpolate_at(&self, delay_time_ms: F) -> F
Fetch a sample from the delay buffer at the given tim with linear interpolation.
delay_time_ms
- Delay time in milliseconds.
sourcepub fn linear_interpolate_at_s(&self, s_offs: F) -> F
pub fn linear_interpolate_at_s(&self, s_offs: F) -> F
Fetch a sample from the delay buffer at the given offset with linear interpolation.
s_offs
- Sample offset in samples.
sourcepub fn cubic_interpolate_at(&self, delay_time_ms: F) -> F
pub fn cubic_interpolate_at(&self, delay_time_ms: F) -> F
Fetch a sample from the delay buffer at the given time with cubic interpolation.
delay_time_ms
- Delay time in milliseconds.
sourcepub fn cubic_interpolate_at_s(&self, s_offs: F) -> F
pub fn cubic_interpolate_at_s(&self, s_offs: F) -> F
Fetch a sample from the delay buffer at the given offset with cubic interpolation.
s_offs
- Sample offset in samples into the past of the DelayBuffer from the current write (or the “now”) position.
sourcepub fn nearest_at(&self, delay_time_ms: F) -> F
pub fn nearest_at(&self, delay_time_ms: F) -> F
Fetch a sample from the delay buffer at the given time without any interpolation.
delay_time_ms
- Delay time in milliseconds.
Trait Implementations
sourceimpl<F: Clone + Flt> Clone for DelayBuffer<F>
impl<F: Clone + Flt> Clone for DelayBuffer<F>
sourcefn clone(&self) -> DelayBuffer<F>
fn clone(&self) -> DelayBuffer<F>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more