Skip to main content

parse_channel_voice

Function parse_channel_voice 

Source
pub fn parse_channel_voice(bytes: &[u8]) -> MidiResult<(ReadEvent, usize)>
Expand description

A channel message off the front of bytes, and how many bytes it took: music21’s MidiEvent.parseChannelVoiceMessage.

use music21::midi::base::{EventType, Param, parse_channel_voice};

let (event, used) = parse_channel_voice(&[0x92, 60, 120, b'h']).unwrap();
assert_eq!(event.event_type, EventType::ChannelVoice(0x90));
assert_eq!(event.channel, Some(3));
assert_eq!(event.parameter1, Param::Int(60));
assert_eq!(used, 3);