diff options
Diffstat (limited to 'sword1')
-rw-r--r-- | sword1/music.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sword1/music.cpp b/sword1/music.cpp index 911cfceb1d..8b0af804c3 100644 --- a/sword1/music.cpp +++ b/sword1/music.cpp @@ -45,7 +45,7 @@ void MusicHandle::fadeUp() { if (_fading > 0) _fading = -_fading; else if (_fading == 0) - _fading = -(FADE_LENGTH * getRate()); + _fading = -1; _fadeSamples = FADE_LENGTH * getRate(); } @@ -74,8 +74,10 @@ int MusicHandle::readBuffer(int16 *buffer, const int numSamples) { } sample = (sample * _fading) / _fadeSamples; } else if (_fading < 0) { - _fading++; - sample = (sample * (_fadeSamples + _fading)) / _fadeSamples; + _fading--; + sample = -(sample * _fading) / _fadeSamples; + if (_fading == -_fadeSamples) + _fading = 0; } *buffer++ = sample; } |