|
Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Definition at line 28 of file delay_line.hpp.
#include <delay_line.hpp>
Public Member Functions | |
| DelayLine (float *buffer, uint32_t max_delay) | |
| Construct with caller-provided buffer. | |
| DelayLine ()=default | |
| Default constructor for deferred initialization (must call init() before use) | |
| void | init (float *buffer, uint32_t max_delay) |
| Initialize after default construction. | |
| void | write (float sample) |
| Write a sample to the delay line. | |
| float | read (float delay_samples) const |
| Read at fractional delay with linear interpolation. | |
| float | read_cubic (float delay_samples) const |
| Read at fractional delay with 4-point Hermite cubic interpolation. | |
| void | process (const float *in, float *out, const float *delay, uint16_t frames) |
| Block processing with per-sample modulated delay. | |
| void | reset () |
| Zero all samples in the buffer and reset write position. | |
| uint32_t | max_delay () const |
| Maximum delay in samples (buffer size) | |
| uint32_t | write_pos () const |
| Current write position (for external tap reads) | |
|
inline |
Construct with caller-provided buffer.
| buffer | Float buffer (must outlive the DelayLine) |
| max_delay | Maximum delay in samples (buffer size) |
Definition at line 37 of file delay_line.hpp.
|
default |
Default constructor for deferred initialization (must call init() before use)
|
inline |
Initialize after default construction.
| buffer | Float buffer (must outlive the DelayLine) |
| max_delay | Maximum delay in samples (buffer size) |
Definition at line 48 of file delay_line.hpp.
References max_delay().
Referenced by sbl::dsp::pm::StringLoop::init(), sbl::dsp::modules::TapeDelay::init(), and sbl::dsp::modules::AlgoReverb< ScalePercent >::init().
|
inline |
Write a sample to the delay line.
Advances the write pointer after storing. The write pointer always points to the next write location.
Definition at line 60 of file delay_line.hpp.
Referenced by process(), sbl::dsp::modules::AlgoReverb< ScalePercent >::process(), sbl::dsp::modules::TapeDelay::process(), and sbl::dsp::pm::StringLoop::tick().
|
inline |
Read at fractional delay with linear interpolation.
| delay_samples | Delay in samples (1.0 = most recently written sample). Clamped to [1.0, max_delay - 1]. |
Definition at line 75 of file delay_line.hpp.
Referenced by sbl::dsp::pm::StringLoop::energy(), process(), sbl::dsp::modules::AlgoReverb< ScalePercent >::process(), and sbl::dsp::pm::StringLoop::tick().
|
inline |
Read at fractional delay with 4-point Hermite cubic interpolation.
Higher quality than linear — reduces artifacts for reverb tank modulation and pitch shifting. Uses samples at [d-1, d, d+1, d+2] around the read position.
| delay_samples | Delay in samples (1.0 = most recently written sample). Clamped to [2.0, max_delay - 2]. |
Definition at line 104 of file delay_line.hpp.
Referenced by sbl::dsp::modules::AlgoReverb< ScalePercent >::process(), and sbl::dsp::modules::TapeDelay::process().
|
inline |
Block processing with per-sample modulated delay.
For each frame: writes in[i], reads at delay[i], outputs to out[i]. The delay array provides per-sample modulation (e.g., base delay + LFO). Uses linear interpolation.
in and out may alias (in-place processing is safe since each sample is read from in before write, and output is written after read).
| in | Input audio buffer |
| out | Output audio buffer |
| delay | Per-sample delay values in samples |
| frames | Number of frames to process |
Definition at line 143 of file delay_line.hpp.
|
inline |
Zero all samples in the buffer and reset write position.
Definition at line 152 of file delay_line.hpp.
Referenced by sbl::dsp::modules::AlgoReverb< ScalePercent >::reset(), sbl::dsp::modules::TapeDelay::reset(), and sbl::dsp::pm::StringLoop::reset().
|
inline |
Maximum delay in samples (buffer size)
Definition at line 162 of file delay_line.hpp.
Referenced by init(), and sbl::dsp::modules::TapeDelay::set_time_su().
|
inline |
Current write position (for external tap reads)
Definition at line 165 of file delay_line.hpp.
Referenced by sbl::dsp::modules::AlgoReverb< ScalePercent >::process().