mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-12 02:44:00 +00:00
Implement volume control for _sceSasCoreWithMix.
Tested with Fate Unlimited Code.
This commit is contained in:
parent
a4326d689c
commit
8d10724b64
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user