Struct rimd::MetaEvent [] [src]

pub struct MetaEvent {
    pub command: MetaCommand,
    pub length: u64,
    pub data: Vec<u8>,
}

Meta event building and parsing. See http://cs.fit.edu/~ryan/cse4051/projects/midi/midi.html#meta_event for a description of the various meta events and their formats

Fields

command
length
data

Methods

impl MetaEvent

fn data_as_u64(&self, bytes: usize) -> u64

Turn bytes bytes of the data of this event into a u64

fn data_as_text(&self) -> Result<String, FromUtf8Error>

Parse the data of this event into a utf8 string

fn next_event(reader: &mut Read) -> Result<MetaEvent, MetaError>

Extract the next meta event from a reader

fn sequence_number(sequence_number: u16) -> MetaEvent

Create a sequence number meta event

fn text_event(text: String) -> MetaEvent

Create a text meta event

fn copyright_notice(copyright: String) -> MetaEvent

Create a copyright notice meta event

fn sequence_or_track_name(name: String) -> MetaEvent

Create a name meta event

fn instrument_name(name: String) -> MetaEvent

Create an instrument name meta event

fn lyric_text(text: String) -> MetaEvent

Create a lyric text meta event

fn marker_text(text: String) -> MetaEvent

Create a marker text meta event

fn cue_point(text: String) -> MetaEvent

Create a cue point meta event

fn midichannel_prefix_assignment(channel: u8) -> MetaEvent

Create a midi channel prefix assignment meta event

fn midiport_prefix_assignment(port: u8) -> MetaEvent

Create a midi port prefix assignment meta event

fn end_of_track() -> MetaEvent

Create an end of track meta event

fn tempo_setting(tempo: u32) -> MetaEvent

Create an event to set track tempo. This is stored as a 24-bit value. This method will fail an assertion if the supplied tempo is greater than 224.

fn smpte_offset(hours: u8, minutes: u8, seconds: u8, frames: u8, fractional: u8) -> MetaEvent

Create an smpte offset meta event

fn time_signature(numerator: u8, denominator: u8, clocks_per_tick: u8, num_32nd_notes_per_24_clocks: u8) -> MetaEvent

Create a time signature event. Time signature of the form: numerator/2denominator eg: 6/8 would be specified using numerator=6, denominator=3

The parameter clocks_per_tick is the number of MIDI Clocks per metronome tick. Normally, there are 24 MIDI Clocks per quarter note. However, some software allows this to be set by the user. The parameter num_32nd_notes_per_24_clocks defines this in terms of the number of 1/32 notes which make up the usual 24 MIDI Clocks (the 'standard' quarter note). 8 is standard

fn key_signature(sharps_flats: u8, major_minor: u8) -> MetaEvent

Create a Key Signature event expressed as the number of sharps or flats, and a major/minor flag. sharps_flats of 0 represents a key of C, negative numbers represent 'flats', while positive numbers represent 'sharps'.

fn sequencer_specific_event(data: Vec<u8>) -> MetaEvent

This is the MIDI-file equivalent of the System Exclusive Message. sequencer-specific directives can be incorporated into a MIDI file using this event.

Trait Implementations

impl Clone for MetaEvent

fn clone(&self) -> MetaEvent

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

impl Display for MetaEvent

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

Derived Implementations

impl Debug for MetaEvent

fn fmt(&self, __arg_0: &mut Formatter) -> Result