Skip to main content

MetaEvent

Enum MetaEvent 

Source
pub enum MetaEvent {
    SequenceNumber(u16),
    TrackName(Vec<u8>),
    EndOfTrack,
    Tempo(u32),
    TimeSignature {
        numerator: u8,
        denominator_pow2: u8,
        clocks_per_click: u8,
        thirty_seconds_per_quarter: u8,
    },
    KeySignature {
        sharps: i8,
        minor: bool,
    },
    Unknown {
        meta_type: u8,
        data: Vec<u8>,
    },
}
Expand description

A parsed SMF meta-event payload.

Unknown carries any meta type this module does not decode structurally (text, marker, SMPTE offset, sequencer-specific, …) so serialization is byte-identical to the source.

Variants§

§

SequenceNumber(u16)

0x00 — optional 16-bit sequence number.

§

TrackName(Vec<u8>)

0x03 — track name (raw bytes; SMF text is not guaranteed UTF-8).

§

EndOfTrack

0x2F — end of track (zero-length).

§

Tempo(u32)

0x51 — tempo in microseconds per quarter note (24-bit range).

§

TimeSignature

0x58 — time signature.

Fields

§numerator: u8

Numerator, as written.

§denominator_pow2: u8

Denominator as a negative power of two (2 ⇒ 1/4). This is the raw SMF field, i.e. denominator = 2^value.

§clocks_per_click: u8

MIDI clocks per metronome click.

§thirty_seconds_per_quarter: u8

Number of notated 32nd-notes per MIDI quarter-note (usually 8).

§

KeySignature

0x59 — key signature.

Fields

§sharps: i8

Sharps (positive) / flats (negative), -7..=7.

§minor: bool

true for minor, false for major.

§

Unknown

Any other meta type, preserved verbatim.

Fields

§meta_type: u8
§data: Vec<u8>

Trait Implementations§

Source§

impl Clone for MetaEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MetaEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MetaEvent

Source§

impl PartialEq for MetaEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MetaEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.