From dfcc836bf8729c67a5909bcd3c165bd862da5f92 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 27 Jan 2013 22:15:23 +0800 Subject: [PATCH 1/4] Shift volume base on sceSasSetVolume --- Core/HLE/sceSas.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 0c35f3015..c48986ff8 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -197,9 +197,9 @@ u32 sceSasSetPause(u32 core, int voicebit, int pause) return 0; } -u32 sceSasSetVolume(u32 core, int voiceNum, int l, int r, int el, int er) +u32 sceSasSetVolume(u32 core, int voiceNum, int leftVol, int rightVol, int effectLeftVol, int effectRightVol) { - DEBUG_LOG(HLE,"sceSasSetVolume(%08x, %i, %i, %i, %i, %i)", core, voiceNum, l, r, el, er); + DEBUG_LOG(HLE,"sceSasSetVolume(%08x, %i, %i, %i, %i, %i)", core, leftVol, rightVol, effectLeftVol, effectRightVol); if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { WARN_LOG(HLE, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); @@ -207,8 +207,10 @@ u32 sceSasSetVolume(u32 core, int voiceNum, int l, int r, int el, int er) } SasVoice &v = sas->voices[voiceNum]; - v.volumeLeft = l; - v.volumeRight = r; + v.volumeLeft = (leftVol << 3); + v.volumeRight = (rightVol << 3); + v.effectLeft = effectLeftVol; + v.effectRight = effectRightVol; return 0; } From 523f026c3d26de60c7c882de79c4af81b93cc46a Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 27 Jan 2013 22:16:15 +0800 Subject: [PATCH 2/4] Restore shift volume to 15 --- Core/HW/SasAudio.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 27ca60671..ea43814e5 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -284,10 +284,10 @@ void SasInstance::Mix(u32 outAddr) { // We mix into this 32-bit temp buffer and clip in a second loop // Ideally, the shift right should be there too but for now I'm concerned about // not overflowing. - mixBuffer[i * 2] += sample * voice.volumeLeft >> 12; - mixBuffer[i * 2 + 1] += sample * voice.volumeRight >> 12; - sendBuffer[i * 2] += sample * voice.volumeLeftSend >> 12; - sendBuffer[i * 2 + 1] += sample * voice.volumeRightSend >> 12; + mixBuffer[i * 2] += sample * voice.volumeLeft >> 15; + mixBuffer[i * 2 + 1] += sample * voice.volumeRight >> 15; + sendBuffer[i * 2] += sample * voice.volumeLeftSend >> 15; + sendBuffer[i * 2 + 1] += sample * voice.volumeRightSend >> 15; voice.envelope.Step(); } voice.sampleFrac = sampleFrac; From d14b6ed42357ca555af1e5ac12834e6e9b74b4c4 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 27 Jan 2013 22:27:14 +0800 Subject: [PATCH 3/4] Oops, missing voiceNum --- Core/HLE/sceSas.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index c48986ff8..cf35bbef9 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -199,7 +199,7 @@ u32 sceSasSetPause(u32 core, int voicebit, int pause) u32 sceSasSetVolume(u32 core, int voiceNum, int leftVol, int rightVol, int effectLeftVol, int effectRightVol) { - DEBUG_LOG(HLE,"sceSasSetVolume(%08x, %i, %i, %i, %i, %i)", core, leftVol, rightVol, effectLeftVol, effectRightVol); + DEBUG_LOG(HLE,"sceSasSetVolume(%08x, %i, %i, %i, %i, %i)", core, voiceNum, leftVol, rightVol, effectLeftVol, effectRightVol); if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { WARN_LOG(HLE, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); From 4a1218387d5b88bbda63f9dad39857a1ecdf43c2 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 27 Jan 2013 22:34:14 +0800 Subject: [PATCH 4/4] Add effectLeft and effectRight --- Core/HW/SasAudio.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/HW/SasAudio.h b/Core/HW/SasAudio.h index 6a0554399..7ae8e8cca 100644 --- a/Core/HW/SasAudio.h +++ b/Core/HW/SasAudio.h @@ -199,6 +199,8 @@ struct SasVoice int volumeRight; int volumeLeftSend; // volume to "Send" (audio-lingo) to the effects processing engine, like reverb int volumeRightSend; + int effectLeft; + int effectRight; s16 resampleHist[2]; ADSREnvelope envelope;