From 4c63058ba0dc27622bcd80fd47da71c9e0799a76 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Tue, 12 Jul 2022 13:42:30 +0100 Subject: [PATCH] Fix example --- agb/examples/mixer_basic.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/agb/examples/mixer_basic.rs b/agb/examples/mixer_basic.rs index 96603df1..50aae56d 100644 --- a/agb/examples/mixer_basic.rs +++ b/agb/examples/mixer_basic.rs @@ -4,7 +4,7 @@ use agb::fixnum::Num; use agb::input::{Button, ButtonController, Tri}; use agb::sound::mixer::SoundChannel; -use agb::{include_wav, Gba}; +use agb::{include_wav, Gba, fixnum::num}; // Music - "Dead Code" by Josh Woodward, free download at http://joshwoodward.com const DEAD_CODE: &[u8] = include_wav!("examples/JoshWoodward-DeadCode.wav"); @@ -25,26 +25,26 @@ fn main(mut gba: Gba) -> ! { { if let Some(channel) = mixer.channel(&channel_id) { - let half: Num = Num::new(1) / 2; - let half_usize: Num = Num::new(1) / 2; + let half: Num = num!(0.5); + let half_usize: Num = num!(0.5); match input.x_tri() { Tri::Negative => channel.panning(-half), - Tri::Zero => channel.panning(0.into()), + Tri::Zero => channel.panning(0), Tri::Positive => channel.panning(half), }; match input.y_tri() { Tri::Negative => channel.playback(half_usize.change_base() + 1), - Tri::Zero => channel.playback(1.into()), + Tri::Zero => channel.playback(1), Tri::Positive => channel.playback(half_usize), }; if input.is_pressed(Button::L) { channel.volume(half); } else if input.is_pressed(Button::R) { - channel.volume(20.into()); // intentionally introduce clipping + channel.volume(20); // intentionally introduce clipping } else { - channel.volume(1.into()); + channel.volume(1); } } }