DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
Panner.h
1// DSPark - Professional Audio DSP Framework
2// Copyright (c) 2026 Cristian Moresi - MIT License
3
4#pragma once
5
37#include "../Core/AudioBuffer.h"
38#include "../Core/AudioSpec.h"
39#include "../Core/Biquad.h"
40#include "../Core/DspMath.h"
41#include "../Core/Smoothers.h"
42#include "../Core/StateBlob.h"
43#include "Delay.h"
44
45#include <algorithm>
46#include <atomic>
47#include <cmath>
48#include <cstdint>
49#include <limits>
50#include <vector>
51
52namespace dspark {
53
54template <typename T = float>
55class Panner
56{
57public:
58 // Removed virtual destructor to maintain zero-cost abstraction (no vtable).
59 ~Panner() = default;
60
62 enum class Algorithm
63 {
65 Binaural,
66 MidPan,
67 SidePan,
68 Haas,
70 };
71
77 void prepare(const AudioSpec& spec)
78 {
79 if (!spec.isValid()) return;
81 // Start settled on the configured pan: from 0 a preset panned hard
82 // right faded in from the centre over the smoothing time.
83 panSmoother_.reset(sampleRate_, panTimeConstantMs(smoothingTime_.load(std::memory_order_relaxed)),
84 static_cast<float>(pan_.load(std::memory_order_relaxed)));
85
86 float maxMs = std::max(binauralMaxITD_.load(std::memory_order_relaxed),
87 haasMaxDelay_.load(std::memory_order_relaxed));
88
89 AudioSpec monoSpec { sampleRate_, spec.maxBlockSize, 1 };
90 // +1 ms of headroom over the configured maximum: the ITD/Haas paths
91 // add a ~4-sample common base delay on top of the maximum, and the
92 // capacity clamp must never shave it off.
93 delayL_.prepareMs(monoSpec, static_cast<double>(maxMs) + 1.0);
94 delayR_.prepareMs(monoSpec, static_cast<double>(maxMs) + 1.0);
97 // The ITD/Haas delays glide more slowly than the gains (time constant
98 // = the whole smoothing time): a delay that moves fast is a Doppler
99 // pitch bend, up to 30 ms of travel for Haas.
100 delayL_.setSmoothingTime(smoothingTime_.load(std::memory_order_relaxed));
101 delayR_.setSmoothingTime(smoothingTime_.load(std::memory_order_relaxed));
102
103 spectralPan_ = std::numeric_limits<float>::quiet_NaN(); // new rate: rebuild
105 }
106
114 void setAlgorithm(Algorithm algo) noexcept
115 {
116 algo = static_cast<Algorithm>(std::clamp(static_cast<int>(algo), 0,
117 static_cast<int>(Algorithm::Spectral)));
118 algorithm_.store(algo, std::memory_order_relaxed);
119 }
120
126 void setPan(T position) noexcept
127 {
128 if (!std::isfinite(position)) return;
129 // Publish only: the smoother is audio-thread state, so the target is
130 // applied at the top of the next processBlock() (writing it here from
131 // a control thread raced against getNextValue()).
132 pan_.store(std::clamp(position, T(-1), T(1)), std::memory_order_relaxed);
133 }
134
140 void processBlock(AudioBufferView<T> buffer) noexcept
141 {
142 if (buffer.getNumChannels() < 2) return;
143
144 // Front-door non-finite guard: the Spectral algorithm's Biquad
145 // shelves and the Binaural/Haas delay lines carry recursive state
146 // that a NaN/Inf input would poison permanently. Scrub non-finite input
147 // to 0 before any algorithm runs. No-op on finite input (metrics
148 // byte-identical).
149 {
150 const int gN = buffer.getNumSamples();
151 for (int ch = 0; ch < buffer.getNumChannels(); ++ch)
152 {
153 T* d = buffer.getChannel(ch);
154 for (int i = 0; i < gN; ++i)
155 if (!std::isfinite(d[i])) d[i] = T(0);
156 }
157 }
158
159 // Apply control-thread publications (audio-thread application point).
160 if (smoothingDirty_.exchange(false, std::memory_order_acquire))
162 panTimeConstantMs(smoothingTime_.load(std::memory_order_relaxed)),
164
165 float pTarget = static_cast<float>(pan_.load(std::memory_order_relaxed));
167
168 switch (algorithm_.load(std::memory_order_relaxed))
169 {
170 case Algorithm::EqualPower: applyEqualPower(buffer, pTarget); break;
171 case Algorithm::Binaural: applyCombinedBinaural(buffer, pTarget); break;
172 case Algorithm::MidPan: applyMidPan(buffer, pTarget); break;
173 case Algorithm::SidePan: applySidePan(buffer, pTarget); break;
174 case Algorithm::Haas: applyHaas(buffer, pTarget); break;
175 case Algorithm::Spectral: applySpectral(buffer, pTarget); break;
176 }
177 }
178
180 void reset() noexcept
181 {
182 delayL_.reset();
183 delayR_.reset();
187 }
188
193 [[nodiscard]] int getLatency() const noexcept
194 {
195 const Algorithm a = algorithm_.load(std::memory_order_relaxed);
196 return (a == Algorithm::Binaural || a == Algorithm::Haas) ? kBaseDelaySamples : 0;
197 }
198
199 // -- Configuration -------------------------------------------------------
200 // All thread-safe; non-finite values are ignored. The ITD / Haas maxima
201 // size the delay lines in prepare(): raising them beyond the prepared
202 // value takes full effect on the next prepare().
203
204 void setBinauralMaxITD(float ms) noexcept
205 {
206 if (!std::isfinite(ms)) return;
207 binauralMaxITD_.store(std::max(0.0f, ms), std::memory_order_relaxed);
208 }
209 void setHaasMaxDelay(float ms) noexcept
210 {
211 if (!std::isfinite(ms)) return;
212 haasMaxDelay_.store(std::max(0.0f, ms), std::memory_order_relaxed);
213 }
214 void setSpectralFrequency(float hz) noexcept
215 {
216 if (!std::isfinite(hz)) return;
217 spectralFreq_.store(std::clamp(hz, 20.0f, 20000.0f), std::memory_order_relaxed);
218 }
219 void setSpectralMaxGain(float dB) noexcept
220 {
221 if (!std::isfinite(dB)) return;
222 spectralMaxGain_.store(dB, std::memory_order_relaxed);
223 }
224
228 void setSmoothingTime(float ms) noexcept
229 {
230 if (!std::isfinite(ms)) return;
231 smoothingTime_.store(std::max(0.0f, ms), std::memory_order_relaxed);
232 delayL_.setSmoothingTime(ms); // Delay's own publish/apply handoff
233 delayR_.setSmoothingTime(ms);
234 smoothingDirty_.store(true, std::memory_order_release);
235 }
236
237
239 [[nodiscard]] std::vector<uint8_t> getState() const
240 {
241 // The blob stores float: the cast keeps Panner<double> compiling.
242 StateWriter w(stateId("PANR"), 1);
243 w.write("pan", static_cast<float>(pan_.load(std::memory_order_relaxed)));
244 w.write("algorithm", static_cast<int32_t>(algorithm_.load(std::memory_order_relaxed)));
245 w.write("smoothing", smoothingTime_.load(std::memory_order_relaxed));
246 w.write("binauralITD", binauralMaxITD_.load(std::memory_order_relaxed));
247 w.write("haasDelay", haasMaxDelay_.load(std::memory_order_relaxed));
248 w.write("spectralFreq", spectralFreq_.load(std::memory_order_relaxed));
249 w.write("spectralGain", spectralMaxGain_.load(std::memory_order_relaxed));
250 return w.blob();
251 }
252
254 bool setState(const uint8_t* data, size_t size)
255 {
256 StateReader r(data, size);
257 if (!r.isValid() || r.processorId() != stateId("PANR")) return false;
258 setPan(static_cast<T>(r.read("pan", 0.0f)));
259 setAlgorithm(static_cast<Algorithm>(r.read("algorithm", 0))); // clamped inside
260 setSmoothingTime(r.read("smoothing", 50.0f));
261 setBinauralMaxITD(r.read("binauralITD", 0.66f));
262 setHaasMaxDelay(r.read("haasDelay", 30.0f));
263 setSpectralFrequency(r.read("spectralFreq", 4000.0f));
264 setSpectralMaxGain(r.read("spectralGain", 6.0f));
265 return true;
266 }
267
268protected:
269 void applyEqualPower(AudioBufferView<T> buffer, float /*panTarget*/) noexcept
270 {
271 T* L = buffer.getChannel(0);
272 T* R = buffer.getChannel(1);
273 const int n = buffer.getNumSamples();
274 constexpr T halfPi = pi<T> / T(2);
275
277 {
278 // Static pan: hoist the trig out of the loop entirely.
279 const T angle = (static_cast<T>(panSmoother_.getCurrentValue()) * T(0.5) + T(0.5)) * halfPi;
280 const T gL = std::cos(angle);
281 const T gR = std::sin(angle);
282 for (int i = 0; i < n; ++i)
283 {
284 L[i] *= gL;
285 R[i] *= gR;
286 }
287 return;
288 }
289
290 for (int i = 0; i < n; ++i)
291 {
292 T p = static_cast<T>(panSmoother_.getNextValue());
293 T angle = (p * T(0.5) + T(0.5)) * halfPi;
294
295 // fastSin/fastCos: > 100 dB accurate, several times cheaper than libm.
296 L[i] *= fastCos(angle);
297 R[i] *= fastSin(angle);
298 }
299 }
300
301 void applyCombinedBinaural(AudioBufferView<T> buffer, float panTarget) noexcept
302 {
303 T* L = buffer.getChannel(0);
304 T* R = buffer.getChannel(1);
305 const int n = buffer.getNumSamples();
306
307 T itdMax = T(binauralMaxITD_.load(std::memory_order_relaxed));
308 T targetP = static_cast<T>(panTarget);
309
310 // Push the new ITD targets. A small COMMON base delay is added to both ears
311 // so neither hits the delay line's 3-sample interpolation floor: that floor
312 // used to clamp both ears to 3 for |pan| < ~0.1, killing the ITD cue near
313 // centre (a localization dead-zone). With the base offset the ITD difference
314 // is linear from the centre, and the shared delay is inaudible.
315 const T baseMs = T(1000 * kBaseDelaySamples) / static_cast<T>(sampleRate_); // 4 samples
316 delayL_.setDelayMs(baseMs + itdMax * std::max(T(0), targetP)); // pan>0 => L delayed
317 delayR_.setDelayMs(baseMs + itdMax * std::max(T(0), -targetP)); // pan<0 => R delayed
318
319 for (int i = 0; i < n; ++i)
320 {
321 T p = static_cast<T>(panSmoother_.getNextValue());
322
323 // Binaural cross-feed model:
324 // - The ipsilateral ear (closer to the source) receives the
325 // near channel essentially intact + a small leakage from the
326 // far channel.
327 // - The contralateral ear (far ear) receives the far channel
328 // attenuated + a leakage from the near channel + the ITD
329 // delay applied later by delayL_/delayR_.
330 // This preserves audibility on both ears at hard pan, unlike a
331 // straight mute, and produces the head-shadowing illusion typical
332 // of real-world hearing (~6 dB ILD between ears at 90 deg).
333 T absp = std::abs(p); // 0..1
334 T farAtten = T(1) - absp * T(0.5); // 1.0 -> 0.5 at extreme
335 T leakage = absp * T(0.3); // 0 -> 0.3 cross-bleed
336
337 T l_temp, r_temp;
338 if (p >= T(0))
339 {
340 // Pan right -> L is the contralateral (delayed) ear.
341 l_temp = L[i] * farAtten + R[i] * leakage;
342 r_temp = R[i] + L[i] * leakage * T(0.5); // gentle near-ear bleed
343 }
344 else
345 {
346 // Pan left -> R is the contralateral ear.
347 l_temp = L[i] + R[i] * leakage * T(0.5);
348 r_temp = R[i] * farAtten + L[i] * leakage;
349 }
350
351 // Delay::processSample already advances its write index, so we
352 // must NOT call advanceWriteIndex() afterwards.
353 L[i] = delayL_.processSample(0, l_temp);
354 R[i] = delayR_.processSample(0, r_temp);
355 }
356 }
357
358 void applyMidPan(AudioBufferView<T> buffer, float /*panTarget*/) noexcept
359 {
360 T* L = buffer.getChannel(0);
361 T* R = buffer.getChannel(1);
362 const int n = buffer.getNumSamples();
363 constexpr T halfPi = pi<T> / T(2);
364
365 for (int i = 0; i < n; ++i)
366 {
367 T p = static_cast<T>(panSmoother_.getNextValue());
368 T mid = (L[i] + R[i]) * T(0.5);
369 T side = (L[i] - R[i]) * T(0.5);
370
371 // Equal-power mid pan: gL^2 + gR^2 == 2 for every position, with
372 // gL == gR == 1 at centre (transparent to within the fast-trig
373 // accuracy, > 100 dB). A hard pan peaks at
374 // +3 dB instead of the +6 dB of the old constant-voltage law,
375 // keeping headroom predictable while staying mono-compatible.
376 T angle = (p * T(0.5) + T(0.5)) * halfPi;
377 T gL = fastCos(angle) * sqrt2<T>;
378 T gR = fastSin(angle) * sqrt2<T>;
379
380 L[i] = mid * gL + side;
381 R[i] = mid * gR - side;
382 }
383 }
384
385 void applySidePan(AudioBufferView<T> buffer, float /*panTarget*/) noexcept
386 {
387 T* L = buffer.getChannel(0);
388 T* R = buffer.getChannel(1);
389 const int n = buffer.getNumSamples();
390 constexpr T halfPi = pi<T> / T(2);
391
392 for (int i = 0; i < n; ++i)
393 {
394 T p = static_cast<T>(panSmoother_.getNextValue());
395 T mid = (L[i] + R[i]) * T(0.5);
396 T side = (L[i] - R[i]) * T(0.5);
397
398 T angle = (p * T(0.5) + T(0.5)) * halfPi;
399
400 // Normalized by sqrt(2) to prevent -3dB attenuation at dead center.
401 // Clamped to avoid massive boosts at hard extremes.
402 T sideGainL = std::clamp(fastCos(angle) * sqrt2<T>, T(0), T(1));
403 T sideGainR = std::clamp(fastSin(angle) * sqrt2<T>, T(0), T(1));
404
405 L[i] = mid + (side * sideGainL);
406 R[i] = mid - (side * sideGainR);
407 }
408 }
409
410 void applyHaas(AudioBufferView<T> buffer, float panTarget) noexcept
411 {
412 T haasMax = T(haasMaxDelay_.load(std::memory_order_relaxed));
413 T pT = static_cast<T>(panTarget);
414
415 // Smoothed inside Delay - no abrupt pointer jumps even on fast moves.
416 // Common base delay keeps both ears above the 3-sample interpolation floor
417 // so the inter-channel delay is linear from centre (no dead-zone).
418 const T baseMs = T(1000 * kBaseDelaySamples) / static_cast<T>(sampleRate_); // 4 samples
419 delayL_.setDelayMs(baseMs + haasMax * std::max(T(0), pT));
420 delayR_.setDelayMs(baseMs + haasMax * std::max(T(0), -pT));
421
422 T* L = buffer.getChannel(0);
423 T* R = buffer.getChannel(1);
424 const int n = buffer.getNumSamples();
425
426 for (int i = 0; i < n; ++i)
427 {
428 // Keep the pan smoother stepping in sync with the block, even
429 // though Haas does not use the smoothed pan value directly.
431
432 // processSample advances the write index by itself; calling
433 // advanceWriteIndex() afterwards corrupts the delay line.
434 L[i] = delayL_.processSample(0, L[i]);
435 R[i] = delayR_.processSample(0, R[i]);
436 }
437 }
438
439 void applySpectral(AudioBufferView<T> buffer, float /*panTarget*/) noexcept
440 {
441 // The shelves follow the SMOOTHED pan, re-designed every 4 samples
442 // while it moves (coarser steps left an audible coefficient zipper).
443 // Settled, the cached design is reused.
444 T* L = buffer.getChannel(0);
445 T* R = buffer.getChannel(1);
446 const int n = buffer.getNumSamples();
447 constexpr int kSubBlock = 4;
448
449 for (int start = 0; start < n; start += kSubBlock)
450 {
451 const int end = std::min(n, start + kSubBlock);
452 float p = panSmoother_.getCurrentValue();
453 for (int i = start; i < end; ++i)
455 updateSpectralFilters(static_cast<T>(p));
456
457 for (int i = start; i < end; ++i)
458 {
459 L[i] = spectralL_.processSample(L[i], 0);
460 R[i] = spectralR_.processSample(R[i], 0);
461 }
462 }
463 }
464
465 void updateSpectralFilters(T targetPan) noexcept
466 {
467 float sMaxGain = spectralMaxGain_.load(std::memory_order_relaxed);
468 float sFreq = spectralFreq_.load(std::memory_order_relaxed);
469 const float pan = static_cast<float>(targetPan);
470 if (pan == spectralPan_ && sFreq == spectralFreqUsed_ && sMaxGain == spectralGainUsed_)
471 return; // design unchanged
472 spectralPan_ = pan;
473 spectralFreqUsed_ = sFreq;
474 spectralGainUsed_ = sMaxGain;
475
476 T gainLdB = -targetPan * static_cast<T>(sMaxGain);
477 T gainRdB = targetPan * static_cast<T>(sMaxGain);
478
479 // Audio-thread-owned coefficients: the direct setter (setCoeffs() is
480 // the cross-thread channel; a stream owner must not self-publish).
482 sampleRate_, static_cast<double>(sFreq), static_cast<double>(gainLdB)));
484 sampleRate_, static_cast<double>(sFreq), static_cast<double>(gainRdB)));
485 }
486
487 double sampleRate_ = 48000.0;
488 std::atomic<Algorithm> algorithm_ { Algorithm::EqualPower };
489 static constexpr int kBaseDelaySamples = 4;
490 std::atomic<T> pan_ { T(0) };
491
493 // Second-order (critically damped) pan smoothing: position AND velocity
494 // are continuous, so a control stream updated at GUI/automation rate
495 // (a new target every ~16 ms) moves without the 60 Hz kinks of a linear
496 // ramp restarted on every update (an audible zipper on fast drags).
500 static float panTimeConstantMs(float smoothingMs) noexcept { return smoothingMs * 0.2f; }
502
503 std::atomic<float> smoothingTime_ { 50.0f };
504 std::atomic<bool> smoothingDirty_ { false };
505 std::atomic<float> binauralMaxITD_ { 0.66f };
506 std::atomic<float> haasMaxDelay_ { 30.0f };
507 std::atomic<float> spectralFreq_ { 4000.0f };
508 std::atomic<float> spectralMaxGain_ { 6.0f };
509
510 // Settings of the current shelf design (audio thread; NaN forces a rebuild).
511 float spectralPan_ = std::numeric_limits<float>::quiet_NaN();
512 float spectralFreqUsed_ = 0.0f;
513 float spectralGainUsed_ = 0.0f;
514};
515
516} // namespace dspark
Non-owning view over audio channel data.
Definition AudioBuffer.h:53
Biquad filter using Transposed Direct Form II (TDF-II) with thread-safe updates.
Definition Biquad.h:853
void setCoeffsNow(const BiquadCoeffs &c) noexcept
Stream-owner direct set: makes c the active set immediately.
Definition Biquad.h:963
void reset() noexcept
Resets all per-channel filter states to zero to avoid ringing/clicks.
Definition Biquad.h:1003
T processSample(T input, int channel) noexcept
Processes a single sample for a specific channel.
Definition Biquad.h:1029
void setHaasMaxDelay(float ms) noexcept
Definition Panner.h:209
void setAlgorithm(Algorithm algo) noexcept
Sets the active panning algorithm safely from any thread.
Definition Panner.h:114
~Panner()=default
std::atomic< float > binauralMaxITD_
Definition Panner.h:505
void prepare(const AudioSpec &spec)
Initializes internal delays, filters, and smoothers.
Definition Panner.h:77
Delay< T > delayR_
Definition Panner.h:492
Biquad< T, 1 > spectralR_
Definition Panner.h:501
float spectralGainUsed_
Definition Panner.h:513
std::atomic< Algorithm > algorithm_
Definition Panner.h:488
void setSmoothingTime(float ms) noexcept
Sets the pan smoothing time: a change settles (to 96%) in this many ms along a critically damped curv...
Definition Panner.h:228
Delay< T > delayL_
Definition Panner.h:492
std::atomic< float > spectralMaxGain_
Definition Panner.h:508
int getLatency() const noexcept
Latency in samples: the 4-sample common base delay of the Binaural and Haas paths (centred image),...
Definition Panner.h:193
std::vector< uint8_t > getState() const
Serializes the parameter state (setup/UI threads; allocates).
Definition Panner.h:239
Biquad< T, 1 > spectralL_
Definition Panner.h:501
void setPan(T position) noexcept
Sets the target pan position (automatable, smoothed).
Definition Panner.h:126
void setBinauralMaxITD(float ms) noexcept
Definition Panner.h:204
void applyEqualPower(AudioBufferView< T > buffer, float) noexcept
Definition Panner.h:269
std::atomic< float > haasMaxDelay_
Definition Panner.h:506
void setSpectralMaxGain(float dB) noexcept
Definition Panner.h:219
double sampleRate_
Definition Panner.h:487
static float panTimeConstantMs(float smoothingMs) noexcept
Definition Panner.h:500
Smoothers::CriticallyDampedSmoother panSmoother_
Definition Panner.h:497
void applySpectral(AudioBufferView< T > buffer, float) noexcept
Definition Panner.h:439
void reset() noexcept
Clears delay lines and filter states to prevent ghost echoes.
Definition Panner.h:180
void applyMidPan(AudioBufferView< T > buffer, float) noexcept
Definition Panner.h:358
std::atomic< T > pan_
Definition Panner.h:490
std::atomic< bool > smoothingDirty_
Pan smoother re-config pending.
Definition Panner.h:504
std::atomic< float > smoothingTime_
Definition Panner.h:503
void processBlock(AudioBufferView< T > buffer) noexcept
Processes an audio block in-place. Real-time safe.
Definition Panner.h:140
void applyHaas(AudioBufferView< T > buffer, float panTarget) noexcept
Definition Panner.h:410
void setSpectralFrequency(float hz) noexcept
Definition Panner.h:214
float spectralPan_
Definition Panner.h:511
void applyCombinedBinaural(AudioBufferView< T > buffer, float panTarget) noexcept
Definition Panner.h:301
void updateSpectralFilters(T targetPan) noexcept
Definition Panner.h:465
static constexpr int kBaseDelaySamples
Binaural/Haas common delay.
Definition Panner.h:489
float spectralFreqUsed_
Definition Panner.h:512
std::atomic< float > spectralFreq_
Definition Panner.h:507
Algorithm
Available panning algorithms.
Definition Panner.h:63
@ Binaural
Cross-feeding + ITD delay.
@ EqualPower
Standard -3 dB constant-power pan.
@ MidPan
Pans only the centre (mid) image.
@ SidePan
Pans only the stereo (side) image.
@ Haas
Precedence effect via inter-channel delay.
@ Spectral
Frequency-dependent panning via high-shelf.
bool setState(const uint8_t *data, size_t size)
Restores parameters from a blob (tolerant; rejects foreign ids).
Definition Panner.h:254
void applySidePan(AudioBufferView< T > buffer, float) noexcept
Definition Panner.h:385
Tolerant reader: missing keys yield defaults, unknown keys are skipped.
Definition StateBlob.h:171
float read(const char *key, float defaultValue) const
Reads a float, or defaultValue when the key is absent.
Definition StateBlob.h:214
bool isValid() const noexcept
Definition StateBlob.h:209
uint32_t processorId() const noexcept
Definition StateBlob.h:210
Serializes key/value parameters into a versioned blob.
Definition StateBlob.h:53
std::vector< uint8_t > blob() const
Finalizes and returns the blob.
Definition StateBlob.h:112
void write(const char *key, float value)
Writes a float parameter.
Definition StateBlob.h:71
Main namespace for the DSPark framework.
T fastSin(T x) noexcept
Fast sine approximation (degree-9 odd minimax polynomial).
Definition DspMath.h:340
T fastCos(T x) noexcept
Fast cosine approximation. See fastSin() for accuracy notes (the pi/2 offset costs float about one ul...
Definition DspMath.h:369
constexpr uint32_t stateId(const char(&tag)[5]) noexcept
Builds a FOURCC processor id, e.g. dspark::stateId("COMP").
Definition StateBlob.h:672
constexpr T halfPi
Pi / 2 (1.57079...). Quarter period; sin/cos phase offset.
Definition DspMath.h:57
Describes the audio environment for a DSP processor.
Definition AudioSpec.h:37
constexpr bool isValid() const noexcept
Checks if the specification contains valid, processable parameters.
Definition AudioSpec.h:71
int maxBlockSize
Maximum number of samples per processing block.
Definition AudioSpec.h:53
double sampleRate
Sample rate in Hz.
Definition AudioSpec.h:45
static BiquadCoeffs makeHighShelf(double sampleRate, double freq, double gainDb, double slope=1.0) noexcept
High-shelf filter.
Definition Biquad.h:447
Critically damped smoother (no overshoot, exact Q=0.5).
Definition Smoothers.h:328
void reset(double sampleRate, float timeConstantMilliseconds, float initialValue=0.0f) noexcept
Definition Smoothers.h:912
float getCurrentValue() const noexcept
Definition Smoothers.h:267
void setTargetValue(float newTarget) noexcept
Definition Smoothers.h:714