[][src]Enum ghakuf::messages::Message

pub enum Message {
    MetaEvent {
        delta_time: u32,
        event: MetaEvent,
        data: Vec<u8>,
    },
    MidiEvent {
        delta_time: u32,
        event: MidiEvent,
    },
    SysExEvent {
        delta_time: u32,
        event: SysExEvent,
        data: Vec<u8>,
    },
    TrackChange,
}

An enum representing three SMF events and track change event.

Examples

use ghakuf::messages::{Message, MetaEvent};

let mut messages: Vec<Message> = Vec::new();
messages.push(Message::MetaEvent {
    delta_time: 0,
    event: MetaEvent::Lyric,
    data: b"aitakute_aitakute_furufuru".to_vec(),
});
messages.push(Message::TrackChange);

Variants

MetaEvent

Fields of MetaEvent

delta_time: u32event: MetaEventdata: Vec<u8>
MidiEvent

Fields of MidiEvent

delta_time: u32event: MidiEvent
SysExEvent

Fields of SysExEvent

delta_time: u32event: SysExEventdata: Vec<u8>
TrackChange

Implementations

impl Message[src]

pub fn binary(&self) -> Vec<u8>[src]

Returns binary array for SMF.

Examples

use ghakuf::messages::{Message, MidiEvent};

assert_eq!(
    Message::MidiEvent {
        delta_time: 0,
        event: MidiEvent::NoteOn { ch: 0x01, note: 0x3c, velocity: 0x7f }
    }.binary(),
   vec![0x00, 0x91, 0x3c, 0x7f]
);

pub fn len(&self) -> usize[src]

Return binary array length of message.

Examples

use ghakuf::messages::{Message, MetaEvent};

assert_eq!(
    Message::MetaEvent {
        delta_time: 0,
        event: MetaEvent::Lyric,
        data: b"aitanakatta_aitanakatta_no!".to_vec(),
    }.len(),
   31
);

Trait Implementations

impl Clone for Message[src]

impl Debug for Message[src]

impl Display for Message[src]

impl PartialEq<Message> for Message[src]

impl StructuralPartialEq for Message[src]

Auto Trait Implementations

impl RefUnwindSafe for Message

impl Send for Message

impl Sync for Message

impl Unpin for Message

impl UnwindSafe for Message

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.