Halve the reverb input volume as a quick hack. Remove an unnecessary computation.

This commit is contained in:
Henrik Rydgard 2015-10-27 16:34:30 +01:00
parent 07f311fee1
commit 541a5e2c51

View File

@ -17,6 +17,7 @@
#include <stdint.h>
#include "base/basictypes.h"
#include "Globals.h"
#include "Core/HW/SasReverb.h"
@ -62,8 +63,10 @@ struct SasReverbData {
int16_t mRAPF1;
int16_t mLAPF2;
int16_t mRAPF2;
int16_t vLIN;
int16_t vRIN;
// These aren't used for anything else than 1.0 in any of the presets so let's drop them.
// int16_t vLIN;
// int16_t vRIN;
};
static const SasReverbData presets[10] = {
@ -73,7 +76,7 @@ static const SasReverbData presets[10] = {
0x007D,0x005B,0x6D80,0x54B8,(int16_t)0xBED0,0x0000,0x0000,(int16_t)0xBA80,
0x5800,0x5300,0x04D6,0x0333,0x03F0,0x0227,0x0374,0x01EF,
0x0334,0x01B5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x01B4,0x0136,0x00B8,0x005C,(int16_t)0x8000,(int16_t)0x8000,
0x0000,0x0000,0x01B4,0x0136,0x00B8,0x005C, //(int16_t)0x8000,(int16_t)0x8000,
},
{
"Studio Small",
@ -81,7 +84,7 @@ static const SasReverbData presets[10] = {
0x0033,0x0025,0x70F0,0x4FA8,(int16_t)0xBCE0,0x4410,(int16_t)0xC0F0,(int16_t)0x9C00,
0x5280,0x4EC0,0x03E4,0x031B,0x03A4,0x02AF,0x0372,0x0266,
0x031C,0x025D,0x025C,0x018E,0x022F,0x0135,0x01D2,0x00B7,
0x018F,0x00B5,0x00B4,0x0080,0x004C,0x0026,(int16_t)0x8000,(int16_t)0x8000,
0x018F,0x00B5,0x00B4,0x0080,0x004C,0x0026, //(int16_t)0x8000,(int16_t)0x8000,
},
{
@ -90,7 +93,7 @@ static const SasReverbData presets[10] = {
0x00B1,0x007F,0x70F0,0x4FA8,(int16_t)0xBCE0,0x4510,(int16_t)0xBEF0,(int16_t)0xB4C0,
0x5280,0x4EC0,0x0904,0x076B,0x0824,0x065F,0x07A2,0x0616,
0x076C,0x05ED,0x05EC,0x042E,0x050F,0x0305,0x0462,0x02B7,
0x042F,0x0265,0x0264,0x01B2,0x0100,0x0080,(int16_t)0x8000,(int16_t)0x8000,
0x042F,0x0265,0x0264,0x01B2,0x0100,0x0080, //(int16_t)0x8000,(int16_t)0x8000,
},
// Studio Large(size = 6FE0h bytes)
@ -100,7 +103,7 @@ static const SasReverbData presets[10] = {
0x00E3,0x00A9,0x6F60,0x4FA8,(int16_t)0xBCE0,0x4510,(int16_t)0xBEF0,(int16_t)0xA680,
0x5680,0x52C0,0x0DFB,0x0B58,0x0D09,0x0A3C,0x0BD9,0x0973,
0x0B59,0x08DA,0x08D9,0x05E9,0x07EC,0x04B0,0x06EF,0x03D2,
0x05EA,0x031D,0x031C,0x0238,0x0154,0x00AA,(int16_t)0x8000,(int16_t)0x8000,
0x05EA,0x031D,0x031C,0x0238,0x0154,0x00AA, //(int16_t)0x8000,(int16_t)0x8000,
},
{
@ -109,7 +112,7 @@ static const SasReverbData presets[10] = {
0x01A5,0x0139,0x6000,0x5000,0x4C00,(int16_t)0xB800,(int16_t)0xBC00,(int16_t)0xC000,
0x6000,0x5C00,0x15BA,0x11BB,0x14C2,0x10BD,0x11BC,0x0DC1,
0x11C0,0x0DC3,0x0DC0,0x09C1,0x0BC4,0x07C1,0x0A00,0x06CD,
0x09C2,0x05C1,0x05C0,0x041A,0x0274,0x013A,(int16_t)0x8000,(int16_t)0x8000,
0x09C2,0x05C1,0x05C0,0x041A,0x0274,0x013A, //(int16_t)0x8000,(int16_t)0x8000,
},
{
@ -118,7 +121,7 @@ static const SasReverbData presets[10] = {
0x033D,0x0231,0x7E00,0x5000,(int16_t)0xB400,(int16_t)0xB000,0x4C00,(int16_t)0xB000,
0x6000,0x5400,0x1ED6,0x1A31,0x1D14,0x183B,0x1BC2,0x16B2,
0x1A32,0x15EF,0x15EE,0x1055,0x1334,0x0F2D,0x11F6,0x0C5D,
0x1056,0x0AE1,0x0AE0,0x07A2,0x0464,0x0232,(int16_t)0x8000,(int16_t)0x8000,
0x1056,0x0AE1,0x0AE0,0x07A2,0x0464,0x0232, //(int16_t)0x8000,(int16_t)0x8000,
},
{
@ -127,7 +130,7 @@ static const SasReverbData presets[10] = {
0x0001,0x0001,0x7FFF,0x7FFF,0x0000,0x0000,0x0000,(int16_t)0x8100,
0x0000,0x0000,0x1FFF,0x0FFF,0x1005,0x0005,0x0000,0x0000,
0x1005,0x0005,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x1004,0x1002,0x0004,0x0002,(int16_t)0x8000,(int16_t)0x8000,
0x0000,0x0000,0x1004,0x1002,0x0004,0x0002, //(int16_t)0x8000,(int16_t)0x8000,
},
{
@ -136,7 +139,7 @@ static const SasReverbData presets[10] = {
0x0001,0x0001,0x7FFF,0x7FFF,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x1FFF,0x0FFF,0x1005,0x0005,0x0000,0x0000,
0x1005,0x0005,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x1004,0x1002,0x0004,0x0002,(int16_t)0x8000,(int16_t)0x8000,
0x0000,0x0000,0x1004,0x1002,0x0004,0x0002, //(int16_t)0x8000,(int16_t)0x8000,
},
{
@ -145,16 +148,7 @@ static const SasReverbData presets[10] = {
0x0017,0x0013,0x70F0,0x4FA8,(int16_t)0xBCE0,0x4510,(int16_t)0xBEF0,(int16_t)0x8500,
0x5F80,0x54C0,0x0371,0x02AF,0x02E5,0x01DF,0x02B0,0x01D7,
0x0358,0x026A,0x01D6,0x011E,0x012D,0x00B1,0x011F,0x0059,
0x01A0,0x00E3,0x0058,0x0040,0x0028,0x0014,(int16_t)0x8000,(int16_t)0x8000,
},
{
"Reverb off",
0x10,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,
0x01A0,0x00E3,0x0058,0x0040,0x0028,0x0014, //(int16_t)0x8000,(int16_t)0x8000,
},
};
@ -171,7 +165,8 @@ const char *SasReverb::GetPresetName(int preset) {
}
void SasReverb::SetPreset(int preset) {
preset_ = preset;
if (preset < (int)ARRAY_SIZE(presets))
preset_ = preset;
if (preset_ != -1) {
pos_ = BUFSIZE - presets[preset_].size;
memset(workspace_, 0, sizeof(int16_t) * BUFSIZE);
@ -228,10 +223,10 @@ void SasReverb::ProcessReverb(int16_t *output, const int16_t *input, size_t inpu
// Very unoptimized, straight from the description. Can probably be reformulated into something way more efficient.
// For example, we could just do the whole thing in floating point. Should actually be faster.
for (int i = 0; i < inputSize; i++) {
int16_t LeftInput = input[i * 2];
int16_t RightInput = input[i * 2 + 1];
int16_t Lin = (d.vLIN * LeftInput) >> 15;
int16_t Rin = (d.vRIN * RightInput) >> 15;
int16_t LeftInput = input[i * 2] >> 1;
int16_t RightInput = input[i * 2 + 1] >> 1;
int16_t Lin = LeftInput; // (d.vLIN * LeftInput) >> 15;
int16_t Rin = RightInput; // (d.vRIN * RightInput) >> 15;
// ____Same Side Reflection(left - to - left and right - to - right)___________________
b[d.mLSAME] = clamp_s16(Lin + (b[d.dLSAME] * d.vWALL >> 15) - (b[d.mLSAME - 1]*d.vIIR >> 15) + b[d.mLSAME - 1]); // L - to - L
b[d.mRSAME] = clamp_s16(Rin + (b[d.dRSAME] * d.vWALL >> 15) - (b[d.mRSAME - 1]*d.vIIR >> 15) + b[d.mRSAME - 1]); // R - to - R