[Core/Sound] fixed carrier/modulator phase reset after channel Key ON in MAME YM2413 core

This commit is contained in:
ekeeke 2021-04-23 01:27:50 +02:00
parent cea418ece8
commit 305f89489e
4 changed files with 9 additions and 7 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -25,7 +25,8 @@ to do:
*/
/** EkeEke (2011): removed multiple chips support, cleaned code & added FM board interface for Genesis Plus GX **/
/** EkeEke (2011/xx/xx): removed multiple chips support, cleaned code & added FM board interface for Genesis Plus GX **/
/** EkeEke (2021/04/23): fixed synchronization of carrier/modulator phase reset after channel Key ON (fixes Master System BIOS music) **/
#include "shared.h"
@ -543,10 +544,6 @@ INLINE void advance(void)
switch(op->state)
{
case EG_DMP: /* dump phase */
/*dump phase is performed by both operators in each channel*/
/*when CARRIER envelope gets down to zero level,
** phases in BOTH opearators are reset (at the same time ?)
*/
if ( !(ym2413.eg_cnt & ((1<<op->eg_sh_dp)-1) ) )
{
op->volume += eg_inc[op->eg_sel_dp + ((ym2413.eg_cnt>>op->eg_sh_dp)&7)];
@ -555,8 +552,13 @@ INLINE void advance(void)
{
op->volume = MAX_ATT_INDEX;
op->state = EG_ATT;
/* restart Phase Generator */
op->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;