pub struct MidiEvent {
pub source: EventSource,
pub data: Vec<u8>,
}
Expand description
A MIDI message event.
Fields§
§source: EventSource
The client identifier. Also unique per MIDI input device.
data: Vec<u8>
The binary MIDI message.
The first byte is a status byte (first/most significant bit = 1), the remaining bytes are data bytes (first/most significant bit = 0).
To give a simple example, pressing C5 on a MIDI keyboard would generate the following message:
[0x90, 0x48, 0x64]
Ch.1 Note 72 Velocity 100
NoteOn i.e. C5
The note values can be looked up online:
- https://www.phys.unsw.edu.au/jw/notes.html
Same goes for a full description of the packet structure:
- https://www.w3.org/TR/webmidi/#terminology
- http://www.opensound.com/pguide/midi/midi5.html
- https://www.songstuff.com/recording/article/midi-message-format/
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MidiEvent
impl<'de> Deserialize<'de> for MidiEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for MidiEvent
Auto Trait Implementations§
impl Freeze for MidiEvent
impl RefUnwindSafe for MidiEvent
impl Send for MidiEvent
impl Sync for MidiEvent
impl Unpin for MidiEvent
impl UnwindSafe for MidiEvent
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