use std::fmt::Debug;
use crate::prelude::*;
#[doc = r#"
An enumerationg of categories which may be
Track Messages fall into three categories:
- [`ChannelVoiceMessage`]: Notes, velocities, pedals, channel events.
- [`SystemExclusiveMessage`]: Inaudible events communicated between devices
- ['MetaMessage']: Identifiers for the track, like name, copyright information, arbitrary text.
"#]
#[derive(Clone, PartialEq, Eq)]
pub enum TrackMessage<'a> {
ChannelVoice(ChannelVoiceMessage),
SystemExclusive(SystemExclusiveMessage<'a>),
Meta(MetaMessage<'a>),
}
impl Debug for TrackMessage<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::ChannelVoice(c) => {
write!(f, "{:?}", c)
}
Self::SystemExclusive(s) => {
write!(f, "{:?}", s)
}
Self::Meta(m) => {
write!(f, "{:?}", m)
}
}
}
}
impl From<ChannelVoiceMessage> for TrackMessage<'_> {
fn from(value: ChannelVoiceMessage) -> Self {
Self::ChannelVoice(value)
}
}
impl<'a> From<SystemExclusiveMessage<'a>> for TrackMessage<'a> {
fn from(value: SystemExclusiveMessage<'a>) -> Self {
Self::SystemExclusive(value)
}
}
impl<'a> From<MetaMessage<'a>> for TrackMessage<'a> {
fn from(value: MetaMessage<'a>) -> Self {
Self::Meta(value)
}
}