From 0f74b4be9ff6b3d9b554f8661e7a0883210106b2 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Tue, 3 Jan 2023 19:32:59 +0100 Subject: [PATCH] Example works fine, audio feels off --- ctru-rs/examples/audio_filters.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ctru-rs/examples/audio_filters.rs b/ctru-rs/examples/audio_filters.rs index 605fa4d..dbd9b2a 100644 --- a/ctru-rs/examples/audio_filters.rs +++ b/ctru-rs/examples/audio_filters.rs @@ -149,22 +149,23 @@ fn main() { } } - let current: Option<&mut WaveInfo>; + let current: &mut WaveInfo; + let other: &mut WaveInfo; if altern { - current = Some(&mut wave_info1); + current = &mut wave_info1; + other = &mut wave_info2; } else { - current = Some(&mut wave_info2); + current = &mut wave_info2; + other = &mut wave_info1; } - let current = current.unwrap(); - let status = current.get_status(); if let WaveStatus::Done = status { altern = !altern; - fill_buffer(current.get_mut_wavebuffer().get_mut_data(), NOTEFREQ[note]); - channel_zero.queue_wave(current); + fill_buffer(other.get_mut_wavebuffer().get_mut_data(), NOTEFREQ[note]); + channel_zero.queue_wave(other); } // Flush and swap framebuffers