pub struct SysExAssembler { /* private fields */ }Expand description
Stateful reassembler for UMP SysEx streams.
Maintains SYSEX_ASSEMBLER_SLOTS independent buffers, each
keyed by (group, stream_id), so hosts that interleave
SysEx traffic across UMP groups (or across SysEx-8 streams
within one group) don’t see corrupt concatenations.
Each slot’s buffer is bounded by the per-slot capacity passed
to Self::with_capacity; pushing past it returns
SysExFeed::Overflow and discards that slot’s partial
message - truncated SysEx is corrupt by definition.
Implementations§
Source§impl SysExAssembler
impl SysExAssembler
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Allocate per-slot buffers up front. capacity is the
largest SysEx payload (in bytes) per stream the
assembler will accept - total memory is
SYSEX_ASSEMBLER_SLOTS × capacity.
Matching capacity to the consuming
crate::events::EventList::sysex_pool_capacity is the
typical choice; smaller values trade memory for the
maximum single-message length.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Drop every in-progress message and free every slot. Call
between process() blocks when the host’s contract
guarantees no SysEx continues across the block boundary,
or on the first packet of a fresh session.
Sourcepub fn push_sysex7_packet(&mut self, words: [u32; 2]) -> SysExFeed<'_>
pub fn push_sysex7_packet(&mut self, words: [u32; 2]) -> SysExFeed<'_>
Feed one SysEx-7 UMP (words[0], words[1]). Group is
extracted from word 0 bits 27..24; stream_id is always 0
(the format reserves no slot for it).
Sourcepub fn push_sysex8_packet(&mut self, words: [u32; 4]) -> SysExFeed<'_>
pub fn push_sysex8_packet(&mut self, words: [u32; 4]) -> SysExFeed<'_>
Feed one SysEx-8 UMP (all four words). Group at word 0
bits 27..24; stream_id at word 0 bits 15..8 (SysEx-8
reserves one byte for a per-group stream identifier so
hosts can interleave concurrent SysEx payloads).