mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #513 from raven02/sas
Shift volume base on sceSasSetVolume
This commit is contained in:
commit
85a317bde9
3 changed files with 12 additions and 8 deletions
|
@ -197,9 +197,9 @@ u32 sceSasSetPause(u32 core, int voicebit, int pause)
|
||||||
return 0;
|
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) {
|
if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) {
|
||||||
WARN_LOG(HLE, "%s: invalid voicenum %d", __FUNCTION__, voiceNum);
|
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];
|
SasVoice &v = sas->voices[voiceNum];
|
||||||
v.volumeLeft = l;
|
v.volumeLeft = (leftVol << 3);
|
||||||
v.volumeRight = r;
|
v.volumeRight = (rightVol << 3);
|
||||||
|
v.effectLeft = effectLeftVol;
|
||||||
|
v.effectRight = effectRightVol;
|
||||||
return 0;
|
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
|
// 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
|
// Ideally, the shift right should be there too but for now I'm concerned about
|
||||||
// not overflowing.
|
// not overflowing.
|
||||||
mixBuffer[i * 2] += sample * voice.volumeLeft >> 12;
|
mixBuffer[i * 2] += sample * voice.volumeLeft >> 15;
|
||||||
mixBuffer[i * 2 + 1] += sample * voice.volumeRight >> 12;
|
mixBuffer[i * 2 + 1] += sample * voice.volumeRight >> 15;
|
||||||
sendBuffer[i * 2] += sample * voice.volumeLeftSend >> 12;
|
sendBuffer[i * 2] += sample * voice.volumeLeftSend >> 15;
|
||||||
sendBuffer[i * 2 + 1] += sample * voice.volumeRightSend >> 12;
|
sendBuffer[i * 2 + 1] += sample * voice.volumeRightSend >> 15;
|
||||||
voice.envelope.Step();
|
voice.envelope.Step();
|
||||||
}
|
}
|
||||||
voice.sampleFrac = sampleFrac;
|
voice.sampleFrac = sampleFrac;
|
||||||
|
|
|
@ -199,6 +199,8 @@ struct SasVoice
|
||||||
int volumeRight;
|
int volumeRight;
|
||||||
int volumeLeftSend; // volume to "Send" (audio-lingo) to the effects processing engine, like reverb
|
int volumeLeftSend; // volume to "Send" (audio-lingo) to the effects processing engine, like reverb
|
||||||
int volumeRightSend;
|
int volumeRightSend;
|
||||||
|
int effectLeft;
|
||||||
|
int effectRight;
|
||||||
s16 resampleHist[2];
|
s16 resampleHist[2];
|
||||||
|
|
||||||
ADSREnvelope envelope;
|
ADSREnvelope envelope;
|
||||||
|
|
Loading…
Add table
Reference in a new issue