|
| | Synthesiser (std::size_t polyphony=16) |
| | Construct with a fixed polyphony.
|
| void | set_steal_strategy (VoiceStealStrategy s) |
| VoiceStealStrategy | steal_strategy () const |
| void | set_pitch_bend_range_semitones (float r) |
| | Pitch-bend range applied to channel-level pitch-bend messages.
|
| float | pitch_bend_range_semitones () const |
| void | note_on (uint8_t channel, uint8_t note, uint8_t velocity, int8_t priority=0, uint8_t voice_group=0, bool choke_group=false, float choke_fade_ms=0.0f) |
| | Direct event entry points — usable when the caller wants to build a Synthesiser pipeline without a full MidiBuffer.
|
| void | note_off (uint8_t channel, uint8_t note) |
| void | pitch_bend (uint8_t channel, float bend_semitones) |
| void | aftertouch (uint8_t channel, float pressure) |
| void | cc (uint8_t channel, uint8_t cc_number, uint8_t value) |
| void | process (const MidiBuffer &events, float *out, int num_samples) |
| | Drive the synth across one audio block.
|
| void | process (const MidiBuffer &events, float *out, int num_samples, const SynthesiserNoteOnPolicy ¬e_on_policy) |
| | Drive the synth with constant metadata applied to every note-on in the buffer.
|
template<typename PolicyFn>
requires std::is_invocable_r_v<SynthesiserNoteOnPolicy, PolicyFn&, uint8_t, uint8_t, uint8_t> |
| void | process (const MidiBuffer &events, float *out, int num_samples, PolicyFn &&policy_for_note) |
| | Drive the synth resolving note-on metadata per note rather than once per buffer.
|
| std::size_t | polyphony () const |
| Voice & | voice (std::size_t i) |
| const Voice & | voice (std::size_t i) const |
| std::size_t | active_count () const |
| std::size_t | releasing_count () const |
| std::uint64_t | steal_count () const |
| void | reset_steal_count () |
| SynthesiserTelemetry | telemetry () const |
| | Cheap owner-thread snapshot for voice-count telemetry.
|
| std::uint64_t | estimate_optional_runtime_cost () const |
| SynthesiserRuntimeBudgetReport | evaluate_optional_runtime_budget (runtime::RuntimeBudgetFrame &frame, runtime::RuntimeWorkLane lane=runtime::RuntimeWorkLane::Background, bool required=false) const |
| void | panic (bool immediate) |
| | Silence every voice.
|
| void | reset () |
template<typename Voice>
class pulp::midi::Synthesiser< Voice >
Polyphonic synth that routes plain-MIDI events into a pool of Voice instances.
Voice must derive from SynthesiserVoice.
template<typename Voice>
template<typename PolicyFn>
requires std::is_invocable_r_v<
SynthesiserNoteOnPolicy, PolicyFn&, uint8_t, uint8_t, uint8_t>
Drive the synth resolving note-on metadata per note rather than once per buffer.
policy_for_note(channel, note, velocity) returns the policy for that note-on.
One instrument holding several sounds — a drum kit, where each note is a different drum — needs policies that differ within a single block: a closed hat chokes the open hat on trigger while the kick beside it in the same block must not, and each pad retriggering itself is a distinct group. A per-buffer policy cannot express that.
The callback runs on the audio thread inside the event loop, so it must not allocate, lock, or block. It is a template parameter rather than a std::function precisely so the call inlines and never heap-allocates.