Implement volume control for _sceSasCoreWithMix.

Tested with Fate Unlimited Code.
This commit is contained in:
oioitff 2013-05-11 04:30:02 +08:00
parent a4326d689c
commit 8d10724b64
3 changed files with 5 additions and 5 deletions

View File

@ -107,7 +107,7 @@ u32 _sceSasCoreWithMix(u32 core, u32 inoutAddr, int leftVolume, int rightVolume)
return ERROR_SAS_INVALID_PARAMETER;
}
sas->Mix(inoutAddr, inoutAddr);
sas->Mix(inoutAddr, inoutAddr, leftVolume, rightVolume);
return 0;
}

View File

@ -265,7 +265,7 @@ static inline s16 clamp_s16(int i) {
return i;
}
void SasInstance::Mix(u32 outAddr, u32 inAddr) {
void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) {
int voicesPlayingCount = 0;
for (int v = 0; v < PSP_SAS_VOICES_MAX; v++) {
SasVoice &voice = voices[v];
@ -377,13 +377,13 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr) {
for (int i = 0; i < grainSize * 2; i += 2) {
int sampleL = mixBuffer[i] + sendBuffer[i];
if (inp)
sampleL += *inp++;
sampleL += (*inp++) * leftVol >> 12;
*outp++ = clamp_s16(sampleL);
if (outputMode == 0) {
// stereo
int sampleR = mixBuffer[i + 1] + sendBuffer[i + 1];
if (inp)
sampleR += *inp++;
sampleR += (*inp++) * rightVol >> 12;
*outp++ = clamp_s16(sampleR);
}
}

View File

@ -237,7 +237,7 @@ public:
FILE *audioDump;
void Mix(u32 outAddr, u32 inAddr = 0);
void Mix(u32 outAddr, u32 inAddr = 0, int leftVol = 0, int rightVol = 0);
void DoState(PointerWrap &p);