Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
mod_matrix.hpp File Reference

Fixed-capacity modulation routing: sources to destinations, with depth and an optional second source that rides the depth. More...

#include <array>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <span>

Go to the source code of this file.

Classes

struct  pulp::signal::ModMatrixT< MaxSlots, SampleType >
struct  pulp::signal::ModMatrixT< MaxSlots, SampleType >::Slot
 One routing. More...
class  pulp::signal::DenseModMatrixT< NumSources, NumDestinations, SampleType >
 Dense Round-2 matrix facade. More...

Namespaces

namespace  pulp
namespace  pulp::signal
namespace  pulp::signal::round2
 Migration namespace for the unshipped Round-2 spelling whose template arity conflicts with the established slot matrix.

Typedefs

using pulp::signal::ModMatrix = ModMatrixT<32, float>
using pulp::signal::ModMatrix64 = ModMatrixT<32, double>
template<std::size_t NumSources, std::size_t NumDestinations, typename SampleType = float>
using pulp::signal::round2::ModMatrixT = DenseModMatrixT<NumSources, NumDestinations, SampleType>

Detailed Description

Fixed-capacity modulation routing: sources to destinations, with depth and an optional second source that rides the depth.

RT contract: a fixed-size array of POD slots. evaluate(), set_slot(), clear_slot(), and clear() allocate nothing and are audio-thread safe. The whole object is trivially copyable, so a prepared matrix can be published to the audio thread through a TripleBuffer and swapped without a lock.

USE: this is where "an LFO moves the cutoff, and the mod wheel decides how much" stops being a special case in someone's process() and becomes data. The via slot is the reason it is one pass rather than two: routing an envelope through via makes it ride the depth of the primary source, which covers "the envelope controls how much vibrato there is" without a second evaluation stage or a scratch buffer.

The matrix routes and accumulates in normalized units and deliberately does not clamp. Clamping belongs to the destination, which is the only place that knows whether the sum is cents, hertz, or a 0..1 mix — and a matrix that clamped to +/-1 would quietly break a destination whose useful range is +/-24 semitones.