Enum midly::MetaMessage
source · pub enum MetaMessage<'a> {
Show 19 variants
TrackNumber(Option<u16>),
Text(&'a [u8]),
Copyright(&'a [u8]),
TrackName(&'a [u8]),
InstrumentName(&'a [u8]),
Lyric(&'a [u8]),
Marker(&'a [u8]),
CuePoint(&'a [u8]),
ProgramName(&'a [u8]),
DeviceName(&'a [u8]),
MidiChannel(u4),
MidiPort(u7),
EndOfTrack,
Tempo(u24),
SmpteOffset(SmpteTime),
TimeSignature(u8, u8, u8, u8),
KeySignature(i8, bool),
SequencerSpecific(&'a [u8]),
Unknown(u8, &'a [u8]),
}
Expand description
A “meta message”, as defined by the SMF spec. These events carry metadata about the track, such as tempo, time signature, copyright, etc…
Variants§
TrackNumber(Option<u16>)
For Format::Sequential
MIDI file types, TrackNumber
can be empty, and defaults to
the track index.
Text(&'a [u8])
Arbitrary text associated to an instant.
Copyright(&'a [u8])
A copyright notice.
TrackName(&'a [u8])
Information about the name of the track.
InstrumentName(&'a [u8])
Information about the name of the current instrument.
Lyric(&'a [u8])
Arbitrary lyric information associated to an instant.
Marker(&'a [u8])
Arbitrary marker text associated to an instant.
CuePoint(&'a [u8])
Arbitrary cue point text associated to an instant.
ProgramName(&'a [u8])
Information about the name of the current program.
DeviceName(&'a [u8])
Name of the device that this file was intended to be played with.
MidiChannel(u4)
Number of the MIDI channel that this file was intended to be played with.
MidiPort(u7)
Number of the MIDI port that this file was intended to be played with.
EndOfTrack
Obligatory at track end.
Tempo(u24)
Amount of microseconds per beat (quarter note).
Usually appears at the beggining of a track, before any midi events are sent, but there are no guarantees.
SmpteOffset(SmpteTime)
The MIDI SMPTE offset meta message specifies an offset for the starting point of a MIDI track from the start of a sequence in terms of SMPTE time (hours:minutes:seconds:frames:subframes).
TimeSignature(u8, u8, u8, u8)
In order of the MIDI specification, numerator, denominator, MIDI clocks per click, 32nd notes per quarter
KeySignature(i8, bool)
As in the MIDI specification, negative numbers indicate number of flats and positive
numbers indicate number of sharps.
false
indicates a major scale, true
indicates a minor scale.
SequencerSpecific(&'a [u8])
Arbitrary data intended for the sequencer. This data is never sent to a device.
Unknown(u8, &'a [u8])
An unknown or malformed meta-message.
The first u8
is the raw meta-message identifier byte.
The slice is the actual payload of the meta-message.
Implementations§
source§impl<'a> MetaMessage<'a>
impl<'a> MetaMessage<'a>
sourcepub fn to_static(&self) -> MetaMessage<'static>
pub fn to_static(&self) -> MetaMessage<'static>
Remove any lifetimed data from this event to create a MidiMessage
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 MetaMessage<'a>
impl<'a> Clone for MetaMessage<'a>
source§fn clone(&self) -> MetaMessage<'a>
fn clone(&self) -> MetaMessage<'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 MetaMessage<'a>
impl<'a> Debug for MetaMessage<'a>
source§impl<'a> Hash for MetaMessage<'a>
impl<'a> Hash for MetaMessage<'a>
source§impl<'a> PartialEq<MetaMessage<'a>> for MetaMessage<'a>
impl<'a> PartialEq<MetaMessage<'a>> for MetaMessage<'a>
source§fn eq(&self, other: &MetaMessage<'a>) -> bool
fn eq(&self, other: &MetaMessage<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.