pub struct SysExOutputPool { /* private fields */ }Expand description
Pre-allocated pool for SysEx output messages.
Avoids heap allocation during audio processing by pre-allocating a fixed number of buffer slots at initialization time.
Implementations§
Source§impl SysExOutputPool
impl SysExOutputPool
Sourcepub const DEFAULT_SLOTS: usize = 16
pub const DEFAULT_SLOTS: usize = 16
Default number of SysEx slots per process block.
Sourcepub const DEFAULT_BUFFER_SIZE: usize = 512
pub const DEFAULT_BUFFER_SIZE: usize = 512
Default maximum size per SysEx message.
Sourcepub fn with_capacity(slots: usize, buffer_size: usize) -> Self
pub fn with_capacity(slots: usize, buffer_size: usize) -> Self
Create a new pool with the specified capacity.
Pre-allocates all buffers to avoid heap allocation during process().
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear the pool for reuse. O(1) operation.
Note: This does NOT clear the fallback buffer, which is drained separately at the start of the next process block.
Sourcepub fn allocate(&mut self, data: &[u8]) -> Option<(*const u8, usize)>
pub fn allocate(&mut self, data: &[u8]) -> Option<(*const u8, usize)>
Allocate a slot and copy SysEx data into it.
Returns Some((pointer, length)) on success, None if pool exhausted.
The pointer is stable until clear() is called.
Sets the overflow flag when the pool is exhausted.
With sysex-heap-fallback feature: overflow messages are stored in a
heap-backed fallback buffer instead of being dropped.
Sourcepub fn allocate_slice(&mut self, data: &[u8]) -> Option<&[u8]>
pub fn allocate_slice(&mut self, data: &[u8]) -> Option<&[u8]>
Allocate and return a slice reference instead of raw pointer.
Safer API for contexts that don’t need raw pointers.
Sourcepub fn has_overflowed(&self) -> bool
pub fn has_overflowed(&self) -> bool
Check if the pool overflowed during this block.