|
| | ~Reverb ()=default |
| |
| void | prepare (const AudioSpec &spec) |
| | Prepares the reverb for processing.
|
| |
| void | processBlock (AudioBufferView< T > buffer) noexcept |
| | Processes audio through the reverb.
|
| |
| void | reset () noexcept |
| | Resets the DSP state (convolver tails, pre-delay, mixer). RT-Safe.
|
| |
| bool | loadIR (const char *wavFilePath) |
| | Loads an impulse response from a WAV file.
|
| |
| void | setMix (T dryWet) noexcept |
| | Sets the dry/wet mix.
|
| |
| bool | loadIR (const T *data, int length, double irSampleRate) |
| | Loads an IR from raw sample data.
|
| |
| void | setPreDelay (T ms) noexcept |
| | Sets the pre-delay time in milliseconds.
|
| |
| void | setDecayScale (T scale) |
| | Scales the decay time (T60) of the loaded IR.
|
| |
| void | setStretch (T ratio) |
| | Stretches the loaded IR in time (tape-speed style).
|
| |
| T | getDecayScale () const noexcept |
| | Returns the current IR decay scale.
|
| |
| T | getStretch () const noexcept |
| | Returns the current IR stretch ratio.
|
| |
| Convolver< T > & | getConvolver (int channel=0) |
| | Direct access to a channel's Convolver (GUI thread only).
|
| |
| DryWetMixer< T > & | getMixer () |
| | Direct access to the DryWetMixer.
|
| |
| bool | isLoaded () const noexcept |
| | Returns true if an IR has been loaded and applied.
|
| |
| T | getMix () const noexcept |
| | Returns the current mix value.
|
| |
| T | getPreDelay () const noexcept |
| | Returns the current pre-delay in ms.
|
| |
| int | getLatency () const noexcept |
| | Returns the convolution latency in samples.
|
| |
| std::vector< uint8_t > | getState () const |
| | Serializes the parameter state. The impulse response itself is content (load it with loadIR), not a preset parameter.
|
| |
| bool | setState (const uint8_t *data, size_t size) |
| | Restores parameters from a blob (tolerant; rejects foreign ids).
|
| |
template<FloatType T>
class dspark::Reverb< T >
Convolution reverb with IR loading, dry/wet, and pre-delay.
Internally manages one Convolver per channel. The IR is automatically resampled if its sample rate differs from the processing sample rate.
- Template Parameters
-
| T | Sample type (float or double). |
Definition at line 92 of file Reverb.h.
Processes audio through the reverb.
Flow: pushDry -> pre-delay -> convolve -> mixWet (with the dry delayed by the convolution latency so both paths stay aligned). Without a loaded IR the audio passes through untouched (and getLatency() is 0). Channels beyond the prepared count pass through untouched.
Thread-safety: the ConvolverBank is published atomically by loadIR/applyIR. We snapshot the current bank once at the top of the block into a local shared_ptr, so even if the GUI thread publishes a replacement mid-block, the audio thread keeps using a stable bank until the block completes. No resize of a live vector, no torn reads.
- Parameters
-
| buffer | Audio data to process in-place. |
Definition at line 161 of file Reverb.h.
Resets the DSP state (convolver tails, pre-delay, mixer). RT-Safe.
The loaded IR stays loaded: resetting used to drop the convolver bank entirely, silently unloading the reverb (a host reset on stop/start left it as a dry passthrough until the next loadIR()).
Definition at line 207 of file Reverb.h.
Scales the decay time (T60) of the loaded IR.
The IR's own decay rate is estimated from its Schroeder backward energy curve (T20 fit between -5 dB and -25 dB), then an exponential envelope is applied from the direct-sound peak onward so the shaped IR decays at scale times the original T60. The direct sound and early part are preserved.
Values below 1 shorten the tail AND trim the IR where its energy falls below -100 dB, so the convolution gets proportionally cheaper (about half the CPU at 0.5 on a typical exponential hall). Values above 1 lengthen the tail; this also lifts whatever noise floor the recording has, so moderate boosts (up to 2x) are the useful range. IRs without a broadly exponential tail (gated/reversed effects) are left unshaped.
Setup/UI threads only: rebuilds the convolver bank (allocates) and publishes it atomically, exactly like loadIR(). Not meant for per-block automation. Non-finite values are ignored.
- Parameters
-
| scale | T60 multiplier, clamped to [0.25, 2]. 1 = as loaded. |
Definition at line 353 of file Reverb.h.
Stretches the loaded IR in time (tape-speed style).
The IR is resampled by the given ratio: 2.0 doubles its length (larger, darker space, roughly an octave down in coloration), 0.5 halves it (smaller, brighter). Decay scale and stretch compose: effective T60 is approximately original * decayScale * stretch.
Setup/UI threads only: rebuilds the convolver bank (allocates) and publishes it atomically, exactly like loadIR(). Non-finite values are ignored.
- Parameters
-
| ratio | Time-stretch ratio, clamped to [0.5, 2]. 1 = as loaded. |
Definition at line 376 of file Reverb.h.
template<FloatType T>
| std::vector< T > dspark::Reverb< T >::shapeDecay |
( |
const T * |
ir, |
|
|
int |
len, |
|
|
double |
factor |
|
) |
| const |
|
inlineprotected |
Returns a decay-scaled copy of one IR channel (see setDecayScale).
Estimates the source decay rate from the Schroeder backward-energy curve (T20 fit: -5 dB to -25 dB crossings of the EDC), then applies exp(-k * (n - peak)) so the result decays at factor times the original T60. The direct sound (up to the peak) is untouched. Returns an empty vector when the IR has no measurable exponential decay (too short, or gated); the caller then uses the original data.
Definition at line 581 of file Reverb.h.