Skip to main content

SysExAssembler

Struct SysExAssembler 

Source
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

Source

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.

Source

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.

Source

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).

Source

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).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.