TSAGE: Corrections to the sound fading code

This commit is contained in:
Paul Gilbert
2011-06-20 21:09:39 +10:00
parent f8e0ff86c7
commit c22f824bed
2 changed files with 11 additions and 15 deletions
+7 -11
View File
@@ -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);
}
+4 -4
View File
@@ -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); }