delayBufs now 2 variables

This commit is contained in:
gheskett
2021-08-04 23:16:03 -05:00
parent 646c3aea47
commit 82334f790b
3 changed files with 21 additions and 20 deletions

View File

@@ -1460,12 +1460,11 @@ void audio_reset_session(void) {
for (i = 0; i < NUM_ALLPASS; ++i)
delays[i] = delaysBaseline[i] / gReverbDownsampleRate;
delayBufs = (s32***) soundAlloc(&gAudioSessionPool, 2 * sizeof(s32**));
delayBufs[0] = (s32**) soundAlloc(&gAudioSessionPool, NUM_ALLPASS * sizeof(s32*));
delayBufs[1] = (s32**) soundAlloc(&gAudioSessionPool, NUM_ALLPASS * sizeof(s32*));
delayBufsL = (s32**) soundAlloc(&gAudioSessionPool, NUM_ALLPASS * sizeof(s32*));
delayBufsR = (s32**) soundAlloc(&gAudioSessionPool, NUM_ALLPASS * sizeof(s32*));
for (i = 0; i < NUM_ALLPASS; ++i) {
delayBufs[0][i] = (s32*) soundAlloc(&gAudioSessionPool, delays[i] * sizeof(s32));
delayBufs[1][i] = (s32*) soundAlloc(&gAudioSessionPool, delays[i] * sizeof(s32));
delayBufsL[i] = (s32*) soundAlloc(&gAudioSessionPool, delays[i] * sizeof(s32));
delayBufsR[i] = (s32*) soundAlloc(&gAudioSessionPool, delays[i] * sizeof(s32));
}
}
#endif

View File

@@ -123,7 +123,8 @@ u8 toggleBetterReverb = TRUE;
s32 allpassIdx[NUM_ALLPASS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
s32 tmpBufL[NUM_ALLPASS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
s32 tmpBufR[NUM_ALLPASS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
s32 ***delayBufs;
s32 **delayBufsL;
s32 **delayBufsR;
#endif
@@ -180,29 +181,29 @@ inline void reverb_samples(s16 *outSampleL, s16 *outSampleR, s32 inSampleL, s32
s32 tmpCarryoverR = ((tmpBufR[NUM_ALLPASS-1] * gReverbRevIndex) / 256);
for (; i < NUM_ALLPASS; ++i, ++j) {
tmpBufL[i] = delayBufs[0][i][allpassIdx[i]];
tmpBufR[i] = delayBufs[1][i][allpassIdx[i]];
tmpBufL[i] = delayBufsL[i][allpassIdx[i]];
tmpBufR[i] = delayBufsR[i][allpassIdx[i]];
if (j == 2) {
j = -1;
outTmpL += (tmpBufL[i] * reverbMults[0][k]) / 256;
outTmpR += (tmpBufR[i] * reverbMults[1][k++]) / 256;
delayBufs[0][i][allpassIdx[i]] = tmpCarryoverL;
delayBufs[1][i][allpassIdx[i]] = tmpCarryoverR;
delayBufsL[i][allpassIdx[i]] = tmpCarryoverL;
delayBufsR[i][allpassIdx[i]] = tmpCarryoverR;
if (i != NUM_ALLPASS - 1) {
tmpCarryoverL = (tmpBufL[i] * gReverbRevIndex) / 256;
tmpCarryoverR = (tmpBufR[i] * gReverbRevIndex) / 256;
}
}
else {
delayBufs[0][i][allpassIdx[i]] = (tmpBufL[i] * (-gReverbGainIndex)) / 256 + tmpCarryoverL;
delayBufs[1][i][allpassIdx[i]] = (tmpBufR[i] * (-gReverbGainIndex)) / 256 + tmpCarryoverR;
delayBufsL[i][allpassIdx[i]] = (tmpBufL[i] * (-gReverbGainIndex)) / 256 + tmpCarryoverL;
delayBufsR[i][allpassIdx[i]] = (tmpBufR[i] * (-gReverbGainIndex)) / 256 + tmpCarryoverR;
if (i == 6)
delayBufs[1][i][allpassIdx[i]] += inSampleR; // Unique to right channel
delayBufsR[i][allpassIdx[i]] += inSampleR; // Unique to right channel
tmpCarryoverL = (delayBufs[0][i][allpassIdx[i]] * gReverbGainIndex) / 256 + tmpBufL[i];
tmpCarryoverR = (delayBufs[1][i][allpassIdx[i]] * gReverbGainIndex) / 256 + tmpBufR[i];
tmpCarryoverL = (delayBufsL[i][allpassIdx[i]] * gReverbGainIndex) / 256 + tmpBufL[i];
tmpCarryoverR = (delayBufsR[i][allpassIdx[i]] * gReverbGainIndex) / 256 + tmpBufR[i];
}
if (++allpassIdx[i] == delays[i])
@@ -221,18 +222,18 @@ inline void reverb_mono_sample(s16 *outSample, s32 inSample) {
s32 tmpCarryover = ((tmpBufL[NUM_ALLPASS-1] * gReverbRevIndex) / 256) + inSample;
for (; i < NUM_ALLPASS; ++i, ++j) {
tmpBufL[i] = delayBufs[0][i][allpassIdx[i]];
tmpBufL[i] = delayBufsL[i][allpassIdx[i]];
if (j == 2) {
j = -1;
outTmp += (tmpBufL[i] * reverbMults[0][k++]) / 256;
delayBufs[0][i][allpassIdx[i]] = tmpCarryover;
delayBufsL[i][allpassIdx[i]] = tmpCarryover;
if (i != NUM_ALLPASS - 1)
tmpCarryover = (tmpBufL[i] * gReverbRevIndex) / 256;
}
else {
delayBufs[0][i][allpassIdx[i]] = (tmpBufL[i] * (-gReverbGainIndex)) / 256 + tmpCarryover;
tmpCarryover = (delayBufs[0][i][allpassIdx[i]] * gReverbGainIndex) / 256 + tmpBufL[i];
delayBufsL[i][allpassIdx[i]] = (tmpBufL[i] * (-gReverbGainIndex)) / 256 + tmpCarryover;
tmpCarryover = (delayBufsL[i][allpassIdx[i]] * gReverbGainIndex) / 256 + tmpBufL[i];
}
if (++allpassIdx[i] == delays[i])

View File

@@ -30,7 +30,8 @@
extern s32 betterReverbWindowsSize;
extern const s32 delaysBaseline[NUM_ALLPASS];
extern s32 delays[NUM_ALLPASS];
extern s32 ***delayBufs;
extern s32 **delayBufsL;
extern s32 **delayBufsR;
extern u8 toggleBetterReverb;
extern s8 betterReverbConsoleDownsample;