Nuked OPN2: minor tweaks

This commit is contained in:
nukeykt 2017-09-28 17:00:31 +09:00
parent e2774c7b8a
commit 6a23a42540
2 changed files with 7 additions and 7 deletions

View File

@ -39,7 +39,7 @@
* OPLx decapsulated(Matthew Gambrell, Olli Niemitalo): * OPLx decapsulated(Matthew Gambrell, Olli Niemitalo):
* OPL2 ROMs. * OPL2 ROMs.
* *
* version: 1.0.4 * version: 1.0.5
*/ */
#include <string.h> #include <string.h>
@ -671,7 +671,7 @@ void OPN2_EnvelopeADSR(ym3438_t *chip)
} }
break; break;
case eg_num_decay: case eg_num_decay:
if (!eg_off && (level >> 5) == chip->eg_sl[1]) if ((level >> 5) == chip->eg_sl[1])
{ {
nextstate = eg_num_sustain; nextstate = eg_num_sustain;
} }
@ -803,11 +803,11 @@ void OPN2_EnvelopePrepare(ym3438_t *chip)
chip->eg_ksv = chip->pg_kcode >> (chip->ks[slot] ^ 0x03); chip->eg_ksv = chip->pg_kcode >> (chip->ks[slot] ^ 0x03);
if (chip->am[slot]) if (chip->am[slot])
{ {
chip->eg_am_shift = chip->ams[chip->channel]; chip->eg_lfo_am = chip->lfo_am >> eg_am_shift[chip->ams[chip->channel]];
} }
else else
{ {
chip->eg_am_shift = 0; chip->eg_lfo_am = 0;
} }
/* Delay TL & SL value */ /* Delay TL & SL value */
chip->eg_tl[1] = chip->eg_tl[0]; chip->eg_tl[1] = chip->eg_tl[0];
@ -835,7 +835,7 @@ void OPN2_EnvelopeGenerate(ym3438_t *chip)
level &= 0x3ff; level &= 0x3ff;
/* Apply AM LFO */ /* Apply AM LFO */
level += chip->lfo_am >> eg_am_shift[chip->eg_am_shift]; level += chip->eg_lfo_am;
/* Apply TL */ /* Apply TL */
if (!(chip->mode_csm && chip->channel == 2 + 1)) if (!(chip->mode_csm && chip->channel == 2 + 1))

View File

@ -39,7 +39,7 @@
* OPLx decapsulated(Matthew Gambrell, Olli Niemitalo): * OPLx decapsulated(Matthew Gambrell, Olli Niemitalo):
* OPL2 ROMs. * OPL2 ROMs.
* *
* version: 1.0.4 * version: 1.0.5
*/ */
#ifndef YM3438_H #ifndef YM3438_H
@ -111,7 +111,7 @@ typedef struct
Bit8u eg_inc; Bit8u eg_inc;
Bit8u eg_ratemax; Bit8u eg_ratemax;
Bit8u eg_sl[2]; Bit8u eg_sl[2];
Bit8u eg_am_shift; Bit8u eg_lfo_am;
Bit8u eg_tl[2]; Bit8u eg_tl[2];
Bit8u eg_state[24]; Bit8u eg_state[24];
Bit16u eg_level[24]; Bit16u eg_level[24];