Don't read the first 32 samples after keyon.

The way I'm approximating this is ugly...
This commit is contained in:
Unknown W. Brackets 2014-02-16 18:39:27 -08:00
parent 6b984c5593
commit e006ab5b2d
2 changed files with 10 additions and 1 deletions

View File

@ -468,7 +468,12 @@ void SasInstance::MixVoice(SasVoice &voice) {
numSamples = grainSize * 4;
}
voice.ReadSamples(resampleBuffer + 2, numSamples);
// This feels a bit hacky. The first 32 samples after a keyon are 0s.
if (voice.envelope.NeedsKeyOn()) {
voice.ReadSamples(resampleBuffer + 2 + 32, numSamples - 32);
} else {
voice.ReadSamples(resampleBuffer + 2, numSamples);
}
// Smoothness HACKERY
resampleBuffer[2 + numSamples] = resampleBuffer[2 + numSamples - 1];

View File

@ -146,9 +146,13 @@ public:
int GetHeight() const {
return height_ > (s64)PSP_SAS_ENVELOPE_HEIGHT_MAX ? PSP_SAS_ENVELOPE_HEIGHT_MAX : height_;
}
bool NeedsKeyOn() const {
return state_ == STATE_KEYON;
}
bool HasEnded() const {
return state_ == STATE_OFF;
}
int attackRate;
int decayRate;
int sustainRate;