mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-22 18:00:28 +00:00
Start looping if there is not enough samples.
Fix noise in some looping bgm.
This commit is contained in:
parent
7adb16e3ac
commit
2432101216
@ -566,6 +566,7 @@ u32 _AtracDecodeData(int atracID, u8* outbuf, u32 *SamplesNum, u32* finish, int
|
||||
} else {
|
||||
// TODO: This isn't at all right, but at least it makes the music "last" some time.
|
||||
u32 numSamples = 0;
|
||||
u32 atracSamplesPerFrame = (atrac->codeType == PSP_MODE_AT_3_PLUS ? ATRAC3PLUS_MAX_SAMPLES : ATRAC3_MAX_SAMPLES);
|
||||
#ifdef USE_FFMPEG
|
||||
if (atrac->codeType == PSP_MODE_AT_3 && atrac->pCodecCtx) {
|
||||
int forceseekSample = atrac->currentSample * 2 > atrac->endSample ? 0 : atrac->endSample;
|
||||
@ -635,7 +636,6 @@ u32 _AtracDecodeData(int atracID, u8* outbuf, u32 *SamplesNum, u32* finish, int
|
||||
} else
|
||||
{
|
||||
numSamples = atrac->endSample - atrac->currentSample;
|
||||
u32 atracSamplesPerFrame = (atrac->codeType == PSP_MODE_AT_3_PLUS ? ATRAC3PLUS_MAX_SAMPLES : ATRAC3_MAX_SAMPLES);
|
||||
if (atrac->currentSample >= atrac->endSample) {
|
||||
numSamples = 0;
|
||||
} else if (numSamples > atracSamplesPerFrame) {
|
||||
@ -654,7 +654,7 @@ u32 _AtracDecodeData(int atracID, u8* outbuf, u32 *SamplesNum, u32* finish, int
|
||||
atrac->decodePos = atrac->getDecodePosBySample(atrac->currentSample);
|
||||
|
||||
int finishFlag = 0;
|
||||
if (atrac->loopNum != 0 && (atrac->currentSample >= atrac->loopEndSample ||
|
||||
if (atrac->loopNum != 0 && (atrac->currentSample + atracSamplesPerFrame > atrac->loopEndSample ||
|
||||
(numSamples == 0 && atrac->first.size >= atrac->first.filesize))) {
|
||||
atrac->currentSample = atrac->loopStartSample;
|
||||
if (atrac->loopNum > 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user