Fix audio regression: Don't "WalkCurve" on state OFF

This commit is contained in:
Henrik Rydgard 2013-11-17 23:13:30 +01:00
parent dda6a39b6f
commit 2c9a1123f0

View File

@ -804,23 +804,26 @@ void ADSREnvelope::SetState(ADSRState state) {
}
void ADSREnvelope::Step() {
WalkCurve(type_);
switch (state_) {
case STATE_ATTACK:
WalkCurve(type_);
if (height_ > PSP_SAS_ENVELOPE_HEIGHT_MAX || height_ < 0)
SetState(STATE_DECAY);
break;
case STATE_DECAY:
WalkCurve(type_);
if (height_ > PSP_SAS_ENVELOPE_HEIGHT_MAX || height_ < sustainLevel)
SetState(STATE_SUSTAIN);
break;
case STATE_SUSTAIN:
WalkCurve(type_);
if (height_ <= 0) {
height_ = 0;
SetState(STATE_RELEASE);
}
break;
case STATE_RELEASE:
WalkCurve(type_);
if (height_ <= 0) {
height_ = 0;
SetState(STATE_OFF);