Merge pull request #2102 from oioitff/atrac-fix

The correct fix for choppy cg audios and bgm.
This commit is contained in:
Henrik Rydgård 2013-06-05 23:14:40 -07:00
commit 85d075db53
3 changed files with 7 additions and 10 deletions

View File

@ -132,7 +132,8 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking)
}
// If there's anything on the queue at all, it should be busy, but we try to be a bit lax.
if (chan.sampleQueue.size() > chan.sampleCount * 2 * chanQueueMaxSizeFactor || chan.sampleAddress == 0) {
//if (chan.sampleQueue.size() > chan.sampleCount * 2 * chanQueueMaxSizeFactor || chan.sampleAddress == 0) {
if (chan.sampleQueue.size() > 0 || chan.sampleAddress == 0) {
if (blocking) {
// TODO: Regular multichannel audio seems to block for 64 samples less? Or enqueue the first 64 sync?
int blockSamples = (int)chan.sampleQueue.size() / 2 / chanQueueMinSizeFactor;

View File

@ -1009,7 +1009,9 @@ int _AtracSetData(int atracID, u32 buffer, u32 bufferSize)
Atrac *atrac = getAtrac(atracID);
if (!atrac)
return -1;
return _AtracSetData(atrac, buffer, bufferSize);
int ret = _AtracSetData(atrac, buffer, bufferSize);
// not sure the real delay time
return hleDelayResult(ret, "atrac set data", 100);
}
u32 sceAtracSetHalfwayBuffer(int atracID, u32 halfBuffer, u32 readSize, u32 halfBufferSize)

View File

@ -110,10 +110,7 @@ u32 sceAudioOutputPannedBlocking(u32 chan, int leftvol, int rightvol, u32 sample
chans[chan].rightVolume = rightvol;
}
chans[chan].sampleAddress = samplePtr;
int ret = __AudioEnqueue(chans[chan], chan, true);
if (chans[chan].waitingThreads.size() == 0)
return hleDelayResult(ret, "output block", 1000);
return ret;
return __AudioEnqueue(chans[chan], chan, true);
}
}
@ -324,10 +321,7 @@ u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr){
chans[PSP_AUDIO_CHANNEL_OUTPUT2].leftVolume = vol;
chans[PSP_AUDIO_CHANNEL_OUTPUT2].rightVolume = vol;
chans[PSP_AUDIO_CHANNEL_OUTPUT2].sampleAddress = dataPtr;
int ret = __AudioEnqueue(chans[PSP_AUDIO_CHANNEL_OUTPUT2], PSP_AUDIO_CHANNEL_OUTPUT2, true);
if (chans[PSP_AUDIO_CHANNEL_OUTPUT2].waitingThreads.size() == 0)
return hleDelayResult(ret, "output block", 1000);
return ret;
return __AudioEnqueue(chans[PSP_AUDIO_CHANNEL_OUTPUT2], PSP_AUDIO_CHANNEL_OUTPUT2, true);
}
u32 sceAudioOutput2ChangeLength(u32 sampleCount){