diff --git a/HISTORY.txt b/HISTORY.txt index e5b98bf..7f2ee17 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -153,6 +153,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke) * fixed YM2413 carrier/modulator phase reset after channel Key ON (Japanese Master System BIOS music) * fixed YM2413 intruments ROM (verified on YM2413B die) * fixed YM2413 EG resolution bits (verified on YM2413B die) +* fixed YM2413 EG "dump" rate (verified on YM2413 hardware) [Gamecube/Wii] --------------- diff --git a/builds/genesis_plus_gx_libretro.dll b/builds/genesis_plus_gx_libretro.dll index 3c1a3e0..12c0d47 100644 Binary files a/builds/genesis_plus_gx_libretro.dll and b/builds/genesis_plus_gx_libretro.dll differ diff --git a/builds/genplus_cube.dol b/builds/genplus_cube.dol index 94a437c..ac5b52d 100644 Binary files a/builds/genplus_cube.dol and b/builds/genplus_cube.dol differ diff --git a/builds/genplus_wii.dol b/builds/genplus_wii.dol index 3540905..6478cc6 100644 Binary files a/builds/genplus_wii.dol and b/builds/genplus_wii.dol differ diff --git a/core/sound/ym2413.c b/core/sound/ym2413.c index 5e5463b..074141f 100644 --- a/core/sound/ym2413.c +++ b/core/sound/ym2413.c @@ -32,6 +32,7 @@ to do: /** 2021/04/23: fixed synchronization of carrier/modulator phase reset after channel Key ON (fixes Japanese Master System BIOS music) **/ /** 2021/04/24: fixed intruments ROM (verified on YM2413B die, cf. https://siliconpr0n.org/archive/doku.php?id=vendor:yamaha:opl2#ym2413_instrument_rom) **/ /** 2021/04/24: fixed EG resolution bits (verified on YM2413B die, cf. https://www.smspower.org/Development/YM2413ReverseEngineeringNotes2015-03-20) **/ +/** 2021/04/24: fixed EG "dump" rate (verified on YM2413 real hardware, cf. https://www.smspower.org/Development/YM2413ReverseEngineeringNotes2015-12-31) **/ #include "shared.h" @@ -578,19 +579,20 @@ INLINE void advance(void) if ( !(ym2413.eg_cnt & ((1<eg_sh_dp)-1) ) ) { op->volume += eg_inc[op->eg_sel_dp + ((ym2413.eg_cnt>>op->eg_sh_dp)&7)]; + } - if ( op->volume >= MAX_ATT_INDEX ) - { - op->volume = MAX_ATT_INDEX; - op->state = EG_ATT; + /* attack phase should be started if attenuation is already maximal, without waiting for next envelope update (every 2 samples during dump phase) */ + if ( op->volume >= MAX_ATT_INDEX ) + { + op->volume = MAX_ATT_INDEX; + op->state = EG_ATT; - /*dump phase is performed by both operators in each channel*/ - /*when CARRIER envelope gets down to zero level, - *phases in BOTH operators are reset (at the same time ?) - */ - if (i&1) - CH->SLOT[0].phase = CH->SLOT[1].phase = 0; - } + /*dump phase is performed by both operators in each channel*/ + /*when CARRIER envelope gets down to zero level, + *phases in BOTH operators are reset (at the same time ?) + */ + if (i&1) + CH->SLOT[0].phase = CH->SLOT[1].phase = 0; } break; @@ -1200,7 +1202,7 @@ INLINE void CALC_FCSLOT(YM2413_OPLL_CH *CH,YM2413_OPLL_SLOT *SLOT) SLOT->eg_sh_rs = eg_rate_shift [SLOT_rs + SLOT->ksr ]; SLOT->eg_sel_rs = eg_rate_select[SLOT_rs + SLOT->ksr ]; - SLOT_dp = 16 + (13<<2); + SLOT_dp = 16 + (12<<2); SLOT->eg_sh_dp = eg_rate_shift [SLOT_dp + SLOT->ksr ]; SLOT->eg_sel_dp = eg_rate_select[SLOT_dp + SLOT->ksr ]; }