diff options
author | JP Cimalando <jpcima@users.noreply.github.com> | 2019-02-25 09:58:42 +0100 |
---|---|---|
committer | JP Cimalando <jpcima@users.noreply.github.com> | 2019-02-25 09:58:42 +0100 |
commit | 24074a037f78427fd3f6375f6173469230b1d7bc (patch) | |
tree | 7bfde6ffc4af71ace4a6914b6503f833c1d4ab33 /src/chips/opal | |
parent | bdc982ef4263fcc4283921a2a375eab4c9073271 (diff) | |
download | libADLMIDI-24074a037f78427fd3f6375f6173469230b1d7bc.tar.gz libADLMIDI-24074a037f78427fd3f6375f6173469230b1d7bc.tar.bz2 libADLMIDI-24074a037f78427fd3f6375f6173469230b1d7bc.zip |
opal: fix envelope delay between stage transitions
Diffstat (limited to 'src/chips/opal')
-rw-r--r-- | src/chips/opal/opal.hpp | 18 |
1 files changed, 9 insertions, 9 deletions
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; |