Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::widgets::proc::Delay Class Reference

#include <delay.hpp>

Collaboration diagram for sbl::widgets::proc::Delay:

Public Member Functions

 Delay (float *buf_l, float *buf_r, uint32_t max_samples)
 Construct with caller-provided float buffers.
 
 Delay ()=default
 Default constructor (must call init() before use)
 
void init (float *buf_l, float *buf_r, uint32_t max_samples)
 Initialize after default construction.
 
void set_sample_rate (uint32_t sr)
 
void set_time (uint32_t samples)
 Set delay time in samples.
 
void set_time_ms (float ms)
 Set delay time in milliseconds.
 
void set_time_bpm (float bpm, uint8_t division)
 Set delay time from BPM and note division.
 
void set_feedback (float fb)
 Set feedback gain.
 
void set_mix (float mix)
 Set dry/wet mix.
 
void set_tone (float tone)
 Set tone (feedback damping)
 
void set_ping_pong (bool enable)
 Enable/disable ping-pong stereo bounce.
 
uint32_t time () const
 Current delay time in samples.
 
float feedback () const
 
float mix () const
 
bool ping_pong () const
 
void process (float *left, float *right, uint16_t frames)
 Process a stereo block in-place (float)
 
void reset ()
 Clear delay buffers and reset all state.
 

Detailed Description

Definition at line 33 of file delay.hpp.

Constructor & Destructor Documentation

◆ Delay() [1/2]

sbl::widgets::proc::Delay::Delay ( float *  buf_l,
float *  buf_r,
uint32_t  max_samples 
)
inline

Construct with caller-provided float buffers.

Note
All public methods are ISR-safe — bounded computation, no I/O.
Parameters
buf_lLeft delay buffer (must outlive the Delay)
buf_rRight delay buffer (must outlive the Delay)
max_samplesMaximum delay in samples (buffer size)

Definition at line 43 of file delay.hpp.

◆ Delay() [2/2]

sbl::widgets::proc::Delay::Delay ( )
default

Default constructor (must call init() before use)

Member Function Documentation

◆ feedback()

float sbl::widgets::proc::Delay::feedback ( ) const
inline

Definition at line 130 of file delay.hpp.

◆ init()

void sbl::widgets::proc::Delay::init ( float *  buf_l,
float *  buf_r,
uint32_t  max_samples 
)
inline

Initialize after default construction.

Parameters
buf_lLeft delay buffer
buf_rRight delay buffer
max_samplesMaximum delay in samples

Definition at line 55 of file delay.hpp.

References sbl::dsp::ModulatedDelayLine::init().

Here is the call graph for this function:

◆ mix()

float sbl::widgets::proc::Delay::mix ( ) const
inline

Definition at line 131 of file delay.hpp.

Referenced by set_mix().

Here is the caller graph for this function:

◆ ping_pong()

bool sbl::widgets::proc::Delay::ping_pong ( ) const
inline

Definition at line 132 of file delay.hpp.

◆ process()

void sbl::widgets::proc::Delay::process ( float *  left,
float *  right,
uint16_t  frames 
)
inline

Process a stereo block in-place (float)

Parameters
leftLeft channel buffer (float, in-place)
rightRight channel buffer (float, in-place)
framesNumber of sample frames

Definition at line 141 of file delay.hpp.

References sbl::dsp::OnePole::process(), sbl::dsp::ModulatedDelayLine::read(), and sbl::dsp::ModulatedDelayLine::write().

Here is the call graph for this function:

◆ reset()

void sbl::widgets::proc::Delay::reset ( )
inline

Clear delay buffers and reset all state.

Definition at line 177 of file delay.hpp.

References sbl::dsp::ModulatedDelayLine::clear(), and sbl::dsp::OnePole::reset().

Here is the call graph for this function:

◆ set_feedback()

void sbl::widgets::proc::Delay::set_feedback ( float  fb)
inline

Set feedback gain.

Parameters
fbFeedback 0.0–1.0 (clamped to 0.95 for stability)

Definition at line 99 of file delay.hpp.

◆ set_mix()

void sbl::widgets::proc::Delay::set_mix ( float  mix)
inline

Set dry/wet mix.

Parameters
mix0.0 = fully dry, 1.0 = fully wet

Definition at line 107 of file delay.hpp.

References mix().

Here is the call graph for this function:

◆ set_ping_pong()

void sbl::widgets::proc::Delay::set_ping_pong ( bool  enable)
inline

Enable/disable ping-pong stereo bounce.

Definition at line 126 of file delay.hpp.

◆ set_sample_rate()

void sbl::widgets::proc::Delay::set_sample_rate ( uint32_t  sr)
inline

Definition at line 60 of file delay.hpp.

◆ set_time()

void sbl::widgets::proc::Delay::set_time ( uint32_t  samples)
inline

Set delay time in samples.

Parameters
samplesDelay length (clamped to max_samples - 1)

Definition at line 66 of file delay.hpp.

References sbl::dsp::ModulatedDelayLine::max_delay().

Referenced by set_time_bpm(), and set_time_ms().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_time_bpm()

void sbl::widgets::proc::Delay::set_time_bpm ( float  bpm,
uint8_t  division 
)
inline

Set delay time from BPM and note division.

Parameters
bpmTempo in beats per minute
divisionNote division (1=whole, 2=half, 4=quarter, 8=eighth, etc.)

Definition at line 88 of file delay.hpp.

References set_time().

Here is the call graph for this function:

◆ set_time_ms()

void sbl::widgets::proc::Delay::set_time_ms ( float  ms)
inline

Set delay time in milliseconds.

Parameters
msDelay time in milliseconds

Definition at line 79 of file delay.hpp.

References set_time().

Here is the call graph for this function:

◆ set_tone()

void sbl::widgets::proc::Delay::set_tone ( float  tone)
inline

Set tone (feedback damping)

Parameters
tone0.0 = dark (heavy HF absorption), 1.0 = bright (no filtering)

Definition at line 115 of file delay.hpp.

References sbl::dsp::OnePole::set_coefficient().

Here is the call graph for this function:

◆ time()

uint32_t sbl::widgets::proc::Delay::time ( ) const
inline

Current delay time in samples.

Definition at line 129 of file delay.hpp.


The documentation for this class was generated from the following file: