Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::boundary::MpeSidecar Struct Reference

Owns the MPE tracker + expression buffer + inbound-offset cursor an adapter wraps around its MIDI decode, plus the descriptor opt-in flag. More...

#include <adapter_boundary.hpp>

Public Member Functions

 MpeSidecar ()=default
 MpeSidecar (const MpeSidecar &)=delete
MpeSidecar & operator= (const MpeSidecar &)=delete
 MpeSidecar (MpeSidecar &&)=delete
MpeSidecar & operator= (MpeSidecar &&)=delete
void configure (bool supports_mpe)
 Enable the sidecar per the descriptor opt-in and, when enabled, bind the tracker's callbacks to buffer / current_sample_offset.
void reserve (std::size_t event_capacity)
 Reserve the expression buffer to event_capacity and pin it to realtime-capacity mode so run() never allocates — one inbound MIDI event can fan out to several expression events (note-on + bend + pressure.
void reset () noexcept
 Drop adapter-owned per-note state so a re-activation / processor reset cannot route a stale noteId.
template<typename MidiRange>
bool run (Processor &processor, const MidiRange &midi_in)
 Per-block: when enabled, clear the buffer, run midi_in through the tracker (stamping each emitted expression event with its source event's sample_offset), and attach the buffer to processor for this process() call; when disabled, detach any previously-attached buffer.

Public Attributes

midi::MpeVoiceTracker tracker
midi::MpeBuffer buffer
std::int32_t current_sample_offset = 0
 Sample offset stamped onto every expression event the tracker emits for the MIDI event currently being processed; updated per event in run().
bool enabled = false
 Mirrors PluginDescriptor::effective_capabilities().supports_mpe.
bool expression_event_dropped = false
 Set by the bound expression callbacks when fixed storage is exhausted.

Detailed Description

Owns the MPE tracker + expression buffer + inbound-offset cursor an adapter wraps around its MIDI decode, plus the descriptor opt-in flag.

An adapter holds one as a direct member; each method runs on the thread named in its doc.

Non-movable by contract. configure() binds the tracker's callbacks to references into buffer and current_sample_offset; moving or copying the struct after that would leave those callbacks pointing at the old storage. Adapters embed it in an object that is itself never moved after construction, so copy/move are deleted to make the invariant a compile error rather than a silent dangling capture.

Constructor & Destructor Documentation

◆ MpeSidecar() [1/3]

pulp::format::boundary::MpeSidecar::MpeSidecar ( )
default

◆ MpeSidecar() [2/3]

pulp::format::boundary::MpeSidecar::MpeSidecar ( const MpeSidecar & )
delete

◆ MpeSidecar() [3/3]

pulp::format::boundary::MpeSidecar::MpeSidecar ( MpeSidecar && )
delete

Member Function Documentation

◆ configure()

void pulp::format::boundary::MpeSidecar::configure ( bool supports_mpe)
inline

Enable the sidecar per the descriptor opt-in and, when enabled, bind the tracker's callbacks to buffer / current_sample_offset.

Host-thread setup (init / after define_parameters()); never the audio thread. Call once per plugin instance.

◆ operator=() [1/2]

MpeSidecar & pulp::format::boundary::MpeSidecar::operator= ( const MpeSidecar & )
delete

◆ operator=() [2/2]

MpeSidecar & pulp::format::boundary::MpeSidecar::operator= ( MpeSidecar && )
delete

◆ reserve()

void pulp::format::boundary::MpeSidecar::reserve ( std::size_t event_capacity)
inline

Reserve the expression buffer to event_capacity and pin it to realtime-capacity mode so run() never allocates — one inbound MIDI event can fan out to several expression events (note-on + bend + pressure.

  • timbre). Off the audio thread (activate / setup).

◆ reset()

void pulp::format::boundary::MpeSidecar::reset ( )
inlinenoexcept

Drop adapter-owned per-note state so a re-activation / processor reset cannot route a stale noteId.

This deliberately cannot reset downstream voices: the generic sidecar has no knowledge of the processor's allocator. Deactivation adapters therefore call Processor::release() first, and a live reset is paired with ProcessContext::reset_requested so the processor clears its own DSP/voice state. Fixed-storage and audio-thread safe; performs no allocation and invokes no callbacks.

◆ run()

template<typename MidiRange>
bool pulp::format::boundary::MpeSidecar::run ( Processor & processor,
const MidiRange & midi_in )
inlinenodiscard

Per-block: when enabled, clear the buffer, run midi_in through the tracker (stamping each emitted expression event with its source event's sample_offset), and attach the buffer to processor for this process() call; when disabled, detach any previously-attached buffer.

midi_in must already be in the order the adapter wants the tracker to see (VST3 sorts its buffer first; CLAP and AU use host delivery order). Returns false after reconciling when the source stream or expression output could not be represented completely. Source incompleteness is rejected even when MPE is disabled. RT-safe provided reserve() ran off the audio thread.

Member Data Documentation

◆ buffer

midi::MpeBuffer pulp::format::boundary::MpeSidecar::buffer

◆ current_sample_offset

std::int32_t pulp::format::boundary::MpeSidecar::current_sample_offset = 0

Sample offset stamped onto every expression event the tracker emits for the MIDI event currently being processed; updated per event in run().

◆ enabled

bool pulp::format::boundary::MpeSidecar::enabled = false

◆ expression_event_dropped

bool pulp::format::boundary::MpeSidecar::expression_event_dropped = false

Set by the bound expression callbacks when fixed storage is exhausted.

◆ tracker

midi::MpeVoiceTracker pulp::format::boundary::MpeSidecar::tracker

The documentation for this struct was generated from the following file: