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
A message associated to a MIDI channel carrying musical data.
Usually, the bulk of MIDI data is these kind of messages.
Fields
message: MidiMessage
The MIDI message type and associated data.
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§const fn clone_from(&mut self, source: &Self)
const 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 for TrackEventKind<'a>
impl<'a> PartialEq for TrackEventKind<'a>
impl<'a> Copy for TrackEventKind<'a>
impl<'a> Eq for TrackEventKind<'a>
impl<'a> StructuralPartialEq for TrackEventKind<'a>
Auto Trait Implementations§
impl<'a> Freeze for TrackEventKind<'a>
impl<'a> RefUnwindSafe for TrackEventKind<'a>
impl<'a> Send for TrackEventKind<'a>
impl<'a> Sync for TrackEventKind<'a>
impl<'a> Unpin for TrackEventKind<'a>
impl<'a> UnwindSafe for TrackEventKind<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more