pub struct RawShortMessage(_);
Expand description

A short message implemented as a tuple of bytes.

The struct’s size in memory is currently 3 bytes.

Example

use helgoboss_midi::{
    Channel, KeyNumber, MessageMainCategory, MessageSuperType, RawShortMessage, ShortMessage,
    ShortMessageFactory, ShortMessageType, U7,
};

let msg = RawShortMessage::note_on(Channel::new(5), KeyNumber::new(64), U7::new(123));
assert_eq!(core::mem::size_of_val(&msg), 3);
assert_eq!(msg.status_byte(), 149);
assert_eq!(msg.data_byte_1().get(), 64);
assert_eq!(msg.data_byte_2().get(), 123);
assert_eq!(msg.r#type(), ShortMessageType::NoteOn);
assert_eq!(msg.super_type(), MessageSuperType::ChannelVoice);
assert_eq!(msg.main_category(), MessageMainCategory::Channel);
assert_eq!(msg.channel(), Some(Channel::new(5)));
assert_eq!(msg.key_number(), Some(KeyNumber::new(64)));
assert_eq!(msg.velocity(), Some(U7::new(123)));
assert_eq!(msg.controller_number(), None);
assert_eq!(msg.control_value(), None);

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.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Returns the status byte.

Returns the first data byte.

Returns the second data byte.

Returns the status byte and the two data bytes as a tuple. Read more

Converts this message to a short message of another type.

Converts this message to a StructuredShortMessage, which is ideal for matching.

Returns the type of this message.

Returns the super type of this message.

Returns the main category of this message.

Returns whether this message is a note-on in a practical sense. That means, it also returns false if the message type is NoteOn but the velocity is zero. Read more

Returns whether this message is a note-off in a practical sense. That means, it also returns true if the message type is NoteOn but the velocity is zero. Read more

Returns whether this message is a note-on or note-off.

Returns the channel of this message if applicable.

Returns the key number of this message if applicable.

Returns the velocity of this message if applicable.

Returns the controller number of this message if applicable.

Returns the control value of this message if applicable.

Returns the program number of this message if applicable.

Returns the pressure amount of this message if applicable.

Returns the pitch bend value of this message if applicable.

Creates a MIDI message from the given bytes without checking the status byte. The tuple consists of the status byte, data byte 1 and data byte 2 in exactly this order. Read more

Creates a MIDI message from the given bytes. The tuple consists of the status byte, data byte 1 and data byte 2 in exactly this order. Read more

Creates this message from a MIDI message of another type.

Creates a Channel message. Read more

Creates a System Common message. Read more

Creates a System Real Time message. Read more

Creates a Note On message.

Creates a Note Off message.

Creates a Control Change message.

Creates a Program Change message.

Creates a Polyphonic Key Pressure message.

Creates a Channel Pressure message.

Creates a Pitch Bend Change message.

Creates the start of a System Exclusive message.

Creates a MIDI Time Code Quarter Frame message.

Creates a Song Position Pointer message.

Creates a Song Select message.

Creates a Tune Request message.

Creates the end of a System Exclusive message.

Creates a Timing Clock message.

Creates a Start message.

Creates a Continue message.

Creates a Stop message.

Creates an Active Sensing message.

Creates a System Reset message.

The type returned in the event of a conversion error.

Performs the conversion.

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.