Enum tune::midi::ChannelMessageType
source · pub enum ChannelMessageType {
NoteOff {
key: u8,
velocity: u8,
},
NoteOn {
key: u8,
velocity: u8,
},
PolyphonicKeyPressure {
key: u8,
pressure: u8,
},
ControlChange {
controller: u8,
value: u8,
},
ProgramChange {
program: u8,
},
ChannelPressure {
pressure: u8,
},
PitchBendChange {
value: i16,
},
}
Expand description
A parsed representation of the channel-agnostic part of a MIDI message.
Variants§
Implementations§
source§impl ChannelMessageType
impl ChannelMessageType
sourcepub fn in_channel(self, channel: u8) -> Option<ChannelMessage>
pub fn in_channel(self, channel: u8) -> Option<ChannelMessage>
Creates a new ChannelMessage
from self
with the given channel
.
None
is returned if the channel value is outside the range [0..16).
Examples
let message_type = ChannelMessageType::NoteOn {
key: 77,
velocity: 88
};
let message = message_type.in_channel(15).unwrap();
assert_eq!(message.channel(), 15);
assert_eq!(message.message_type(), message_type);
let channel_out_of_range = message_type.in_channel(16);
assert!(channel_out_of_range.is_none());
Trait Implementations§
source§impl Clone for ChannelMessageType
impl Clone for ChannelMessageType
source§fn clone(&self) -> ChannelMessageType
fn clone(&self) -> ChannelMessageType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ChannelMessageType
impl Debug for ChannelMessageType
source§impl PartialEq for ChannelMessageType
impl PartialEq for ChannelMessageType
source§fn eq(&self, other: &ChannelMessageType) -> bool
fn eq(&self, other: &ChannelMessageType) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for ChannelMessageType
impl Eq for ChannelMessageType
impl StructuralEq for ChannelMessageType
impl StructuralPartialEq for ChannelMessageType
Auto Trait Implementations§
impl RefUnwindSafe for ChannelMessageType
impl Send for ChannelMessageType
impl Sync for ChannelMessageType
impl Unpin for ChannelMessageType
impl UnwindSafe for ChannelMessageType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more