mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 03:44:32 +01:00
Sas: Add in zeroes like the PSP seems to.
This commit is contained in:
1 parent
9c378c4eda
commit
1aac569e73
3 files changed
+25
-12
No files matched your search
+13
-9
@@ -391,11 +391,11 @@ void SasInstance::SetGrainSize(int newGrainSize) {
|
||||
mixBuffer = new s32[grainSize * 2];
|
||||
sendBuffer = new s32[grainSize * 2];
|
||||
sendBufferDownsampled = new s16[grainSize];
|
||||
sendBufferProcessed = new s16[grainSize];
|
||||
sendBufferProcessed = new s16[grainSize * 2];
|
||||
memset(mixBuffer, 0, sizeof(int) * grainSize * 2);
|
||||
memset(sendBuffer, 0, sizeof(int) * grainSize * 2);
|
||||
memset(sendBufferDownsampled, 0, sizeof(s16) * grainSize);
|
||||
memset(sendBufferProcessed, 0, sizeof(s16) * grainSize);
|
||||
memset(sendBufferProcessed, 0, sizeof(s16) * grainSize * 2);
|
||||
|
||||
// 2 samples padding at the start, that's where we copy the two last samples from the channel
|
||||
// so that we can do bicubic resampling if necessary. Plus 1 for smoothness hackery.
|
||||
@@ -618,8 +618,8 @@ void SasInstance::WriteMixedOutput(s16 *outp, const s16 *inp, int leftVol, int r
|
||||
sampleR += mixBuffer[i + 1];
|
||||
}
|
||||
if (wet) {
|
||||
sampleL += sendBufferProcessed[((i >> 1) & ~1) + 0];
|
||||
sampleR += sendBufferProcessed[((i >> 1) & ~1) + 1];
|
||||
sampleL += sendBufferProcessed[i + 0];
|
||||
sampleR += sendBufferProcessed[i + 1];
|
||||
}
|
||||
*outp++ = clamp_s16(sampleL);
|
||||
*outp++ = clamp_s16(sampleR);
|
||||
@@ -628,8 +628,8 @@ void SasInstance::WriteMixedOutput(s16 *outp, const s16 *inp, int leftVol, int r
|
||||
// These are the optimal cases.
|
||||
if (dry && wet) {
|
||||
for (int i = 0; i < grainSize * 2; i += 2) {
|
||||
*outp++ = clamp_s16(mixBuffer[i + 0] + sendBufferProcessed[((i >> 1) & ~1) + 0]);
|
||||
*outp++ = clamp_s16(mixBuffer[i + 1] + sendBufferProcessed[((i >> 1) & ~1) + 1]);
|
||||
*outp++ = clamp_s16(mixBuffer[i + 0] + sendBufferProcessed[i + 0]);
|
||||
*outp++ = clamp_s16(mixBuffer[i + 1] + sendBufferProcessed[i + 1]);
|
||||
}
|
||||
} else if (dry) {
|
||||
for (int i = 0; i < grainSize * 2; i += 2) {
|
||||
@@ -637,13 +637,17 @@ void SasInstance::WriteMixedOutput(s16 *outp, const s16 *inp, int leftVol, int r
|
||||
*outp++ = clamp_s16(mixBuffer[i + 1]);
|
||||
}
|
||||
} else {
|
||||
// This is another uncommon case, dry must be off.
|
||||
// This is another uncommon case, dry must be off but let's keep it for clarity.
|
||||
for (int i = 0; i < grainSize * 2; i += 2) {
|
||||
int sampleL = 0;
|
||||
int sampleR = 0;
|
||||
if (dry) {
|
||||
sampleL += mixBuffer[i + 0];
|
||||
sampleR += mixBuffer[i + 1];
|
||||
}
|
||||
if (wet) {
|
||||
sampleL += sendBufferProcessed[((i >> 1) & ~1) + 0];
|
||||
sampleR += sendBufferProcessed[((i >> 1) & ~1) + 1];
|
||||
sampleL += sendBufferProcessed[i + 0];
|
||||
sampleR += sendBufferProcessed[i + 1];
|
||||
}
|
||||
*outp++ = clamp_s16(sampleL);
|
||||
*outp++ = clamp_s16(sampleR);
|
||||
|
||||
+11
-3
@@ -210,7 +210,13 @@ void SasReverb::ProcessReverb(int16_t *output, const int16_t *input, size_t inpu
|
||||
// This means replicate the input signal in the processed buffer.
|
||||
// Can also be used to verify that the error is in here...
|
||||
if (preset_ == -1) {
|
||||
memcpy(output, input, inputSize * 2 * sizeof(int16_t));
|
||||
// Strangely, OFF is not filled with zeroes every other. Seems special cased.
|
||||
for (size_t i = 0; i < inputSize; ++i) {
|
||||
output[i * 4 + 0] = clamp_s16(input[i * 2 + 0] * volLeft >> 15);
|
||||
output[i * 4 + 1] = clamp_s16(input[i * 2 + 1] * volRight >> 15);
|
||||
output[i * 4 + 2] = clamp_s16(input[i * 2 + 0] * volLeft >> 15);
|
||||
output[i * 4 + 3] = clamp_s16(input[i * 2 + 1] * volRight >> 15);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -250,8 +256,10 @@ void SasReverb::ProcessReverb(int16_t *output, const int16_t *input, size_t inpu
|
||||
b[d.mRAPF2] = clamp_s16(Rout - (d.vAPF2*b[(d.mRAPF2 - d.dAPF2)] >> 15));
|
||||
Rout = b[(d.mRAPF2 - d.dAPF2)] + (b[d.mRAPF2] * d.vAPF2 >> 15);
|
||||
// ___Output to Mixer(Output volume multiplied with input from APF2)___________
|
||||
output[i*2] = clamp_s16(Lout*volLeft >> 15);
|
||||
output[i*2+1] = clamp_s16(Rout*volRight >> 15);
|
||||
output[i * 4 + 0] = clamp_s16(Lout * volLeft >> 15);
|
||||
output[i * 4 + 1] = clamp_s16(Rout * volRight >> 15);
|
||||
output[i * 4 + 2] = 0;
|
||||
output[i * 4 + 3] = 0;
|
||||
|
||||
b.Next();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
static const char *GetPresetName(int preset);
|
||||
|
||||
// Input should be a mixdown of all the channels that have reverb enabled, at 22khz.
|
||||
// Output is written back at 44khz.
|
||||
void ProcessReverb(int16_t *output, const int16_t *input, size_t inputSize, int16_t volLeft, int16_t volRight);
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user