aboutsummaryrefslogtreecommitdiff
path: root/src/chips
diff options
context:
space:
mode:
authorVitaly Novichkov <Wohlstand@users.noreply.github.com>2019-02-25 12:06:42 +0300
committerGitHub <noreply@github.com>2019-02-25 12:06:42 +0300
commitd69efd146f90c86cdfab4981629d0d5cdd07dde6 (patch)
treea85d688ed14182b80eb179174cd714848d3e4b22 /src/chips
parent77986b95e038ee12cf5b226c2a6aa15b85ecba61 (diff)
parent24074a037f78427fd3f6375f6173469230b1d7bc (diff)
downloadlibADLMIDI-d69efd146f90c86cdfab4981629d0d5cdd07dde6.tar.gz
libADLMIDI-d69efd146f90c86cdfab4981629d0d5cdd07dde6.tar.bz2
libADLMIDI-d69efd146f90c86cdfab4981629d0d5cdd07dde6.zip
Merge pull request #213 from jpcima/opal
opal: fix envelope delay between stage transitions
Diffstat (limited to 'src/chips')
-rw-r--r--src/chips/opal/opal.hpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/chips/opal/opal.hpp b/src/chips/opal/opal.hpp
index 1aa0c7d..c6976db 100644
--- a/src/chips/opal/opal.hpp
+++ b/src/chips/opal/opal.hpp
@@ -962,11 +962,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;
@@ -977,11 +977,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;
@@ -1000,11 +1000,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;