From 13ab2aafbc79c1cd52ba6fac21d74db1386a6aec Mon Sep 17 00:00:00 2001 From: nukeykt Date: Tue, 26 Sep 2017 19:23:43 +0900 Subject: [PATCH] Nuked OPN2: Fix LFO PM --- core/sound/ym3438.c | 8 ++++---- core/sound/ym3438.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/sound/ym3438.c b/core/sound/ym3438.c index 5dd8b42..2190ee3 100644 --- a/core/sound/ym3438.c +++ b/core/sound/ym3438.c @@ -39,7 +39,7 @@ * OPLx decapsulated(Matthew Gambrell, Olli Niemitalo): * OPL2 ROMs. * - * version: 1.0.2 + * version: 1.0.3 */ #include @@ -488,9 +488,9 @@ void OPN2_PhaseCalcIncrement(ym3438_t *chip) lfo_l ^= 0x0f; } fm = (fnum_h >> pg_lfo_sh1[pms][lfo_l]) + (fnum_h >> pg_lfo_sh2[pms][lfo_l]); - if (lfo_l > 5) + if (pms > 5) { - fm <<= 7 - lfo_l; + fm <<= pms - 5; } fm >>= 2; if (lfo & 0x10) @@ -554,11 +554,11 @@ void OPN2_PhaseGenerate(ym3438_t *chip) void OPN2_EnvelopeSSGEG(ym3438_t *chip) { Bit32u slot = chip->slot; + Bit8u direction = 0; chip->eg_ssg_pgrst_latch[slot] = 0; chip->eg_ssg_repeat_latch[slot] = 0; chip->eg_ssg_hold_up_latch[slot] = 0; chip->eg_ssg_inv[slot] = 0; - Bit8u direction = 0; if (chip->ssg_eg[slot] & 0x08) { direction = chip->eg_ssg_dir[slot]; diff --git a/core/sound/ym3438.h b/core/sound/ym3438.h index 1f44ec7..cc54e0a 100644 --- a/core/sound/ym3438.h +++ b/core/sound/ym3438.h @@ -39,7 +39,7 @@ * OPLx decapsulated(Matthew Gambrell, Olli Niemitalo): * OPL2 ROMs. * - * version: 1.0.2 + * version: 1.0.3 */ #ifndef YM3438_H