mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-22 15:16:40 +11:00
Add note delay support (effect EDx)
This commit is contained in:
parent
c099fc9a61
commit
2e0f89978a
3 changed files with 12 additions and 0 deletions
|
@ -62,6 +62,7 @@ pub enum PatternEffect {
|
||||||
VolumeSlide(Num<i16, 8>),
|
VolumeSlide(Num<i16, 8>),
|
||||||
FineVolumeSlide(Num<i16, 8>),
|
FineVolumeSlide(Num<i16, 8>),
|
||||||
NoteCut(u32),
|
NoteCut(u32),
|
||||||
|
NoteDelay(u32),
|
||||||
Portamento(Num<u16, 12>),
|
Portamento(Num<u16, 12>),
|
||||||
/// Slide each tick the first amount to at most the second amount
|
/// Slide each tick the first amount to at most the second amount
|
||||||
TonePortamento(Num<u16, 12>, Num<u16, 12>),
|
TonePortamento(Num<u16, 12>, Num<u16, 12>),
|
||||||
|
@ -289,6 +290,7 @@ impl quote::ToTokens for PatternEffect {
|
||||||
quote! { FineVolumeSlide(agb_tracker::__private::Num::from_raw(#amount))}
|
quote! { FineVolumeSlide(agb_tracker::__private::Num::from_raw(#amount))}
|
||||||
}
|
}
|
||||||
PatternEffect::NoteCut(wait) => quote! { NoteCut(#wait) },
|
PatternEffect::NoteCut(wait) => quote! { NoteCut(#wait) },
|
||||||
|
PatternEffect::NoteDelay(wait) => quote! { NoteDelay(#wait) },
|
||||||
PatternEffect::Portamento(amount) => {
|
PatternEffect::Portamento(amount) => {
|
||||||
let amount = amount.to_raw();
|
let amount = amount.to_raw();
|
||||||
quote! { Portamento(agb_tracker::__private::Num::from_raw(#amount))}
|
quote! { Portamento(agb_tracker::__private::Num::from_raw(#amount))}
|
||||||
|
|
|
@ -405,6 +405,15 @@ impl TrackerChannel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PatternEffect::NoteDelay(wait) => {
|
||||||
|
if tick <= *wait {
|
||||||
|
channel.volume(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if tick == *wait + 1 {
|
||||||
|
channel.volume((self.volume * global_settings.volume).try_change_base().unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
PatternEffect::Portamento(amount) => {
|
PatternEffect::Portamento(amount) => {
|
||||||
if tick != 0 {
|
if tick != 0 {
|
||||||
self.base_speed *= amount.change_base();
|
self.base_speed *= amount.change_base();
|
||||||
|
|
|
@ -347,6 +347,7 @@ pub fn parse_module(module: &Module) -> TokenStream {
|
||||||
-Num::new((slot.effect_parameter & 0xf) as i16) / 128,
|
-Num::new((slot.effect_parameter & 0xf) as i16) / 128,
|
||||||
),
|
),
|
||||||
0xC => PatternEffect::NoteCut((slot.effect_parameter & 0xf).into()),
|
0xC => PatternEffect::NoteCut((slot.effect_parameter & 0xf).into()),
|
||||||
|
0xD => PatternEffect::NoteDelay((slot.effect_parameter & 0xf).into()),
|
||||||
_ => PatternEffect::None,
|
_ => PatternEffect::None,
|
||||||
},
|
},
|
||||||
0xF => match slot.effect_parameter {
|
0xF => match slot.effect_parameter {
|
||||||
|
|
Loading…
Add table
Reference in a new issue