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() { void ADSREnvelope::Step() {
WalkCurve(type_);
switch (state_) { switch (state_) {
case STATE_ATTACK: case STATE_ATTACK:
WalkCurve(type_);
if (height_ > PSP_SAS_ENVELOPE_HEIGHT_MAX || height_ < 0) if (height_ > PSP_SAS_ENVELOPE_HEIGHT_MAX || height_ < 0)
SetState(STATE_DECAY); SetState(STATE_DECAY);
break; break;
case STATE_DECAY: case STATE_DECAY:
WalkCurve(type_);
if (height_ > PSP_SAS_ENVELOPE_HEIGHT_MAX || height_ < sustainLevel) if (height_ > PSP_SAS_ENVELOPE_HEIGHT_MAX || height_ < sustainLevel)
SetState(STATE_SUSTAIN); SetState(STATE_SUSTAIN);
break; break;
case STATE_SUSTAIN: case STATE_SUSTAIN:
WalkCurve(type_);
if (height_ <= 0) { if (height_ <= 0) {
height_ = 0; height_ = 0;
SetState(STATE_RELEASE); SetState(STATE_RELEASE);
} }
break; break;
case STATE_RELEASE: case STATE_RELEASE:
WalkCurve(type_);
if (height_ <= 0) { if (height_ <= 0) {
height_ = 0; height_ = 0;
SetState(STATE_OFF); SetState(STATE_OFF);