Enum midly::TrackEventKind
source · pub enum TrackEventKind<'a> {
Midi {
channel: u4,
message: MidiMessage,
},
SysEx(&'a [u8]),
Escape(&'a [u8]),
Meta(MetaMessage<'a>),
}
Expand description
Represents the different kinds of SMF events and their associated data.
It notably does not include the timing of the event; the TrackEvent
struct is responsible
for this.
Variants§
Midi
Fields
message: MidiMessage
The MIDI message type and associated data.
A message associated to a MIDI channel carrying musical data.
Usually, the bulk of MIDI data is these kind of messages.
SysEx(&'a [u8])
A System Exclusive message, carrying arbitrary data.
The data bytes included here do not include the implicit 0xF0
prefix.
Usually SysEx events end with an 0xF7
byte, but SysEx events that are split into several
small packets may only contain the 0xF7
byte in the last packet fragment.
Escape(&'a [u8])
An escape sequence, intended to send arbitrary data to the MIDI synthesizer.
Meta(MetaMessage<'a>)
A meta-message, giving extra information for correct playback, like tempo, song name, lyrics, etc…
Implementations§
source§impl<'a> TrackEventKind<'a>
impl<'a> TrackEventKind<'a>
sourcepub fn as_live_event(&self) -> Option<LiveEvent<'a>>
pub fn as_live_event(&self) -> Option<LiveEvent<'a>>
Lossy conversion from a track event to a live event.
Only channel MIDI messages and not-split SysEx messages can be converted.
Meta messages and arbitrary escapes yield None
when converted.
sourcepub fn to_static(&self) -> TrackEventKind<'static>
pub fn to_static(&self) -> TrackEventKind<'static>
Remove any lifetimed data from this event to create a TrackEventKind
with 'static
lifetime that can be stored and moved everywhere, solving borrow checker issues.
WARNING: Any bytestrings in the input will be replaced by empty bytestrings.
Trait Implementations§
source§impl<'a> Clone for TrackEventKind<'a>
impl<'a> Clone for TrackEventKind<'a>
source§fn clone(&self) -> TrackEventKind<'a>
fn clone(&self) -> TrackEventKind<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for TrackEventKind<'a>
impl<'a> Debug for TrackEventKind<'a>
source§impl<'a> Hash for TrackEventKind<'a>
impl<'a> Hash for TrackEventKind<'a>
source§impl<'a> PartialEq<TrackEventKind<'a>> for TrackEventKind<'a>
impl<'a> PartialEq<TrackEventKind<'a>> for TrackEventKind<'a>
source§fn eq(&self, other: &TrackEventKind<'a>) -> bool
fn eq(&self, other: &TrackEventKind<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.