Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::midi::SysexAccumulator Class Reference

#include <sysex_accumulator.hpp>

Public Types

enum class  Classification { in_sysex , completed , aborted , passthrough }
 Feed a single byte through the state machine. More...

Public Member Functions

void reserve (std::size_t worst_case_bytes)
 Prepare internal payload storage for realtime use.
Classification feed (std::uint8_t byte, const SysexEmitFn &emit)
void feed (const std::uint8_t *data, std::size_t count, const SysexEmitFn &emit)
 Feed a run of bytes — convenience over a delivery boundary.
bool in_progress () const noexcept
 True when buffer_ holds an open F0 without a matching F7.
void reset () noexcept
 Clear any accumulated partial state.
std::size_t partial_size () const noexcept
 Size of the in-progress payload (0 when idle).

Member Enumeration Documentation

◆ Classification

Feed a single byte through the state machine.

Invokes emit when a complete or aborted SysEx is assembled. Realtime bytes (0xF8-0xFE) pass through without affecting state — they should be handled as independent short messages by the caller.

Returns the classification of the byte just consumed:

  • in_sysex: byte was buffered, no emit.
  • completed: SysEx just closed on F7; emit fired with complete=true.
  • aborted: SysEx interrupted by new non-F7 status; emit fired with complete=false and the aborter byte is NOT yet consumed — feed it again as a fresh status to let the caller route it normally.
  • passthrough: byte is outside a SysEx (or was a realtime byte) and should be handled by the caller's regular short-message path.
Enumerator
in_sysex 
completed 
aborted 
passthrough 

Member Function Documentation

◆ feed() [1/2]

void pulp::midi::SysexAccumulator::feed ( const std::uint8_t * data,
std::size_t count,
const SysexEmitFn & emit )
inline

Feed a run of bytes — convenience over a delivery boundary.

Handles the aborted-byte reclassification automatically.

◆ feed() [2/2]

Classification pulp::midi::SysexAccumulator::feed ( std::uint8_t byte,
const SysexEmitFn & emit )
inline

◆ in_progress()

bool pulp::midi::SysexAccumulator::in_progress ( ) const
inlinenoexcept

True when buffer_ holds an open F0 without a matching F7.

◆ partial_size()

std::size_t pulp::midi::SysexAccumulator::partial_size ( ) const
inlinenoexcept

Size of the in-progress payload (0 when idle).

Includes the leading 0xF0 byte.

◆ reserve()

void pulp::midi::SysexAccumulator::reserve ( std::size_t worst_case_bytes)
inline

Prepare internal payload storage for realtime use.

worst_case_bytes includes the leading F0 and trailing F7 bytes.

◆ reset()

void pulp::midi::SysexAccumulator::reset ( )
inlinenoexcept

Clear any accumulated partial state.

Intended for port-close or shutdown paths — drops any partially-received message.


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