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 ShortMessage
s.
§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§
Source§impl ControlChange14BitMessage
impl ControlChange14BitMessage
Sourcepub fn new(
channel: Channel,
msb_controller_number: ControllerNumber,
value: U14,
) -> ControlChange14BitMessage
pub fn new( channel: Channel, msb_controller_number: ControllerNumber, value: U14, ) -> ControlChange14BitMessage
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.
Sourcepub fn msb_controller_number(&self) -> ControllerNumber
pub fn msb_controller_number(&self) -> ControllerNumber
Returns the controller number for transmitting the most significant byte of this message.
Sourcepub fn lsb_controller_number(&self) -> ControllerNumber
pub fn lsb_controller_number(&self) -> ControllerNumber
Returns the controller number for transmitting the least significant byte of this message.
Sourcepub fn to_short_messages<T: ShortMessageFactory>(&self) -> [T; 2]
pub fn to_short_messages<T: ShortMessageFactory>(&self) -> [T; 2]
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§
Source§impl Clone for ControlChange14BitMessage
impl Clone for ControlChange14BitMessage
Source§fn clone(&self) -> ControlChange14BitMessage
fn clone(&self) -> ControlChange14BitMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more