From 75a49129a67a785753a5693c9b7d07fd1504ea23 Mon Sep 17 00:00:00 2001 From: raven02 Date: Mon, 27 Jan 2014 10:07:56 +0800 Subject: [PATCH 1/3] Return without delay if voicesPlayingCount is zero --- Core/HLE/sceSas.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index d042c5dd02..e9f9f62d3e 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -134,11 +134,11 @@ u32 _sceSasCore(u32 core, u32 outAddr) { // 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. 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); } } @@ -155,11 +155,11 @@ u32 _sceSasCoreWithMix(u32 core, u32 inoutAddr, int leftVolume, int rightVolume) // 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. 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); } } From f381bfd0b4693f85ca7a00263d59795af919b78b Mon Sep 17 00:00:00 2001 From: raven02 Date: Mon, 27 Jan 2014 17:22:01 +0800 Subject: [PATCH 2/3] Update comment --- Core/HLE/sceSas.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index e9f9f62d3e..5591c2057a 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -131,8 +131,8 @@ 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 , no delay return 0; @@ -152,8 +152,8 @@ 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 , no delay return 0; From 8e8329abec6115d96200910261d3fb5b12138849 Mon Sep 17 00:00:00 2001 From: raven02 Date: Mon, 27 Jan 2014 19:32:35 +0800 Subject: [PATCH 3/3] Fix audio gitches --- Core/HW/SasAudio.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 28cf8435d2..60a7e42496 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -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() {