DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
ModulationRouter.h File Reference

Block-rate modulation routing: sources to parameter setters. More...

#include "DspMath.h"
#include <algorithm>
#include <array>
#include <atomic>
#include <cmath>
#include <functional>
Include dependency graph for ModulationRouter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::ModulationRouter< T, MaxRoutes >
 Fixed-capacity source-to-target router with per-route depth/smoothing. More...
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

Block-rate modulation routing: sources to parameter setters.

Generalizes the pitch-tracking-EQ pattern to any parameter without imposing an architecture: a route reads a source (LFO, EnvelopeFollower, PitchFollower, your lambda...), scales it by depth around a base value, smooths it, and applies it through a setter callback – once per block, which is how DSPark parameters are designed to move (their setters are thread-safe and internally smoothed).

Routes are configured at setup time (std::function storage may allocate THERE); update() in the audio callback is allocation-free – it only invokes the stored callables.

router.addRoute(
[&] { return follower.getSmoothedHz(); }, // source
[&](float v) { eq.setFrequency(v); }, // target
0.9f, 0.0f, 30.0f); // depth, base, smooth ms
// audio callback, after feeding the followers:
router.update(numSamples, sampleRate);

Dependencies: DspMath.h.

Definition in file ModulationRouter.h.