From d087c8624352af198a6954d45098d3b5b66f98e9 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sun, 10 Aug 2025 08:47:00 +0200 Subject: [PATCH] Audio: simplify apply_volume --- rpcs3/Emu/Audio/AudioBackend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Audio/AudioBackend.cpp b/rpcs3/Emu/Audio/AudioBackend.cpp index e0d96c8c2b..def9ebfbab 100644 --- a/rpcs3/Emu/Audio/AudioBackend.cpp +++ b/rpcs3/Emu/Audio/AudioBackend.cpp @@ -65,7 +65,7 @@ f32 AudioBackend::apply_volume(const VolumeParam& param, u32 sample_cnt, const f { for (sample_idx = 0; sample_idx < sample_cnt && crnt_vol != param.target_volume; sample_idx += param.ch_cnt) { - crnt_vol = std::min(param.current_volume + (sample_idx + 1) / param.ch_cnt * vol_incr, param.target_volume); + crnt_vol = std::min(crnt_vol + vol_incr, param.target_volume); for (u32 i = 0; i < param.ch_cnt; i++) { @@ -77,7 +77,7 @@ f32 AudioBackend::apply_volume(const VolumeParam& param, u32 sample_cnt, const f { for (sample_idx = 0; sample_idx < sample_cnt && crnt_vol != param.target_volume; sample_idx += param.ch_cnt) { - crnt_vol = std::max(param.current_volume + (sample_idx + 1) / param.ch_cnt * vol_incr, param.target_volume); + crnt_vol = std::max(crnt_vol + vol_incr, param.target_volume); for (u32 i = 0; i < param.ch_cnt; i++) {