NoteCut support

This commit is contained in:
Gwilym Inzani 2023-07-19 13:22:26 +01:00
parent a9236531c7
commit 1b8f4bbdc9
3 changed files with 12 additions and 0 deletions

View file

@ -48,6 +48,7 @@ pub enum PatternEffect {
Panning(Num<i16, 4>),
Volume(Num<i16, 4>),
VolumeSlide(Num<i16, 4>),
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! {

View file

@ -208,6 +208,12 @@ impl TrackerChannel {
channel.volume(self.volume);
}
}
PatternEffect::NoteCut(wait) => {
if tick == *wait {
channel.volume(0);
self.volume = 0.into();
}
}
}
}
}

View file

@ -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,
};