pub struct ControlChange14BitMessage { /* private fields */ }
Expand description

A 14-bit MIDI Control Change message.

Unlike a ShortMessage of type ShortMessageType::ControlChange, this one supports 14-bit resolution, that means 16384 different values instead of only 128. MIDI systems emit those by sending 2 short Control Change messages in a row. The ControlChange14BitMessageScanner can be used to extract such messages from a stream of ShortMessages.

Example

use helgoboss_midi::{
    controller_numbers, Channel, ControlChange14BitMessage, RawShortMessage, U14,
};

let msg = ControlChange14BitMessage::new(
    Channel::new(5),
    controller_numbers::CHANNEL_VOLUME,
    U14::new(1057),
);
assert_eq!(msg.channel().get(), 5);
assert_eq!(msg.msb_controller_number().get(), 7);
assert_eq!(
    msg.lsb_controller_number(),
    controller_numbers::CHANNEL_VOLUME_LSB
);
use helgoboss_midi::test_util::control_change;
assert_eq!(msg.value().get(), 1057);
let short_messages: [RawShortMessage; 2] = msg.to_short_messages();
assert_eq!(
    short_messages,
    [control_change(5, 7, 8), control_change(5, 39, 33)]
);

Implementations

Creates a 14-bit Control Change message.

Panics

This function panics if msb_controller_number can’t serve as controller number for transmitting the most significant byte of a 14-bit Control Change message.

Returns the channel of this message.

Returns the controller number for transmitting the most significant byte of this message.

Returns the controller number for transmitting the least significant byte of this message.

Returns the 14-bit value of this message.

Translates this message into 2 short messages, which need to be sent in a row in order to encode this 14-bit Control Change message.

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 !=.

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.