pub struct LiveMidiSession { /* private fields */ }Expand description
Public handle for an active live MIDI stream.
The handle owns the bounded live ring used by host callbacks. Callback-side
entry points enqueue into the ring only; evaluation code consumes the ring
through the MidiSource and MidiSink accessors.
Implementations§
Source§impl LiveMidiSession
impl LiveMidiSession
Sourcepub fn modeled(direction: LiveMidiDirection) -> Result<Self, LiveMidiError>
pub fn modeled(direction: LiveMidiDirection) -> Result<Self, LiveMidiError>
Creates a modeled session with the default MIDI tick resolution and ring capacity.
Sourcepub fn with_ring(
tpq: u32,
capacity: usize,
direction: LiveMidiDirection,
) -> Result<Self, LiveMidiError>
pub fn with_ring( tpq: u32, capacity: usize, direction: LiveMidiDirection, ) -> Result<Self, LiveMidiError>
Creates a session backed by a bounded ring buffer.
Sourcepub fn direction(&self) -> LiveMidiDirection
pub fn direction(&self) -> LiveMidiDirection
Returns the stream direction exposed by this session.
Sourcepub fn source_mut(&mut self) -> &mut dyn MidiSource<Err = Infallible>
pub fn source_mut(&mut self) -> &mut dyn MidiSource<Err = Infallible>
Returns the live source side.
Sourcepub fn sink_mut(&mut self) -> Option<&mut dyn MidiSink<Err = Infallible>>
pub fn sink_mut(&mut self) -> Option<&mut dyn MidiSink<Err = Infallible>>
Returns the live sink side when the session supports output.
Sourcepub fn enqueue_from_callback(
&mut self,
event: &MidiEvent,
) -> Result<(), Infallible>
pub fn enqueue_from_callback( &mut self, event: &MidiEvent, ) -> Result<(), Infallible>
Enqueues one event from a host callback into the bounded live ring.
Sourcepub fn close(self) -> Result<(), LiveMidiError>
pub fn close(self) -> Result<(), LiveMidiError>
Closes the session.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LiveMidiSession
impl RefUnwindSafe for LiveMidiSession
impl Send for LiveMidiSession
impl Sync for LiveMidiSession
impl Unpin for LiveMidiSession
impl UnsafeUnpin for LiveMidiSession
impl UnwindSafe for LiveMidiSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more