Class thl::dsp::utils::DelayProcessor#
-
class DelayProcessor : public thl::dsp::BaseProcessor#
Inheritance diagram for thl::dsp::utils::DelayProcessor:
Collaboration diagram for thl::dsp::utils::DelayProcessor:
Delays every channel by a whole number of samples, in place.
The delay can change at runtime up to a maximum; prepare() allocates one DynamicDelayLine per channel for that maximum. A delay of 0 passes the input through but keeps writing the lines, so a later, longer delay starts with the samples that came before it.
Once audio has been processed, a new delay crossfades linearly from the old one over crossfade_samples(). A delay set during a crossfade starts a new crossfade from the delay being faded to.
The delay is the intended output, e.g. to align a signal with a processor that has latency, so the processor reports no latency itself.
- Real-Time Safety
process(), write() and set_delay_samples() are real-time safe — no allocation, no locks. prepare() and set_max_delay_samples() allocate.
Public Functions
-
DelayProcessor()#
-
explicit DelayProcessor(size_t max_delay_samples)#
-
~DelayProcessor() override#
-
DelayProcessor(const DelayProcessor&) = delete#
-
DelayProcessor &operator=(const DelayProcessor&) = delete#
-
DelayProcessor(DelayProcessor&&) noexcept#
-
DelayProcessor &operator=(DelayProcessor&&) noexcept#
-
virtual void prepare(const double &sample_rate, const size_t &samples_per_block, const size_t &num_channels) override#
-
virtual void process(thl::core::BufferView buffer, uint32_t modulation_offset = 0) override#
-
void write(const thl::core::BufferView &buffer)#
Writes the input into the delay lines without changing it, so their history stays current.
-
virtual void reset() override#
Clears what the processor holds from the audio it has processed (delay lines, filter states, envelopes), keeping its settings, as if no audio had passed.
Real-time safe: a Graph calls it on the audio thread when a bypassed node comes back, so the node does not resume where it froze. The default does nothing.
-
void set_max_delay_samples(size_t max_delay_samples)#
Reallocates and clears the delay lines once prepared. Configure outside audio processing.
-
void set_delay_samples(size_t delay_samples)#
Clamped to max_delay_samples().
-
void set_crossfade_samples(size_t crossfade_samples)#
-
inline size_t max_delay_samples() const#
-
inline size_t delay_samples() const#
-
inline size_t crossfade_samples() const#