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

Per-voice modulation sources that feed VoiceModulationBuffer lanes. More...

#include <pulp/audio/instrument_envelope.hpp>
#include <pulp/audio/voice_modulation_buffer.hpp>
#include <pulp/signal/lfo.hpp>
#include <array>
#include <cmath>
#include <cstdint>
#include <span>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::audio::VoiceLfoSourceSpec
struct  pulp::audio::VoiceEnvelopeSourceSpec
struct  pulp::audio::VoiceModulationSourcesConfig
class  pulp::audio::VoiceModulationSources< MaximumVoices >
 A fixed-capacity bank of per-voice modulation sources. More...

Namespaces

namespace  pulp
namespace  pulp::audio

Enumerations

enum class  pulp::audio::VoiceLfoPhasePolicy : std::uint8_t { pulp::audio::FreeRunning , pulp::audio::Retrigger }
 LFO phase policy on note-on. More...

Detailed Description

Per-voice modulation sources that feed VoiceModulationBuffer lanes.

The destination side of per-voice modulation is shipped: voice_modulation_buffer.hpp carries per-voice lanes for gain, pitch, pan, pressure, timbre, and eight aux targets, at constant or audio rate. This bank supplies the missing source side: one LFO and one AHDSR envelope per voice, prepared with fixed memory, with the two voice-scoped policies a single shared source cannot express:

  • free-running versus note-retriggered LFO phase (a free LFO must ignore note-on; a retriggered one must restart phase and lifecycle on it), and
  • a per-voice phase offset that spreads unison voices evenly around the cycle instead of stacking them in phase.

Routing, depth automation, and unit conversion stay with the caller: the caller picks which target each source modulates, per render.

RT contract: prepare() and release() are control/background-thread calls that allocate. After prepare(), reset(), note_on(), note_off(), append_lfo_lane(), append_envelope_lane(), and write_voice() allocate nothing and are audio-thread safe.

Determinism: output is bit-identical for the same seed, voice index, event order, and block partition. reset() is the only reseeding point; voice i derives its LFO seed as seed + i, and retriggers deliberately do not reseed the random streams (the shipped pulp::signal::Lfo contract). Constant-rate lanes publish the block's first sample, so their value is block-partition dependent by definition; audio-rate lanes are partition-invariant.