|
Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
#include <modulated_delay_line.hpp>
Public Member Functions | |
| ModulatedDelayLine (float *buffer, uint32_t max_delay) | |
| Construct with caller-provided buffer. | |
| ModulatedDelayLine ()=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 | clear () |
| 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) | |
Definition at line 31 of file modulated_delay_line.hpp.
|
inline |
Construct with caller-provided buffer.
| buffer | Float buffer (must outlive the ModulatedDelayLine) |
| max_delay | Maximum delay in samples (buffer size) |
Definition at line 40 of file modulated_delay_line.hpp.
|
default |
Default constructor for deferred initialization (must call init() before use)
|
inline |
Zero all samples in the buffer and reset write position.
Definition at line 155 of file modulated_delay_line.hpp.
Referenced by sbl::widgets::proc::Delay::reset(), and sbl::widgets::proc::PlateReverb::reset().
|
inline |
Initialize after default construction.
| buffer | Float buffer (must outlive the ModulatedDelayLine) |
| max_delay | Maximum delay in samples (buffer size) |
Definition at line 51 of file modulated_delay_line.hpp.
References max_delay().
Referenced by sbl::widgets::proc::Delay::init(), and sbl::widgets::proc::PlateReverb::init().
|
inline |
Maximum delay in samples (buffer size)
Definition at line 165 of file modulated_delay_line.hpp.
Referenced by init(), and sbl::widgets::proc::Delay::set_time().
|
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 146 of file modulated_delay_line.hpp.
References read(), and write().
|
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 78 of file modulated_delay_line.hpp.
Referenced by process(), and sbl::widgets::proc::Delay::process().
|
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 107 of file modulated_delay_line.hpp.
Referenced by sbl::widgets::proc::PlateReverb::process().
|
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 63 of file modulated_delay_line.hpp.
Referenced by process(), sbl::widgets::proc::Delay::process(), and sbl::widgets::proc::PlateReverb::process().
|
inline |
Current write position (for external tap reads)
Definition at line 168 of file modulated_delay_line.hpp.
Referenced by sbl::widgets::proc::PlateReverb::process().