From 34cde2ac630270591c071bb452e59de430a8f606 Mon Sep 17 00:00:00 2001 From: /dev/urandom Date: Sat, 15 Feb 2025 05:09:20 +0100 Subject: feat: working audio again --- src/music.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/music.rs') diff --git a/src/music.rs b/src/music.rs index 5a33d84..888de77 100644 --- a/src/music.rs +++ b/src/music.rs @@ -38,22 +38,22 @@ pub fn mmc2r_to_pcm(state: &mut MmC2r) -> Vec { destination.push(sample); } } - // #[cfg(not(feature = "stereo"))] - // let destination = { - // let stereo = destination; - // let mut mono = Vec::::new(); - // let mut is_first_stereo_pair = true; - // let mut stereo_pair_val = 0 as i16; - // for sample in stereo { - // if is_first_stereo_pair { - // stereo_pair_val = sample; - // } else { - // mono.push(((sample as i32 + stereo_pair_val as i32) / 2) as i16); - // } - // is_first_stereo_pair = !is_first_stereo_pair; - // } - // mono - // }; + #[cfg(not(feature = "stereo"))] + let destination = { + let stereo = destination; + let mut mono = Vec::::new(); + let mut is_first_stereo_pair = true; + let mut stereo_pair_val = 0 as i16; + for sample in stereo { + if is_first_stereo_pair { + stereo_pair_val = sample; + } else { + mono.push(((sample as i32 + stereo_pair_val as i32) / 2) as i16); + } + is_first_stereo_pair = !is_first_stereo_pair; + } + mono + }; destination } -- cgit v1.2.3