mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Mp3: Correct sum decoded sample count.
It shouldn't consider both channels of stereo. This could've been causing some games to think they were playing audio at an incorrect speed.
This commit is contained in:
parent
bc1e6e12f5
commit
a3640f303b
2 changed files with 8 additions and 7 deletions
|
@ -487,15 +487,16 @@ static int sceMp3GetMaxOutputSample(u32 mp3) {
|
|||
}
|
||||
|
||||
static int sceMp3GetSumDecodedSample(u32 mp3) {
|
||||
INFO_LOG(ME, "sceMp3GetSumDecodedSample(%08X)", mp3);
|
||||
|
||||
AuCtx *ctx = getMp3Ctx(mp3);
|
||||
if (!ctx) {
|
||||
ERROR_LOG(ME, "%s: bad mp3 handle %08x", __FUNCTION__, mp3);
|
||||
return -1;
|
||||
if (mp3 >= MP3_MAX_HANDLES)
|
||||
return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle");
|
||||
return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle");
|
||||
} else if (ctx->AuBuf == 0) {
|
||||
return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type");
|
||||
}
|
||||
|
||||
return ctx->AuGetSumDecodedSample();
|
||||
return hleLogSuccessI(ME, ctx->AuGetSumDecodedSample());
|
||||
}
|
||||
|
||||
static int sceMp3SetLoopNum(u32 mp3, int loop) {
|
||||
|
|
|
@ -335,8 +335,8 @@ u32 AuCtx::AuDecode(u32 pcmAddr)
|
|||
readPos = startPos;
|
||||
}
|
||||
} else {
|
||||
// count total output samples
|
||||
SumDecodedSamples += decoder->GetOutSamples();
|
||||
// Update our total decoded samples, but don't count stereo.
|
||||
SumDecodedSamples += decoder->GetOutSamples() / 2;
|
||||
// get consumed source length
|
||||
int srcPos = decoder->GetSourcePos();
|
||||
// remove the consumed source
|
||||
|
|
Loading…
Add table
Reference in a new issue