mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
Backport OPL2 KSL table fix from MAME v0.150.
This commit is contained in:
parent
92697659be
commit
4b0aac9816
1 changed files with 5 additions and 2 deletions
|
@ -323,6 +323,10 @@ static const UINT32 ksl_tab[8*16]=
|
||||||
};
|
};
|
||||||
#undef DV
|
#undef DV
|
||||||
|
|
||||||
|
/* 0 / 3.0 / 1.5 / 6.0 dB/OCT */
|
||||||
|
static const UINT32 ksl_shift[4] = { 31, 1, 2, 0 };
|
||||||
|
|
||||||
|
|
||||||
/* sustain level table (3dB per step) */
|
/* sustain level table (3dB per step) */
|
||||||
/* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/
|
/* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/
|
||||||
#define SC(db) (UINT32) ( db * (2.0/ENV_STEP) )
|
#define SC(db) (UINT32) ( db * (2.0/ENV_STEP) )
|
||||||
|
@ -1271,9 +1275,8 @@ void set_ksl_tl(FM_OPL *OPL,int slot,int v)
|
||||||
{
|
{
|
||||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||||
int ksl = v>>6; /* 0 / 1.5 / 3.0 / 6.0 dB/OCT */
|
|
||||||
|
|
||||||
SLOT->ksl = ksl ? 3-ksl : 31;
|
SLOT->ksl = ksl_shift[v >> 6];
|
||||||
SLOT->TL = (v&0x3f)<<(ENV_BITS-1-7); /* 7 bits TL (bit 6 = always 0) */
|
SLOT->TL = (v&0x3f)<<(ENV_BITS-1-7); /* 7 bits TL (bit 6 = always 0) */
|
||||||
|
|
||||||
SLOT->TLL = SLOT->TL + (CH->ksl_base>>SLOT->ksl);
|
SLOT->TLL = SLOT->TL + (CH->ksl_base>>SLOT->ksl);
|
||||||
|
|
Loading…
Reference in a new issue