Add support for retrigger command

This commit is contained in:
Gwilym Inzani 2024-08-28 16:43:59 +01:00
parent 559367f607
commit 54a31934b2
4 changed files with 18 additions and 0 deletions

View file

@ -94,6 +94,7 @@ pub enum PatternEffect {
PitchBend(Num<u32, 8>),
Jump(Jump),
SampleOffset(u16),
Retrigger(u8),
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
@ -403,6 +404,7 @@ impl quote::ToTokens for PatternEffect {
quote! { Jump(#jump) }
}
PatternEffect::SampleOffset(offset) => quote! { SampleOffset(#offset) },
PatternEffect::Retrigger(ticks) => quote! { Retrigger(#ticks) },
};
tokens.append_all(quote! {

View file

@ -613,6 +613,11 @@ impl TrackerChannel {
self.current_pos = Some(*offset);
}
}
PatternEffect::Retrigger(ticks) => {
if tick % *ticks as u32 == 0 {
self.current_pos = Some(0);
}
}
}
}

View file

@ -439,6 +439,17 @@ pub fn parse_module(module: &Module) -> agb_tracker_interop::Track {
PatternEffect::GlobalVolumeSlide(Num::new(first as i32) / 0x40)
}
}
// R
0x1B => {
let first = effect_parameter >> 4;
let second = effect_parameter & 0xF;
if first != 0 {
eprintln!("Unsupported retrigger effect volume {first}");
}
PatternEffect::Retrigger(second)
}
e => {
let effect_char = char::from_digit(e as u32, 36)
.unwrap_or('?')

Binary file not shown.