Skip to main content

midi_msg/system_exclusive/
show_control.rs

1use crate::parse_error::*;
2use alloc::vec::Vec;
3
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5#[derive(Debug, Clone, PartialEq, Eq)]
6/// A MIDI Show Control command.
7/// Used by [`UniversalRealTimeMsg::ShowControl`](crate::UniversalRealTimeMsg::ShowControl).
8///
9/// Unimplemented, though the `Unimplemented` value can be used to
10/// represent the commands not supported here.
11///
12/// As defined in MIDI Show Control 1.1.1 (RP002/RP014)
13pub enum ShowControlMsg {
14    /// Used to represent all unimplemented MSC messages.
15    /// Is inherently not guaranteed to be a valid message.
16    Unimplemented(Vec<u8>),
17}
18
19impl ShowControlMsg {
20    pub(crate) fn extend_midi(&self, v: &mut Vec<u8>) {
21        match self {
22            Self::Unimplemented(d) => v.extend_from_slice(d),
23        }
24    }
25
26    #[allow(dead_code)]
27    pub(crate) fn from_midi(_m: &[u8]) -> Result<(Self, usize), ParseError> {
28        Err(ParseError::NotImplemented("ShowControlMsg"))
29    }
30}
31
32#[cfg(test)]
33mod tests {
34    // use super::*;
35
36    #[test]
37    fn serialize_show_control_msg() {
38        // TODO
39    }
40}