From 4a06acba6ba5e23d331d7a980b66154a039300c5 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <gw@ilym.me> Date: Wed, 4 May 2022 20:42:32 +0100 Subject: [PATCH] Allow volumes to be a lot higher and check that clipping is handled --- agb/examples/mixer_basic.rs | 2 ++ agb/src/sound/mixer/mod.rs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/agb/examples/mixer_basic.rs b/agb/examples/mixer_basic.rs index 0dbdb630..a5a982b1 100644 --- a/agb/examples/mixer_basic.rs +++ b/agb/examples/mixer_basic.rs @@ -42,6 +42,8 @@ fn main(mut gba: Gba) -> ! { if input.is_pressed(Button::L) { channel.volume(half); + } else if input.is_pressed(Button::R) { + channel.volume(20.into()); // intentionally introduce clipping } else { channel.volume(1.into()); } diff --git a/agb/src/sound/mixer/mod.rs b/agb/src/sound/mixer/mod.rs index d537d3cc..9ff2db63 100644 --- a/agb/src/sound/mixer/mod.rs +++ b/agb/src/sound/mixer/mod.rs @@ -96,7 +96,6 @@ impl SoundChannel { #[inline(always)] pub fn volume(&mut self, volume: Num<i16, 4>) -> &mut Self { - assert!(volume <= Num::new(1), "volume must be <= 1"); assert!(volume >= Num::new(0), "volume must be >= 0"); self.volume = volume;