Struct rimd::MidiMessage
[−]
[src]
pub struct MidiMessage { pub data: Vec<u8>, }
Midi message building and parsing. See http://www.midi.org/techspecs/midimessages.php for a description of the various Midi messages that exist.
Fields
data |
Methods
impl MidiMessage
fn status(&self) -> Status
Return the status (type) of this message
fn channel(&self) -> u8
Return the channel this message is on (TODO: return 0 for messages with no channel)
fn data(&self, index: usize) -> u8
Get te data at index index
from this message. Status is at
index 0
fn from_bytes(bytes: Vec<u8>) -> MidiMessage
Create a midi message from a vector of bytes
fn next_message_given_status(stat: u8, reader: &mut Read) -> Result<MidiMessage, MidiError>
Get the next midi message from the reader given that the
status stat
has just been read
fn next_message_running_status(stat: u8, databyte: u8, reader: &mut Read) -> Result<MidiMessage, MidiError>
Get the next midi message from the reader given that there's a running
status of stat
and that in place of a status was read databyte
fn next_message(reader: &mut Read) -> Result<MidiMessage, MidiError>
Extract next midi message from a reader
fn note_on(note: u8, velocity: u8, channel: u8) -> MidiMessage
Create a note on message
fn note_off(note: u8, velocity: u8, channel: u8) -> MidiMessage
Create a note off message
fn polyphonic_aftertouch(note: u8, pressure: u8, channel: u8) -> MidiMessage
Create a polyphonic aftertouch message This message is most often sent by pressing down on the key after it "bottoms out".
fn control_change(controler: u8, data: u8, channel: u8) -> MidiMessage
Create a control change message This message is sent when a controller value changes. Controllers include devices such as pedals and levers. Controller numbers 120-127 are reserved as "Channel Mode Messages".
fn program_change(program: u8, channel: u8) -> MidiMessage
Create a program change message
This message sent when the patch number changes. program
is the new program number.
fn channel_aftertouch(pressure: u8, channel: u8) -> MidiMessage
Create a channel aftertouch
This message is most often sent by pressing down on the key after it "bottoms out". This message
is different from polyphonic after-touch. Use this message to send the single greatest pressure
value (of all the current depressed keys). pressure
is the pressure value.
fn pitch_bend(lsb: u8, msb: u8, channel: u8) -> MidiMessage
Create a pitch bench message
This message is sent to indicate a change in the pitch bender (wheel or lever, typically).
The pitch bender is measured by a fourteen bit value. Center (no pitch change) is 2000H.
Sensitivity is a function of the transmitter. lsb
are the least significant 7 bits.
msb
are the most significant 7 bits.