Merge pull request #17 from yokemura/bugfix/ExtraNoteOffBehavior

Fixed the behavior when sending a note-off to a note already in release phase
This commit is contained in:
Takeshi Yokemura 2021-05-02 07:36:27 +09:00 committed by GitHub
commit 9e23e314ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -89,6 +89,10 @@ void BaseVoice::stopNote (float, bool allowTailOff)
{
if (settingRefs->volumeSequence.hasRelease)
{
if (settingRefs->volumeSequence.isInRelease(currentVolumeSequenceFrame)) {
// Already in release(Custom Env.)
return ;
}
currentVolumeSequenceFrame = settingRefs->volumeSequence.releaseSequenceStartIndex;
currentEnvelopeLevel = (float) (settingRefs->volumeSequence.valueAt (0)) / 15.0f;
}
@ -101,6 +105,11 @@ void BaseVoice::stopNote (float, bool allowTailOff)
return;
}
if (envelopePhase == kEnvelopePhaseR) {
// Already in release(ADSR)
return;
}
envelopePhase = kEnvelopePhaseR;
}

View File

@ -68,4 +68,8 @@ struct FrameSequence
// No reach here
}
bool isInRelease(int index) {
return index >= releaseSequenceStartIndex;
}
};