pub enum Effect { SetSpeed(u8), PosJump(u8), PattBreak(u8), PattLoopStart, PattLoop(u8), PattDelay(u8), SetTempo(u8), TempoSlideDown(u8), TempoSlideUp(u8), NoEffect } impl Effect { pub fn from_it_efx(f: (u8, u8)) -> Effect { let (efx, fxp) = f; match (efx as char, fxp) { ('A', _) => Effect::SetSpeed(fxp), ('B', _) => Effect::PosJump(fxp), ('C', _) => Effect::PattBreak(fxp), ('S', 0xb0) => Effect::PattLoopStart, ('S', _) if fxp & 0xf0 == 0xb0 => Effect::PattLoop(fxp & 0x0f), ('S', _) if fxp & 0xf0 == 0xe0 => Effect::PattDelay(fxp & 0x0f), ('T', _) if fxp & 0xf0 == 0x00 => Effect::TempoSlideDown(fxp & 0x0f), ('T', _) if fxp & 0xf0 == 0x10 => Effect::TempoSlideUp(fxp & 0x0f), ('T', _) => Effect::SetTempo(fxp), _ => Effect::NoEffect } } }