Merge pull request #5237 from raven02/patch-6

Return without delay if voicesPlayingCount is zero
This commit is contained in:
Henrik Rydgård 2014-01-27 04:16:48 -08:00
commit a8eb92f395
2 changed files with 17 additions and 19 deletions

View File

@ -131,14 +131,14 @@ u32 _sceSasCore(u32 core, u32 outAddr) {
bool ret = sas->Mix(outAddr);
// Actual delay time seems to between 240 and 1000 us, based on grain and possibly other factors.
// Turns out that delaying only when there's no voicesPlayingCount fixes issue #2304. Feels a bit
// like a hack. Note that Mix() returns true in this case which is a little confusing.
// When there's no voicesPlayingCount , we return as no delay and fixes issue #2304.
// Note that Mix() returns true in this case when no voicesPlayingCount.
if (ret) {
// If voicesPlayingCount == 0 , delay 240 us and reschedule
return hleDelayResult(0, "sas core", 240);
} else {
// if voicesPlayingCount > 0 , no delay
// If voicesPlayingCount == 0 , no delay
return 0;
} else {
// if voicesPlayingCount > 0 , delay 240 us and reschedule
return hleDelayResult(0, "sas core", 240);
}
}
@ -152,14 +152,14 @@ u32 _sceSasCoreWithMix(u32 core, u32 inoutAddr, int leftVolume, int rightVolume)
bool ret = sas->Mix(inoutAddr, inoutAddr, leftVolume, rightVolume);
// Actual delay time seems to between 240 and 1000 us, based on grain and possibly other factors.
// Turns out that delaying only when there's no voicesPlayingCount fixes issue #2304. Feels a bit
// like a hack. Note that Mix() returns true in this case which is a little confusing.
// When there's no voicesPlayingCount , we return as no delay and fixes issue #2304.
// Note that Mix() returns true in this case when no voicesPlayingCount.
if (ret) {
// If voicesPlayingCount == 0 , delay 240 us and reschedule
return hleDelayResult(0, "sas core", 240);
} else {
// if voicesPlayingCount > 0 , no delay
// If voicesPlayingCount == 0 , no delay
return 0;
} else {
// if voicesPlayingCount > 0 , delay 240 us and reschedule
return hleDelayResult(0, "sas core", 240);
}
}

View File

@ -481,12 +481,6 @@ bool SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) {
MixVoice(voice);
}
if (voicesPlayingCount == 0) {
// This is fine, no need to log really.
// DEBUG_LOG(SASMIX,"SasInstance::Mix() : voicesPlayingCount is zero");
return true;
}
// Okay, apply effects processing to the Send buffer.
//if (waveformEffect.type != PSP_SAS_EFFECT_TYPE_OFF)
// ApplyReverb();
@ -525,7 +519,11 @@ bool SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) {
fwrite(Memory::GetPointer(outAddr), 1, grainSize * 2 * 2, audioDump);
#endif
return false;
if (voicesPlayingCount == 0) {
return true;
} else {
return false;
}
}
void SasInstance::ApplyReverb() {