mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 14:50:17 +00:00
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
This commit is contained in:
parent
b17d77eae9
commit
2fb7d4c553
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user