mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Reduce size of pattern by 4 bytes per slot
This commit is contained in:
parent
515bcb13ca
commit
652173c08e
|
@ -29,8 +29,8 @@ pub struct Pattern {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct PatternSlot {
|
||||
pub speed: Num<u32, 8>,
|
||||
pub sample: usize,
|
||||
pub speed: Num<u16, 8>,
|
||||
pub sample: u16,
|
||||
pub effect1: PatternEffect,
|
||||
pub effect2: PatternEffect,
|
||||
}
|
||||
|
|
|
@ -80,12 +80,22 @@ impl Tracker {
|
|||
|
||||
for (channel, pattern_slot) in self.channels.iter_mut().zip(pattern_slots) {
|
||||
if pattern_slot.sample != 0 && self.tick == 0 {
|
||||
let sample = &self.track.samples[pattern_slot.sample - 1];
|
||||
let sample = &self.track.samples[pattern_slot.sample as usize - 1];
|
||||
channel.play_sound(mixer, sample);
|
||||
}
|
||||
|
||||
channel.apply_effect(mixer, &pattern_slot.effect1, self.tick, pattern_slot.speed);
|
||||
channel.apply_effect(mixer, &pattern_slot.effect2, self.tick, pattern_slot.speed);
|
||||
channel.apply_effect(
|
||||
mixer,
|
||||
&pattern_slot.effect1,
|
||||
self.tick,
|
||||
pattern_slot.speed.change_base(),
|
||||
);
|
||||
channel.apply_effect(
|
||||
mixer,
|
||||
&pattern_slot.effect2,
|
||||
self.tick,
|
||||
pattern_slot.speed.change_base(),
|
||||
);
|
||||
}
|
||||
|
||||
self.increment_step();
|
||||
|
|
|
@ -229,8 +229,8 @@ pub fn parse_module(module: &Module) -> TokenStream {
|
|||
);
|
||||
|
||||
pattern_data.push(agb_tracker_interop::PatternSlot {
|
||||
speed,
|
||||
sample,
|
||||
speed: speed.try_change_base().unwrap(),
|
||||
sample: sample as u16,
|
||||
effect1,
|
||||
effect2,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue