More reverb fixey stuffs

This commit is contained in:
gheskett
2021-08-03 01:45:33 -05:00
parent 7ef6453316
commit dc70030149
4 changed files with 30 additions and 13 deletions

View File

@@ -152,7 +152,7 @@
// Makes the coins ia8 64x64 instead of ia16 32x32. Uses new ia8 textures so that vanilla coins look better.
#define IA8_COINS
// tmp
// #define BETTER_REVERB
#define BETTER_REVERB
// If you want to change the extended boundaries mode, go to engine/extended_bounds.h and change EXTENDED_BOUNDS_MODE

View File

@@ -1117,6 +1117,7 @@ void audio_reset_session(void) {
#if defined(VERSION_JP) || defined(VERSION_US)
s32 frames;
s32 remainingDmas;
s8 reverbConsole;
#else
struct SynthesisReverb *reverb;
#endif
@@ -1230,8 +1231,14 @@ void audio_reset_session(void) {
gSamplesPerFrameTarget = ALIGN16(gAiFrequency / 60);
gReverbDownsampleRate = preset->reverbDownsampleRate;
#ifdef BETTER_REVERB
if (gReverbDownsampleRate == 1)
gReverbDownsampleRate = 2;
if (IO_READ(DPC_PIPEBUSY_REG) != 0)
reverbConsole = 3; // Is a console user; change to 4 if still too slow
else
reverbConsole = 2;
if (gReverbDownsampleRate < reverbConsole)
gReverbDownsampleRate = reverbConsole;
reverbWindowSize /= (1 << (gReverbDownsampleRate - 1));
#endif
switch (gReverbDownsampleRate) {
@@ -1425,6 +1432,9 @@ void audio_reset_session(void) {
}
}
#ifdef BETTER_REVERB
for (i = 0; i < NUM_ALLPASS; ++i)
delays[i] = delaysBaseline[i] / (1 << (gReverbDownsampleRate - 1));
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*));

View File

@@ -53,15 +53,21 @@ s32 gReverbGainIndex = 65;
s32 gReverbWetSignal = 95;
s32 gReverbDrySignal = 15;
u32 delays[NUM_ALLPASS] = {
540, 675, 600,
690, 525, 675,
600, 615, 715,
465, 750, 755
const u32 delaysBaseline[NUM_ALLPASS] = {
1080, 1352, 1200,
1384, 1048, 1352,
1200, 1232, 1432,
928, 1504, 1512
};
const f32 reverbMults[2][NUM_ALLPASS / 3] = {
{0.82f, 0.43f, 0.21f, 0.12f},
{0.22f, 0.15f, 0.81f, 0.44f}
u32 delays[NUM_ALLPASS] = {
1080, 1352, 1200,
1384, 1048, 1352,
1200, 1232, 1432,
928, 1504, 1512
};
const s32 reverbMults[2][NUM_ALLPASS / 3] = {
{82, 43, 21, 12},
{22, 15, 81, 44}
};
u32 allpassIdx[2][NUM_ALLPASS] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
@@ -119,7 +125,7 @@ inline s16 reverb_sample_left(s16 inSample) {
// modCheck = i % 6;
if (/*modCheck == 2 || modCheck == 5*/ i % 3 == 2) {
outTmp += tmpBuf[i] * reverbMults[0][i / 3];
outTmp += (tmpBuf[i] * reverbMults[0][i / 3]) / 100;
delayBufs[0][i][allpassIdx[0][i]] = tmpCarryover;
if (i != NUM_ALLPASS - 1)
tmpCarryover = (tmpBuf[i] * gReverbRevIndex) / 100;
@@ -158,7 +164,7 @@ inline s16 reverb_sample_right(s16 inSample) {
// modCheck = i % 6;
if (/*modCheck == 2 || modCheck == 5*/ i % 3 == 2) {
outTmp += tmpBuf[i] * reverbMults[1][i / 3];
outTmp += (tmpBuf[i] * reverbMults[1][i / 3]) / 100;
delayBufs[1][i][allpassIdx[1][i]] = tmpCarryover;
if (i != NUM_ALLPASS - 1)
tmpCarryover = (tmpBuf[i] * gReverbRevIndex) / 100;

View File

@@ -25,6 +25,7 @@
#define NUM_ALLPASS 12
extern const u32 delaysBaseline[NUM_ALLPASS];
extern u32 delays[NUM_ALLPASS];
extern s32 ***delayBufs;