diff options
author | Torbjörn Andersson | 2004-01-14 08:09:03 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-01-14 08:09:03 +0000 |
commit | 2fb7d4c553e01cebc5a3f30485db015fd884ff80 (patch) | |
tree | 773d1c0a2cf36c626e7cd14e0ab888606781adf7 | |
parent | b17d77eae9a90a160727935eabdca162823cdc10 (diff) | |
download | scummvm-rg350-2fb7d4c553e01cebc5a3f30485db015fd884ff80.tar.gz scummvm-rg350-2fb7d4c553e01cebc5a3f30485db015fd884ff80.tar.bz2 scummvm-rg350-2fb7d4c553e01cebc5a3f30485db015fd884ff80.zip |
Changed the music fading so that the volume is increased when ABS(_fading)
grows larger, both when fading up and down. This fixes the problem where
the volume would "jump" when changing the fading "direction" of a stream.
svn-id: r12373
-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; } |