Fix 3 band equalizer in Genesis (#2008)

If you tried setting your gains to 100 in the previous patch, it worked sort of, but I decided to incorporate ekeeke/Genesis-Plus-GX@f6f4556 as well to actually fix it completely, and rescale the setting properly so that 1.0 really is neutral gain.

Fixes #1319
This commit is contained in:
nattthebear 2020-05-14 20:29:02 -04:00 committed by GitHub
parent 68dc12dab7
commit 00aebc110c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1397 additions and 1396 deletions

Binary file not shown.

View File

@ -265,18 +265,18 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
[DisplayName("Three band low gain")]
[Description("Only active when filter type is three band")]
[DefaultValue((short)1)]
public short LowGain { get; set; }
[DefaultValue(1f)]
public float LowGain { get; set; }
[DisplayName("Three band mid gain")]
[Description("Only active when filter type is three band")]
[DefaultValue((short)1)]
public short MidGain { get; set; }
[DefaultValue(1f)]
public float MidGain { get; set; }
[DisplayName("Three band high gain")]
[Description("Only active when filter type is three band")]
[DefaultValue((short)1)]
public short HighGain { get; set; }
[DefaultValue(1f)]
public float HighGain { get; set; }
[Description("Magic pink by default. Requires core reboot")]
[TypeConverter(typeof(UintToHexConverter))]
@ -291,9 +291,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
LowPassRange = LowPassRange,
LowFreq = LowFreq,
HighFreq = HighFreq,
LowGain = LowGain,
MidGain = MidGain,
HighGain = HighGain,
LowGain = (short)(LowGain * 100),
MidGain = (short)(MidGain * 100),
HighGain = (short)(HighGain * 100),
BackdropColor = BackdropColor
};
}

View File

@ -546,9 +546,9 @@ GPGX_EX int gpgx_init(
config.lp_range = settings->LowPassRange; //0x9999; /* 0.6 in 16.16 fixed point */
config.low_freq = settings->LowFreq; //880;
config.high_freq = settings->HighFreq; //5000;
config.lg = settings->LowGain; //1.0;
config.mg = settings->MidGain; //1.0;
config.hg = settings->HighGain; //1.0;
config.lg = settings->LowGain; //100;
config.mg = settings->MidGain; //100;
config.hg = settings->HighGain; //100;
config.dac_bits = 14; /* MAX DEPTH */
config.ym2413= 2; /* AUTO */
config.mono = 0; /* STEREO output */

View File

@ -52,7 +52,7 @@ uint32 system_clock;
const int16 SVP_cycles = 800;
uint8 pause_b;
EQSTATE eq;
static EQSTATE eq[2];
int16 llp,rrp;
/******************************************************************************************/
@ -169,10 +169,11 @@ void audio_reset(void)
void audio_set_equalizer(void)
{
init_3band_state(&eq,config.low_freq,config.high_freq,snd.sample_rate);
eq.lg = (double)(config.lg) / 100.0;
eq.mg = (double)(config.mg) / 100.0;
eq.hg = (double)(config.hg) / 100.0;
init_3band_state(&eq[0],config.low_freq,config.high_freq,snd.sample_rate);
init_3band_state(&eq[1],config.low_freq,config.high_freq,snd.sample_rate);
eq[0].lg = eq[1].lg = (double)(config.lg) / 100.0;
eq[0].mg = eq[1].mg = (double)(config.mg) / 100.0;
eq[0].hg = eq[1].hg = (double)(config.hg) / 100.0;
}
void audio_shutdown(void)
@ -278,8 +279,8 @@ int audio_update(int16 *buffer)
do
{
/* 3 Band EQ */
l = do_3band(&eq,out[0]);
r = do_3band(&eq,out[1]);
l = do_3band(&eq[0],out[0]);
r = do_3band(&eq[1],out[1]);
/* clipping (16-bit samples) */
if (l > 32767) l = 32767;