From a7aba5c8e7bd398d2b7ed48916c996fadb8c725a Mon Sep 17 00:00:00 2001 From: Daniel Romero Date: Fri, 3 Feb 2017 14:19:30 +0100 Subject: [PATCH] SoftVolumeMixer: move factor in again, otherwise i32 division always results in 0 --- src/mixer/softmixer.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mixer/softmixer.rs b/src/mixer/softmixer.rs index 789a5fff..184ed563 100644 --- a/src/mixer/softmixer.rs +++ b/src/mixer/softmixer.rs @@ -49,9 +49,8 @@ impl AudioFilter for SoftVolumeApplier { fn modify_stream(&self, data: &mut [i16]) { let volume = self.volume.load(Ordering::Relaxed) as u16; if volume != 0xFFFF { - let factor = volume as i32 / 0xFFFF; for x in data.iter_mut() { - *x = (*x as i32 * factor) as i16; + *x = (*x as i32 * volume as i32 / 0xFFFF) as i16; } } }