fix length timer

This commit is contained in:
Alex Janka 2023-02-20 15:51:39 +11:00
parent 6676276706
commit a790e4cbd1

View file

@ -371,8 +371,8 @@ impl WaveChannel {
pub(super) fn length_tick(&mut self) { pub(super) fn length_tick(&mut self) {
if self.length_enable && self.enabled { if self.length_enable && self.enabled {
self.length_timer += 1; self.length_timer = self.length_timer.saturating_add(1);
if self.length_timer >= 64 { if self.length_timer == 0xFF {
self.enabled = false; self.enabled = false;
} }
} }
@ -528,6 +528,7 @@ impl NoiseChannel {
fn trigger(&mut self) { fn trigger(&mut self) {
self.enabled = true; self.enabled = true;
self.envelope = self.queued_envelope; self.envelope = self.queued_envelope;
self.lfsr.register = 0;
} }
pub fn tick(&mut self, steps: usize) -> Vec<f32> { pub fn tick(&mut self, steps: usize) -> Vec<f32> {