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:32:28 +09:00
parent 325f080857
commit 8f4c8258e8
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;
}
@ -100,6 +104,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;
}
};