diff options
author | Torbjörn Andersson | 2004-09-04 09:46:47 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-09-04 09:46:47 +0000 |
commit | eff7b341d0ef40279743cc9794a3de8561b1b40a (patch) | |
tree | c481239bcc3fe30013d7521cb72bac0d92b1ce6b /sword2 | |
parent | cb399b63d5cc24e6adb0289a1ff0dfd32ff29b1e (diff) | |
download | scummvm-rg350-eff7b341d0ef40279743cc9794a3de8561b1b40a.tar.gz scummvm-rg350-eff7b341d0ef40279743cc9794a3de8561b1b40a.tar.bz2 scummvm-rg350-eff7b341d0ef40279743cc9794a3de8561b1b40a.zip |
Fixed a glitch in the music fade-out code.
svn-id: r14888
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/driver/d_sound.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index c8bbd03b5f..013877e6e9 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -331,7 +331,7 @@ MusicInputStream::~MusicInputStream() { inline bool MusicInputStream::eosIntern() const { if (_looping) return false; - return _pos >= _bufferEnd; + return _remove || _pos >= _bufferEnd; } int MusicInputStream::readBuffer(int16 *buffer, const int numSamples) { @@ -409,12 +409,15 @@ void MusicInputStream::refill() { if (_fading > 0) { // Fade down for (ptr = _buffer; ptr < buf; ptr++) { - if (--_fading <= 0) { + if (_fading > 0) { + _fading--; + *ptr = (*ptr * _fading) / _fadeSamples; + } + if (_fading == 0) { _looping = false; _remove = true; - break; + *ptr = 0; } - *ptr = (*ptr * _fading) / _fadeSamples; } } else if (_fading < 0) { // Fade up |