diff options
| author | Paul Gilbert | 2011-06-20 21:09:39 +1000 | 
|---|---|---|
| committer | Paul Gilbert | 2011-06-20 21:09:39 +1000 | 
| commit | c22f824bedceca3dd89bded1bccbc8d2d1ef1b8c (patch) | |
| tree | d55118a83a705db8dcd12d448d42638722ca2e21 | |
| parent | f8e0ff86c74e5ce24cf5f3d7b2308b810e3ebd41 (diff) | |
| download | scummvm-rg350-c22f824bedceca3dd89bded1bccbc8d2d1ef1b8c.tar.gz scummvm-rg350-c22f824bedceca3dd89bded1bccbc8d2d1ef1b8c.tar.bz2 scummvm-rg350-c22f824bedceca3dd89bded1bccbc8d2d1ef1b8c.zip | |
TSAGE: Corrections to the sound fading code
| -rw-r--r-- | engines/tsage/sound.cpp | 18 | ||||
| -rw-r--r-- | engines/tsage/sound.h | 8 | 
2 files changed, 11 insertions, 15 deletions
| diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index bbd1c407d2..9d397c7fe5 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -398,15 +398,11 @@ void SoundManager::_sfProcessFading() {  				--s->_fadeCounter;  			else {  				if (s->_volume >= s->_fadeDest) { -					if ((s->_fadeDest - s->_volume) > s->_fadeSteps) -						s->_volume += s->_fadeSteps; -					else -						s->_volume = s->_fadeDest; +					s->_volume = ((s->_volume - s->_fadeDest) > s->_fadeSteps) ? +						s->_volume - s->_fadeSteps : s->_fadeDest;  				} else { -					if (s->_fadeDest > s->_fadeSteps) -						s->_volume -= s->_fadeSteps; -					else -						s->_volume = s->_fadeDest; +					s->_volume = ((s->_fadeDest - s->_volume) > s->_fadeSteps) ? +						s->_volume + s->_fadeSteps : s->_fadeDest;  				}  				_sfDoUpdateVolume(s); @@ -1606,7 +1602,7 @@ void Sound::mute(bool flag) {  	_soundManager->restartSoundServer();  } -void Sound::fade(int fadeDest, int fadeTicks, int fadeSteps, bool stopAfterFadeFlag) { +void Sound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag) {  	_soundManager->suspendSoundServer();  	if (fadeDest > 127) @@ -2346,11 +2342,11 @@ void ASound::unPrime() {  	_action = NULL;  } -void ASound::fade(int v1, int v2, int v3, int v4, Action *action) { +void ASound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, Action *action) {  	if (action)  		_action = action; -	_sound.fade(v1, v2, v3, v4); +	_sound.fade(fadeDest, fadeSteps, fadeTicks, stopAfterFadeFlag);  } diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index ed93d33443..9b76cd4a06 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -323,7 +323,7 @@ public:  	bool isMuted() const;  	void pause(bool flag);  	void mute(bool flag); -	void fade(int fadeDest, int fadeTicks, int fadeSteps, bool stopAfterFadeFlag); +	void fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag);  	void setTimeIndex(uint32 timeIndex);  	uint32 getTimeIndex() const;  	int getCueValue() const; @@ -380,9 +380,9 @@ public:  	bool isMuted() const { return _sound.isMuted(); }  	void pause(bool flag) { _sound.pause(flag); }  	void mute(bool flag) { _sound.mute(flag); } -	void fadeIn() { fade(127, 5, 10, 0, NULL); } -	void fadeOut(Action *action) { fade(0, 5, 10, 1, action); } -	void fade(int v1, int v2, int v3, int v4, Action *action); +	void fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, Action *action); +	void fadeIn() { fade(127, 5, 10, false, NULL); } +	void fadeOut(Action *action) { fade(0, 5, 10, true, action); }  	void setTimeIndex(uint32 timeIndex) { _sound.setTimeIndex(timeIndex); }  	uint32 getTimeIndex() const { return _sound.getTimeIndex(); }  	void setPri(int v) { _sound.setPri(v); } | 
