mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-29 19:30:48 +00:00
Merge pull request #513 from raven02/sas
Shift volume base on sceSasSetVolume
This commit is contained in:
commit
85a317bde9
@ -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, voiceNum, 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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user