pub enum MidiMsg {
    ChannelVoice {
        channel: Channel,
        msg: ChannelVoiceMsg,
    },
    RunningChannelVoice {
        channel: Channel,
        msg: ChannelVoiceMsg,
    },
    ChannelMode {
        channel: Channel,
        msg: ChannelModeMsg,
    },
    RunningChannelMode {
        channel: Channel,
        msg: ChannelModeMsg,
    },
    SystemCommon {
        msg: SystemCommonMsg,
    },
    SystemRealTime {
        msg: SystemRealTimeMsg,
    },
    SystemExclusive {
        msg: SystemExclusiveMsg,
    },
}
Expand description

The primary interface of this library. Used to encode MIDI messages.

Variants

ChannelVoice

Fields

channel: Channel

Channel-level messages that act on a voice, such as turning notes on and off.

RunningChannelVoice

Fields

channel: Channel

Like ChannelVoice, but with the first “status” byte of the message omitted. When these “running status” messages are sent, the receiver must treat them as implicitly referring to the previous “status” received.

For instance, if a ChannelVoiceMsg::NoteOn message is received, and then the next message does not contain a status byte, it implicitly refers to a ChannelVoiceMsg::NoteOn.

ChannelMode

Fields

channel: Channel

Channel-level messages that should alter the mode of the receiver.

RunningChannelMode

Fields

channel: Channel

Like RunningChannelVoice but for ChannelMode

SystemCommon

Fields

A fairly limited set of messages, generally for device synchronization.

SystemRealTime

Fields

Another limited set of messages used for device synchronization.

SystemExclusive

Fields

The bulk of the MIDI spec lives here, in “Universal System Exclusive” messages. Also the home of manufacturer-specific messages.

Implementations

Turn a MidiMsg into a series of bytes.

Turn a series of bytes into a MidiMsg.

Ok results return a MidiMsg and the number of bytes consumed from the input.

Turn a series of bytes into a MidiMsg, given a ReceiverContext.

Consecutive messages that relate to each other will be collapsed into one MidiMsg. E.g. a ChannelVoiceMsg::ControlChange where the CC is the MSB and LSB of ControlChange::Volume will turn into a single ControlChange::Volume with both bytes turned into one. Use MidiMsg::from_midi_with_context_no_extensions to disable this behavior.

The ReceiverContext is also used to track the current TimeCode as sent through SystemCommonMsg::TimeCodeQuarterFrame messages, or UniversalRealTimeMsg::TimeCodeFull messages.

Ok results return a MidiMsg and the number of bytes consumed from the input.

Like MidiMsg::from_midi_with_context but does not turn multiple related consecutive messages into one MidiMsg.

Turn a set of MidiMsgs into a series of bytes, with fewer allocations than repeatedly concatenating the results of to_midi.

Given a Vec<u8>, append this MidiMsg to it.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.