diff --git a/src/processor/memory/mmio/apu/channels.rs b/src/processor/memory/mmio/apu/channels.rs index 41f5166..0d6cd4d 100644 --- a/src/processor/memory/mmio/apu/channels.rs +++ b/src/processor/memory/mmio/apu/channels.rs @@ -371,8 +371,8 @@ impl WaveChannel { pub(super) fn length_tick(&mut self) { if self.length_enable && self.enabled { - self.length_timer += 1; - if self.length_timer >= 64 { + self.length_timer = self.length_timer.saturating_add(1); + if self.length_timer == 0xFF { self.enabled = false; } } @@ -528,6 +528,7 @@ impl NoiseChannel { fn trigger(&mut self) { self.enabled = true; self.envelope = self.queued_envelope; + self.lfsr.register = 0; } pub fn tick(&mut self, steps: usize) -> Vec {