mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-13 06:15:07 +01:00
[Core/Sound] fixed 3-Band EQ implementation
This commit is contained in:
parent
5a3cfbc1b9
commit
f6f4556533
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
Binary file not shown.
Before Width: | Height: | Size: 3.4 MiB After Width: | Height: | Size: 3.4 MiB |
@ -5,7 +5,7 @@
|
||||
* Support for 16-bit & 8-bit hardware modes
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
@ -52,7 +52,7 @@ uint32 system_clock;
|
||||
int16 SVP_cycles = 800;
|
||||
|
||||
static uint8 pause_b;
|
||||
static EQSTATE eq;
|
||||
static EQSTATE eq[2];
|
||||
static int16 llp,rrp;
|
||||
|
||||
/******************************************************************************************/
|
||||
@ -171,10 +171,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)
|
||||
@ -264,8 +265,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;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Support for 16-bit & 8-bit hardware modes
|
||||
*
|
||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||
* Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX)
|
||||
*
|
||||
* Redistribution and use of this code or any derivative works are permitted
|
||||
* provided that the following conditions are met:
|
||||
|
@ -46,9 +46,9 @@ void set_config_defaults(void)
|
||||
config.filter = 1;
|
||||
config.low_freq = 200;
|
||||
config.high_freq = 8000;
|
||||
config.lg = 1.0;
|
||||
config.mg = 1.0;
|
||||
config.hg = 1.0;
|
||||
config.lg = 100;
|
||||
config.mg = 100;
|
||||
config.hg = 100;
|
||||
config.lp_range = 0x9999; /* 0.6 in 16.16 fixed point */
|
||||
config.dac_bits = 14;
|
||||
config.ym2413 = 1; /* = AUTO (0 = always OFF, 1 = always ON) */
|
||||
|
@ -106,9 +106,9 @@ void config_default(void)
|
||||
config.lp_range = 0x9999; /* 0.6 in 16.16 fixed point */
|
||||
config.low_freq = 880;
|
||||
config.high_freq = 5000;
|
||||
config.lg = 1.0;
|
||||
config.mg = 1.0;
|
||||
config.hg = 1.0;
|
||||
config.lg = 100;
|
||||
config.mg = 100;
|
||||
config.hg = 100;
|
||||
config.dac_bits = 14;
|
||||
config.ym2413 = 2; /* AUTO */
|
||||
config.mono = 0;
|
||||
|
@ -153,7 +153,7 @@ static char arvalidchars[] = "0123456789ABCDEF";
|
||||
#define SOUND_FREQUENCY 44100
|
||||
|
||||
/* Hide the EQ settings for now */
|
||||
//#define HAVE_EQ
|
||||
/*#define HAVE_EQ*/
|
||||
|
||||
/************************************
|
||||
* Genesis Plus GX implementation
|
||||
@ -509,9 +509,9 @@ static void config_default(void)
|
||||
config.lp_range = 0x9999; /* 0.6 in 16.16 fixed point */
|
||||
config.low_freq = 880;
|
||||
config.high_freq = 5000;
|
||||
config.lg = 100.0;
|
||||
config.mg = 100.0;
|
||||
config.hg = 100.0;
|
||||
config.lg = 100;
|
||||
config.mg = 100;
|
||||
config.hg = 100;
|
||||
config.dac_bits = 14; /* MAX DEPTH */
|
||||
config.ym2413 = 2; /* AUTO */
|
||||
config.mono = 0; /* STEREO output */
|
||||
@ -1240,9 +1240,9 @@ static uint32_t decode_cheat(char *string, int index)
|
||||
uint8_t ref = 0;
|
||||
|
||||
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD){
|
||||
//If system is Genesis-based
|
||||
/*If system is Genesis-based*/
|
||||
|
||||
//Game-Genie
|
||||
/*Game-Genie*/
|
||||
if ((strlen(string) >= 9) && (string[4] == '-'))
|
||||
{
|
||||
for (i = 0; i < 8; i++)
|
||||
@ -1286,7 +1286,7 @@ static uint32_t decode_cheat(char *string, int index)
|
||||
len = 9;
|
||||
}
|
||||
|
||||
//Patch and PAR
|
||||
/*Patch and PAR*/
|
||||
else if ((strlen(string) >=9) && (string[6] == ':'))
|
||||
{
|
||||
/* decode 24-bit address */
|
||||
@ -1310,9 +1310,9 @@ static uint32_t decode_cheat(char *string, int index)
|
||||
len = 11;
|
||||
}
|
||||
} else {
|
||||
//If System is Master-based
|
||||
/*If System is Master-based*/
|
||||
|
||||
//Game Genie
|
||||
/*Game Genie*/
|
||||
if ((strlen(string) >=7) && (string[3] == '-'))
|
||||
{
|
||||
/* decode 8-bit data */
|
||||
@ -1361,7 +1361,7 @@ static uint32_t decode_cheat(char *string, int index)
|
||||
}
|
||||
}
|
||||
|
||||
//Action Replay
|
||||
/*Action Replay*/
|
||||
else if ((strlen(string) >=9) && (string[4] == '-')){
|
||||
string+=2;
|
||||
/* decode 16-bit address */
|
||||
@ -1385,7 +1385,7 @@ static uint32_t decode_cheat(char *string, int index)
|
||||
len = 9;
|
||||
}
|
||||
|
||||
//Fusion RAM
|
||||
/*Fusion RAM*/
|
||||
else if ((strlen(string) >=7) && (string[4] == ':'))
|
||||
{
|
||||
/* decode 16-bit address */
|
||||
@ -1409,7 +1409,7 @@ static uint32_t decode_cheat(char *string, int index)
|
||||
len = 7;
|
||||
}
|
||||
|
||||
//Fusion ROM
|
||||
/*Fusion ROM*/
|
||||
else if ((strlen(string) >=9) && (string[6] == ':'))
|
||||
{
|
||||
/* decode reference 8-bit data */
|
||||
@ -1628,7 +1628,7 @@ void retro_set_environment(retro_environment_t cb)
|
||||
{ "genesis_plus_gx_lock_on", "Cartridge lock-on; disabled|game genie|action replay (pro)|sonic & knuckles" },
|
||||
{ "genesis_plus_gx_ym2413", "Master System FM; auto|disabled|enabled" },
|
||||
{ "genesis_plus_gx_dac_bits", "YM2612 DAC quantization; disabled|enabled" },
|
||||
{ "genesis_plus_gx_audio_filter", "Audio filter; disabled|Lowpass" },
|
||||
{ "genesis_plus_gx_audio_filter", "Audio filter; disabled|low-pass" },
|
||||
{ "genesis_plus_gx_lowpass_range", "Low-pass filter %; 60|65|70|75|80|85|90|95|5|10|15|20|25|30|35|40|45|50|55"},
|
||||
|
||||
#if HAVE_EQ
|
||||
|
@ -15,9 +15,9 @@ void set_config_defaults(void)
|
||||
config.filter = 1;
|
||||
config.low_freq = 200;
|
||||
config.high_freq = 8000;
|
||||
config.lg = 1.0;
|
||||
config.mg = 1.0;
|
||||
config.hg = 1.0;
|
||||
config.lg = 100;
|
||||
config.mg = 100;
|
||||
config.hg = 100;
|
||||
config.lp_range = 0x9999; /* 0.6 in 16.16 fixed point */
|
||||
config.dac_bits = 14;
|
||||
config.ym2413 = 2; /* = AUTO (0 = always OFF, 1 = always ON) */
|
||||
|
@ -16,9 +16,9 @@ void set_config_defaults(void)
|
||||
config.filter = 1;
|
||||
config.low_freq = 200;
|
||||
config.high_freq = 8000;
|
||||
config.lg = 1.0;
|
||||
config.mg = 1.0;
|
||||
config.hg = 1.0;
|
||||
config.lg = 100;
|
||||
config.mg = 100;
|
||||
config.hg = 100;
|
||||
config.lp_range = 0x9999; /* 0.6 in 16.16 fixed point */
|
||||
config.dac_bits = 14;
|
||||
config.ym2413 = 2; /* = AUTO (0 = always OFF, 1 = always ON) */
|
||||
|
Loading…
Reference in New Issue
Block a user