Expand description
Real-time MIDI buffering for the SIM music stack.
This crate provides fixed-capacity ring buffers that bridge real-time MIDI
I/O into the MidiSource/
MidiSink traits: RingMidiBuffer acts as
both source and sink, and RingTrackedMidiBuffer adds per-track tagging.
When a buffer is full the oldest event is dropped and counted, so a slow
consumer never blocks a real-time producer. The host-registered
MidiLiveLib publishes these buffers as runtime plugin rows.
§Examples
A ring buffer accepts written events and yields them back in order:
use sim_lib_midi_live::RingMidiBuffer;
use sim_lib_midi_core::{
MetaEvent, MidiEvent, MidiPayload, MidiSink, MidiSource, TickTime,
synthetic_origin,
};
let mut buffer = RingMidiBuffer::new(480, 4).unwrap();
let event = MidiEvent {
time: TickTime::new(0, 480).unwrap(),
origin: synthetic_origin(),
payload: MidiPayload::Meta(MetaEvent::EndOfTrack),
};
buffer.write(&event).unwrap();
assert_eq!(buffer.len(), 1);
assert_eq!(buffer.next().unwrap(), Some(event));Structs§
- Live
Midi Session - Public handle for an active live MIDI stream.
- Midi
Live Lib - Host-registered lib exposing the ring-buffer source/sink cards and their registry to a running runtime.
- Ring
Midi Buffer - A fixed-capacity ring buffer of
MidiEvents usable as both aMidiSourceand aMidiSink. - Ring
Tracked Midi Buffer - A fixed-capacity ring buffer of
TrackedMidiEvents usable as aTrackedMidiSource, tracking the highest track index seen.
Enums§
- Live
Midi Direction - Direction exposed by a live MIDI session.
- Live
Midi Error - Errors raised when constructing live MIDI buffers.
Functions§
- install_
midi_ live_ lib - Installs
MidiLiveLibintocxonce and registers the ring-buffer source, sink, and tracked-source export records.