From c709455e3def42b9ac14fcc2fea94fa50cab7956 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sat, 11 Jun 2022 13:19:56 +0100 Subject: [PATCH] Add defines for freq32768 --- agb/src/sound/mixer/sw_mixer.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/agb/src/sound/mixer/sw_mixer.rs b/agb/src/sound/mixer/sw_mixer.rs index f6f09f21..28f48ae1 100644 --- a/agb/src/sound/mixer/sw_mixer.rs +++ b/agb/src/sound/mixer/sw_mixer.rs @@ -96,9 +96,9 @@ impl Mixer { } } -// I've picked one frequency that works nicely. But there are others that work nicely -// which we may want to consider in the future: http://deku.gbadev.org/program/sound1.html -#[cfg(not(feature = "freq18157"))] +// These work perfectly with swapping the buffers every vblank +// list here: http://deku.gbadev.org/program/sound1.html +#[cfg(all(not(feature = "freq18157"), not(feature = "freq32768")))] mod constants { pub const SOUND_FREQUENCY: i32 = 10512; pub const SOUND_BUFFER_SIZE: usize = 176; @@ -110,6 +110,12 @@ mod constants { pub const SOUND_BUFFER_SIZE: usize = 304; } +#[cfg(feature = "freq32768")] +mod constants { + pub const SOUND_FREQUENCY: i32 = 32768; + pub const SOUND_BUFFER_SIZE: usize = 549; +} + fn set_asm_buffer_size() { extern "C" { static mut agb_rs__buffer_size: usize;