From 348ea5b5cf49cc2641af0bbcfe5172b71043dbdf Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 3 Nov 2013 01:13:47 -0700 Subject: [PATCH] Fix volume scaling for mono inputs, etc. Fixes #4423. --- Core/HLE/sceAtrac.cpp | 4 ++-- Core/HW/SimpleAT3Dec.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 7d3edd8fa..6a74c32ab 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -630,7 +630,7 @@ u32 _AtracDecodeData(int atracID, u8* outbuf, u32 *SamplesNum, u32* finish, int if (avret < 0) { ERROR_LOG(ME, "swr_convert: Error while converting %d", avret); } - __AdjustBGMVolume((s16 *)out, numSamples * atrac->pFrame->channels); + __AdjustBGMVolume((s16 *)out, numSamples * atrac->atracOutputChannels); } } av_free_packet(&packet); @@ -1780,7 +1780,7 @@ int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesConsumedA if (avret < 0) { ERROR_LOG(ME, "swr_convert: Error while converting %d", avret); } - __AdjustBGMVolume((s16 *)out, numSamples * atrac->pFrame->channels); + __AdjustBGMVolume((s16 *)out, numSamples * atrac->atracOutputChannels); } av_free_packet(&packet); if (got_frame) diff --git a/Core/HW/SimpleAT3Dec.cpp b/Core/HW/SimpleAT3Dec.cpp index f6016f557..e5d7b98bf 100644 --- a/Core/HW/SimpleAT3Dec.cpp +++ b/Core/HW/SimpleAT3Dec.cpp @@ -142,7 +142,8 @@ bool SimpleAT3::Decode(void* inbuf, int inbytes, uint8_t *outbuf, int *outbytes) ERROR_LOG(ME, "swr_convert: Error while converting %d", swrRet); return false; } - __AdjustBGMVolume((s16 *)outbuf, numSamples * frame_->channels); + // We always convert to stereo. + __AdjustBGMVolume((s16 *)outbuf, numSamples * 2); } return true;