From 1b8f4bbdc92d42cf332845bf816333f6bad37e6e Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 19 Jul 2023 13:22:26 +0100 Subject: [PATCH] NoteCut support --- tracker/agb-tracker-interop/src/lib.rs | 2 ++ tracker/agb-tracker/src/lib.rs | 6 ++++++ tracker/agb-xm-core/src/lib.rs | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/tracker/agb-tracker-interop/src/lib.rs b/tracker/agb-tracker-interop/src/lib.rs index d165d612..d2c92533 100644 --- a/tracker/agb-tracker-interop/src/lib.rs +++ b/tracker/agb-tracker-interop/src/lib.rs @@ -48,6 +48,7 @@ pub enum PatternEffect { Panning(Num), Volume(Num), VolumeSlide(Num), + NoteCut(u32), } #[cfg(feature = "quote")] @@ -202,6 +203,7 @@ impl quote::ToTokens for PatternEffect { let amount = amount.to_raw(); quote! { VolumeSlide(agb_tracker::__private::Num::from_raw(#amount))} } + PatternEffect::NoteCut(wait) => quote! { NoteCut(#wait) }, }; tokens.append_all(quote! { diff --git a/tracker/agb-tracker/src/lib.rs b/tracker/agb-tracker/src/lib.rs index f3c1b4c9..79875f2b 100644 --- a/tracker/agb-tracker/src/lib.rs +++ b/tracker/agb-tracker/src/lib.rs @@ -208,6 +208,12 @@ impl TrackerChannel { channel.volume(self.volume); } } + PatternEffect::NoteCut(wait) => { + if tick == *wait { + channel.volume(0); + self.volume = 0.into(); + } + } } } } diff --git a/tracker/agb-xm-core/src/lib.rs b/tracker/agb-xm-core/src/lib.rs index da3fc4f8..dcf343a0 100644 --- a/tracker/agb-xm-core/src/lib.rs +++ b/tracker/agb-xm-core/src/lib.rs @@ -219,6 +219,10 @@ pub fn parse_module(module: &Module) -> TokenStream { PatternEffect::None } } + 0xE => match slot.effect_parameter >> 4 { + 0xC => PatternEffect::NoteCut((slot.effect_parameter & 0xf).into()), + _ => PatternEffect::None, + }, _ => PatternEffect::None, };