pub struct NoteOn {
pub channel: u8,
pub note: u8,
pub velocity: u8,
}Expand description
A MIDI 1.0 Note On message. A Note On with velocity == 0 is, by
convention, an implied Note Off (see NoteOn::is_effectively_note_off).
Fields§
§channel: u8MIDI channel, 0..=15.
note: u8Note number, 0..=127 (60 = middle C).
velocity: u8Attack velocity, 0..=127.
Implementations§
Source§impl NoteOn
impl NoteOn
Sourcepub fn new(channel: u8, note: u8, velocity: u8) -> Result<Self, AudioError>
pub fn new(channel: u8, note: u8, velocity: u8) -> Result<Self, AudioError>
Construct a validated Note On. Returns AudioError::InvalidParameter
if any field is out of range.
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, AudioError>
pub fn parse(bytes: &[u8]) -> Result<Self, AudioError>
Parse from a byte slice whose first byte is a Note On status.
Returns AudioError::UnsupportedFormat if the status nibble is not
0x9n, or AudioError::MalformedAudio if the slice is too short or a
data byte has its high bit set.
Sourcepub fn is_effectively_note_off(self) -> bool
pub fn is_effectively_note_off(self) -> bool
True if this is a running-status “note off” (velocity 0).
Trait Implementations§
impl Copy for NoteOn
impl Eq for NoteOn
impl StructuralPartialEq for NoteOn
Auto Trait Implementations§
impl Freeze for NoteOn
impl RefUnwindSafe for NoteOn
impl Send for NoteOn
impl Sync for NoteOn
impl Unpin for NoteOn
impl UnsafeUnpin for NoteOn
impl UnwindSafe for NoteOn
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