Skip to main content

decode_channel

Function decode_channel 

Source
pub fn decode_channel(
    status: u8,
    data: &[u8],
) -> Result<ChannelMessage, MidiError>
Expand description

Decode a channel message from its (status, data) wire bytes: the inverse of encode_channel.

The channel is taken from the low nibble of status and the message type from the high nibble. Each consumed data byte must be a valid 7-bit value (MidiError::InvalidU7); a status whose high nibble is not a channel-voice type yields MidiError::NotChannelStatus, and a data slice shorter than the message requires yields MidiError::TruncatedChannel. Pitch-bend’s two 7-bit data bytes are recombined into the 14-bit value.