Drop height to 0 when VAG ends.

Otherwise we will set it to !playing and never step the height.
Should fix Yu-Gi-Oh again.  Probably release before was miscalculated as
0 which is why it worked before.
This commit is contained in:
Unknown W. Brackets 2014-02-09 10:53:47 -08:00
parent b6d54bbdc4
commit a14850c16b
2 changed files with 9 additions and 2 deletions

View file

@ -367,7 +367,8 @@ void SasVoice::ReadSamples(s16 *output, int numSamples) {
// NOTICE_LOG(SCESAS, "Hit end of VAG audio");
playing = false;
on = false; // ??
envelope.KeyOff();
// TODO: Should this remain on somehow or just hit rock bottom immediately?
envelope.End();
}
}
break;
@ -396,7 +397,7 @@ void SasVoice::ReadSamples(s16 *output, int numSamples) {
// Hit atrac3 voice end
playing = false;
on = false; // ??
envelope.KeyOff();
envelope.End();
}
}
break;
@ -880,6 +881,11 @@ void ADSREnvelope::KeyOff() {
height_ = sustainLevel;
}
void ADSREnvelope::End() {
SetState(STATE_OFF);
height_ = 0;
}
void ADSREnvelope::DoState(PointerWrap &p) {
auto s = p.Section("ADSREnvelope", 1);
if (!s) {

View file

@ -139,6 +139,7 @@ public:
void KeyOn();
void KeyOff();
void End();
void Step();