mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
SoftVolumeMixer: move factor in again, otherwise i32 division always results in 0
This commit is contained in:
parent
44467a44d6
commit
a7aba5c8e7
1 changed files with 1 additions and 2 deletions
|
@ -49,9 +49,8 @@ impl AudioFilter for SoftVolumeApplier {
|
||||||
fn modify_stream(&self, data: &mut [i16]) {
|
fn modify_stream(&self, data: &mut [i16]) {
|
||||||
let volume = self.volume.load(Ordering::Relaxed) as u16;
|
let volume = self.volume.load(Ordering::Relaxed) as u16;
|
||||||
if volume != 0xFFFF {
|
if volume != 0xFFFF {
|
||||||
let factor = volume as i32 / 0xFFFF;
|
|
||||||
for x in data.iter_mut() {
|
for x in data.iter_mut() {
|
||||||
*x = (*x as i32 * factor) as i16;
|
*x = (*x as i32 * volume as i32 / 0xFFFF) as i16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue