diff --git a/source/cart_hw/datel.c b/source/cart_hw/datel.c index 8faab21..4989b51 100644 --- a/source/cart_hw/datel.c +++ b/source/cart_hw/datel.c @@ -21,9 +21,8 @@ #include "shared.h" -#define TYPE_AR 0x01 -#define TYPE_PRO1 0x02 -#define TYPE_PRO2 0x03 +#define TYPE_PRO1 0x12 +#define TYPE_PRO2 0x22 static struct { diff --git a/source/gx/config.c b/source/gx/config.c index 46e23a0..a3a9e98 100644 --- a/source/gx/config.c +++ b/source/gx/config.c @@ -71,6 +71,7 @@ void config_default(void) config.hq_fm = 1; config.psgBoostNoise = 0; config.filter = 1; + config.lp_range = 50; config.low_freq = 880; config.high_freq = 5000; config.lg = 1.0; diff --git a/source/gx/config.h b/source/gx/config.h index 5c00934..5a4a378 100644 --- a/source/gx/config.h +++ b/source/gx/config.h @@ -36,8 +36,9 @@ typedef struct int32 psg_preamp; int32 fm_preamp; uint8 filter; - uint16 low_freq; - uint16 high_freq; + int16 lp_range; + int16 low_freq; + int16 high_freq; float lg; float mg; float hg; diff --git a/source/gx/gui/legal.c b/source/gx/gui/legal.c index e435676..4684576 100644 --- a/source/gx/gui/legal.c +++ b/source/gx/gui/legal.c @@ -36,7 +36,6 @@ void legal () { int ypos = 56; - gxClearScreen((GXColor)BLACK); FONT_writeCenter ("DISCLAIMER",22,0,640,ypos,(GXColor)WHITE); diff --git a/source/gx/gui/menu.c b/source/gx/gui/menu.c index 70eae48..1ad2550 100644 --- a/source/gx/gui/menu.c +++ b/source/gx/gui/menu.c @@ -224,11 +224,11 @@ static gui_item items_audio[10] = {NULL,NULL,"PSG Volume: 2.50", "Adjust SN76489 output level", 52,132,276,48}, {NULL,NULL,"FM Volume: 1.00", "Adjust YM2612 output level", 52,132,276,48}, {NULL,NULL,"Filtering: 3-BAND EQ", "Setup Audio filtering", 52,132,276,48}, - {NULL,NULL,"Low Freq: 200 Hz", "Adjust EQ Low Band Frequency", 52,132,276,48}, - {NULL,NULL,"High Freq: 20000 Hz","Adjust EQ High Band Frequency",52,132,276,48}, {NULL,NULL,"Low Gain: 1.00", "Adjust EQ Low Band Gain", 52,132,276,48}, - {NULL,NULL,"Middle Gain: 1.00", "Adjust EQ Middle Band Gain", 52,132,276,48}, + {NULL,NULL,"Mid Gain: 1.00", "Adjust EQ Middle Band Gain", 52,132,276,48}, {NULL,NULL,"High Gain: 1.00", "Adjust EQ High BandGain", 52,132,276,48}, + {NULL,NULL,"Low Freq: 200 Hz", "Adjust EQ Low Band Frequency", 52,132,276,48}, + {NULL,NULL,"High Freq: 20000 Hz", "Adjust EQ High Band Frequency",52,132,276,48} }; /* System options menu */ @@ -700,8 +700,8 @@ static void soundmenu () int ret, quit = 0; gui_menu *m = &menu_audio; gui_item *items = m->items; - float psg_volume = (double)config.psg_preamp/100.0; - float fm_volume = (double)config.fm_preamp/100.0; + float psg_volume = (float)config.psg_preamp/100.0; + float fm_volume = (float)config.fm_preamp/100.0; sprintf (items[0].text, "High-Quality FM: %s", config.hq_fm ? "ON":"OFF"); sprintf (items[1].text, "PSG Noise Boost: %s", config.psgBoostNoise ? "ON":"OFF"); @@ -710,18 +710,29 @@ static void soundmenu () if (config.filter == 2) sprintf (items[4].text, "Filtering: 3-BAND EQ"); else if (config.filter == 1) sprintf (items[4].text, "Filtering: LOW PASS"); else sprintf (items[4].text, "Filtering: OFF"); - sprintf (items[5].text, "Low Freq: %d", config.low_freq); - sprintf (items[6].text, "High Freq: %d", config.high_freq); - sprintf (items[7].text, "Low Gain: %1.2f", config.lg); - sprintf (items[8].text, "Middle Gain: %1.2f", config.mg); - sprintf (items[9].text, "High Gain: %1.2f", config.hg); + if (config.filter == 2) + { + sprintf (items[5].text, "Low Gain: %1.2f", config.lg); + strcpy (items[5].comment, "Adjust EQ Low Band Gain"); + sprintf (items[6].text, "Middle Gain: %1.2f", config.mg); + sprintf (items[7].text, "High Gain: %1.2f", config.hg); + sprintf (items[8].text, "Low Freq: %d", config.low_freq); + sprintf (items[9].text, "High Freq: %d", config.high_freq); + } + else if (config.filter == 1) + { + sprintf (items[5].text, "Low-Pass Rate: %d %%", config.lp_range); + strcpy (items[5].comment, "Adjust Low Pass filter"); + } GUI_InitMenu(m); - if (config.filter < 2) - m->max_items = 5; - else + if (config.filter == 1) + m->max_items = 6; + else if (config.filter == 2) m->max_items = 10; + else + m->max_items = 5; GUI_SlideMenuTitle(m,strlen("Audio ")); @@ -761,7 +772,7 @@ static void soundmenu () case 3: GUI_OptionBox(m,0,"FM Volume",(void *)&fm_volume,0.01,0.0,5.0,0); - sprintf (items[3].text, "FM Volume: %1.2f", (double)config.fm_preamp/100.0); + sprintf (items[3].text, "FM Volume: %1.2f", fm_volume); config.fm_preamp = (int)(fm_volume * 100.0); break; @@ -769,56 +780,71 @@ static void soundmenu () config.filter ++; if (config.filter > 2) config.filter = 0; if (config.filter == 2) - sprintf (items[4].text, "Filtering: 3-BAND EQ"); - else if (config.filter == 1) - sprintf (items[4].text, "Filtering: LOW PASS"); - else - sprintf (items[4].text, "Filtering: OFF"); - - if (config.filter < 2) { - /* reset menu selection */ - m->offset = 1; - m->selected = 3; - m->max_items = 5; + m->max_items = 10; + sprintf (items[4].text, "Filtering: 3-BAND EQ"); + sprintf (items[5].text, "Low Gain: %1.2f", config.lg); + strcpy (items[5].comment, "Adjust EQ Low Band Gain"); + sprintf (items[6].text, "Middle Gain: %1.2f", config.mg); + sprintf (items[7].text, "High Gain: %1.2f", config.hg); + sprintf (items[8].text, "Low Freq: %d", config.low_freq); + sprintf (items[9].text, "High Freq: %d", config.high_freq); + } + else if (config.filter == 1) + { + m->max_items = 6; + sprintf (items[4].text, "Filtering: LOW PASS"); + sprintf (items[5].text, "Low-Pass Rate: %d %%", config.lp_range); + strcpy (items[5].comment, "Adjust Low Pass filter"); } else { - /* enable items */ - m->max_items = 10; + sprintf (items[4].text, "Filtering: OFF"); + m->max_items = 5; + m->offset = 1; + m->selected = 3; + } - /* intialize EQ */ + /* reintialize EQ */ + audio_set_equalizer(); + + break; + + case 5: + if (config.filter == 1) + { + GUI_OptionBox(m,0,"Low-Pass Rate",(void *)&config.lp_range,1,0,100,1); + sprintf (items[5].text, "Low-Pass Rate: %d %%", config.lp_range); + } + else + { + GUI_OptionBox(m,0,"Low Gain",(void *)&config.lg,0.01,0.0,2.0,0); + sprintf (items[5].text, "Low Gain: %1.2f", config.lg); audio_set_equalizer(); } break; - case 5: - GUI_OptionBox(m,0,"Low Frequency",(void *)&config.low_freq,10,0,config.high_freq,1); - sprintf (items[5].text, "Low Freq: %d", config.low_freq); - audio_set_equalizer(); - break; - case 6: - GUI_OptionBox(m,0,"High Frequency",(void *)&config.high_freq,100,config.low_freq,30000,1); - sprintf (items[6].text, "High Freq: %d", config.high_freq); + GUI_OptionBox(m,0,"Middle Gain",(void *)&config.mg,0.01,0.0,2.0,0); + sprintf (items[6].text, "Middle Gain: %1.2f", config.mg); audio_set_equalizer(); break; case 7: - GUI_OptionBox(m,0,"Low Gain",(void *)&config.lg,0.01,0.0,2.0,0); - sprintf (items[7].text, "Low Gain: %1.2f", config.lg); + GUI_OptionBox(m,0,"High Gain",(void *)&config.hg,0.01,0.0,2.0,0); + sprintf (items[7].text, "High Gain: %1.2f", config.hg); audio_set_equalizer(); break; case 8: - GUI_OptionBox(m,0,"Middle Gain",(void *)&config.mg,0.01,0.0,2.0,0); - sprintf (items[8].text, "Middle Gain: %1.2f", config.mg); + GUI_OptionBox(m,0,"Low Frequency",(void *)&config.low_freq,10,0,config.high_freq,1); + sprintf (items[8].text, "Low Freq: %d", config.low_freq); audio_set_equalizer(); break; case 9: - GUI_OptionBox(m,0,"High Gain",(void *)&config.hg,0.01,0.0,2.0,0); - sprintf (items[9].text, "High Gain: %1.2f", config.hg); + GUI_OptionBox(m,0,"High Frequency",(void *)&config.high_freq,100,config.low_freq,30000,1); + sprintf (items[9].text, "High Freq: %d", config.high_freq); audio_set_equalizer(); break; diff --git a/source/gx/osd.h b/source/gx/osd.h index b61cf46..fa125e7 100644 --- a/source/gx/osd.h +++ b/source/gx/osd.h @@ -33,9 +33,9 @@ #define SK_UPMEM "/genplus/sk2chip.bin" #ifdef HW_RVL -#define VERSION "version 1.4.0W" +#define VERSION "version 1.3.XW" #else -#define VERSION "version 1.4.0G" +#define VERSION "version 1.3.XG" #endif /* globals */ diff --git a/source/system.c b/source/system.c index ab2a13d..dffe89a 100644 --- a/source/system.c +++ b/source/system.c @@ -54,14 +54,19 @@ void audio_set_equalizer(void) /**************************************************************** * AUDIO stream update ****************************************************************/ -static int ll, rr; +static int llp,rrp; + void audio_update (int size) { - int i; - int l, r; - int psg_preamp = config.psg_preamp; - int fm_preamp = config.fm_preamp; - int filter = config.filter; + int i, l, r; + int ll = llp; + int rr = rrp; + + int psg_preamp = config.psg_preamp; + int fm_preamp = config.fm_preamp; + int filter = config.filter; + uint32 factora = (config.lp_range << 16) / 100; + uint32 factorb = 0x10000 - factora; int16 *fm[2] = {snd.fm.buffer[0],snd.fm.buffer[1]}; int16 *psg = snd.psg.buffer; @@ -97,10 +102,10 @@ void audio_update (int size) if (filter & 1) { /* single-pole low-pass filter (6 dB/octave) */ - l = (ll + l) >> 1; - r = (rr + r) >> 1; - ll = l; - rr = r; + ll = (ll>>16)*factorb + l*factora; + rr = (rr>>16)*factorb + r*factora; + l = ll >> 16; + r = rr >> 16; } else if (filter & 2) { @@ -124,6 +129,10 @@ void audio_update (int size) *sb++ = l; #endif } + + /* save delayed samples */ + llp = ll; + rrp = rr; } /**************************************************************** diff --git a/source/system.h b/source/system.h index ddbd2b4..0c53d77 100644 --- a/source/system.h +++ b/source/system.h @@ -85,6 +85,7 @@ extern uint32 count_z80; extern uint32 line_z80; extern int32 current_z80; extern uint8 system_hw; +extern uint32 count_z80; /* Function prototypes */ extern int audio_init (int rate);