[][src]Constant midi_consts::channel_event::EVENT_TYPE_MASK

pub const EVENT_TYPE_MASK: u8 = 0b1111_0000;

The first byte of a channel event contains both the event type and the midi channel in one byte. Use this bit mask to get the event type.

Example

use midi_consts::channel_event::EVENT_TYPE_MASK;
let byte: u8 = get_byte(); // Suppose we got this byte somewhere.
let event_type = byte & EVENT_TYPE_MASK; // (binary AND)
match event_type {
    EVENT_TYPE_NOTE_OFF => { /* ... */ },
    EVENT_TYPE_NOTE_ON => { /* ... */ },
    // ...
    _ => { /* ...*/ }
}