Struct midly::stream::MidiStream
source · pub struct MidiStream<B = DefaultBuffer> { /* private fields */ }
Expand description
A streaming raw MIDI parser.
This parser takes raw MIDI, not .midi
files!
Read the module documentation for more info.
Implementations§
source§impl MidiStream
impl MidiStream
sourcepub fn new() -> MidiStream
pub fn new() -> MidiStream
Create a new clean midi stream with the default buffer size.
source§impl<B: Buffer> MidiStream<B>
impl<B: Buffer> MidiStream<B>
sourcepub fn with_buffer(buf: B) -> MidiStream<B>
pub fn with_buffer(buf: B) -> MidiStream<B>
Create a new clean midi stream using the given data buffer.
sourcepub fn feed(&mut self, bytes: &[u8], handle_ev: impl FnMut(LiveEvent<'_>))
pub fn feed(&mut self, bytes: &[u8], handle_ev: impl FnMut(LiveEvent<'_>))
Feeds a slice of bytes to the stream, calling the handle_ev
closure whenever a complete
event is read.
Calling feed
with many small slices is equivalent to calling feed
with one large
concatenation of them all.
Note that some calls to feed
might produce no events, and others may produce as many as
the amount of bytes fed in.
Trait Implementations§
source§impl<B: Clone> Clone for MidiStream<B>
impl<B: Clone> Clone for MidiStream<B>
source§fn clone(&self) -> MidiStream<B>
fn clone(&self) -> MidiStream<B>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<B: Debug> Debug for MidiStream<B>
impl<B: Debug> Debug for MidiStream<B>
source§impl<B: Default> Default for MidiStream<B>
impl<B: Default> Default for MidiStream<B>
source§fn default() -> MidiStream<B>
fn default() -> MidiStream<B>
Returns the “default value” for a type. Read more