From 24074a037f78427fd3f6375f6173469230b1d7bc Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Mon, 25 Feb 2019 09:58:42 +0100 Subject: opal: fix envelope delay between stage transitions --- src/chips/opal/opal.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/chips/opal/opal.hpp b/src/chips/opal/opal.hpp index c383bd5..e13dd28 100644 --- a/src/chips/opal/opal.hpp +++ b/src/chips/opal/opal.hpp @@ -953,11 +953,11 @@ int16_t Opal::Operator::Output(uint16_t /*keyscalenum*/, uint32_t phase_step, in // Attack stage case EnvAtt: { + uint16_t add = ((AttackAdd >> AttackTab[Master->Clock >> AttackShift & 7]) * ~EnvelopeLevel) >> 3; if (AttackRate == 0) - break; + add = 0; if (AttackMask && (Master->Clock & AttackMask)) - break; - uint16_t add = ((AttackAdd >> AttackTab[Master->Clock >> AttackShift & 7]) * ~EnvelopeLevel) >> 3; + add = 0; EnvelopeLevel += add; if (EnvelopeLevel <= 0) { EnvelopeLevel = 0; @@ -968,11 +968,11 @@ int16_t Opal::Operator::Output(uint16_t /*keyscalenum*/, uint32_t phase_step, in // Decay stage case EnvDec: { + uint16_t add = DecayAdd >> DecayTab[Master->Clock >> DecayShift & 7]; if (DecayRate == 0) - break; + add = 0; if (DecayMask && (Master->Clock & DecayMask)) - break; - uint16_t add = DecayAdd >> DecayTab[Master->Clock >> DecayShift & 7]; + add = 0; EnvelopeLevel += add; if (EnvelopeLevel >= SustainLevel) { EnvelopeLevel = SustainLevel; @@ -991,11 +991,11 @@ int16_t Opal::Operator::Output(uint16_t /*keyscalenum*/, uint32_t phase_step, in // Release stage case EnvRel: { + uint16_t add = ReleaseAdd >> ReleaseTab[Master->Clock >> ReleaseShift & 7]; if (ReleaseRate == 0) - break; + add = 0; if (ReleaseMask && (Master->Clock & ReleaseMask)) - break; - uint16_t add = ReleaseAdd >> ReleaseTab[Master->Clock >> ReleaseShift & 7]; + add = 0; EnvelopeLevel += add; if (EnvelopeLevel >= 0x1FF) { EnvelopeLevel = 0x1FF; -- cgit v1.2.3