diff options
author | Robert Špalek | 2009-11-28 00:07:22 +0000 |
---|---|---|
committer | Robert Špalek | 2009-11-28 00:07:22 +0000 |
commit | 87c26fe54b5f17e610a95c8fec9f10e0f1bef316 (patch) | |
tree | 6b61b6858890e7120c2a319ee092ee0bcb0b337d /engines | |
parent | 447711b597f2fc410b0efdbb9d09a4713930dcdc (diff) | |
download | scummvm-rg350-87c26fe54b5f17e610a95c8fec9f10e0f1bef316.tar.gz scummvm-rg350-87c26fe54b5f17e610a95c8fec9f10e0f1bef316.tar.bz2 scummvm-rg350-87c26fe54b5f17e610a95c8fec9f10e0f1bef316.zip |
Fixed bug with exhausting sound handles
It was caused by forever re-starting the same sample when the animation was
stopped and the same frame got displayed over and over, each time triggering
playing the same sample.
svn-id: r46168
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/animation.cpp | 10 | ||||
-rw-r--r-- | engines/draci/sound.cpp | 6 | ||||
-rw-r--r-- | engines/draci/sprite.cpp | 2 |
3 files changed, 15 insertions, 3 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp index 48d3246a8e..b93c417602 100644 --- a/engines/draci/animation.cpp +++ b/engines/draci/animation.cpp @@ -116,7 +116,15 @@ void Animation::nextFrame(bool force) { // Fetch new frame and mark it dirty markDirtyRect(surface); - _hasChangedFrame = true; + // If the animation is paused, then nextFrameNum() + // returns the same frame number even though the time + // has elapsed to switch to another frame. We must not + // flip _hasChangedFrame to true, otherwise the sample + // assigned to this frame will be re-started over and + // over until all sound handles are exhausted (happens, + // e.g., when switching to the inventory which pauses + // all animations). + _hasChangedFrame = !_paused; } } diff --git a/engines/draci/sound.cpp b/engines/draci/sound.cpp index a8b9246b09..d12fccd27e 100644 --- a/engines/draci/sound.cpp +++ b/engines/draci/sound.cpp @@ -180,8 +180,10 @@ SndHandle *Sound::getHandle() { } for (int i = 0; i < SOUND_HANDLES; i++) { - if (_handles[i].type == kFreeHandle) + if (_handles[i].type == kFreeHandle) { + debugC(5, kDraciSoundDebugLevel, "Allocated handle %d", i); return &_handles[i]; + } } error("Sound::getHandle(): Too many sound handles"); @@ -230,6 +232,7 @@ void Sound::stopSound() { for (int i = 0; i < SOUND_HANDLES; i++) if (_handles[i].type == kEffectHandle) { _mixer->stopHandle(_handles[i].handle); + debugC(5, kDraciSoundDebugLevel, "Stopping effect handle %d", i); _handles[i].type = kFreeHandle; } } @@ -259,6 +262,7 @@ void Sound::stopVoice() { for (int i = 0; i < SOUND_HANDLES; i++) if (_handles[i].type == kVoiceHandle) { _mixer->stopHandle(_handles[i].handle); + debugC(5, kDraciSoundDebugLevel, "Stopping voice handle %d", i); _handles[i].type = kFreeHandle; } } diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index a41c77dadd..81459ffac8 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -341,7 +341,7 @@ void Text::splitLinesLongerThan(uint maxWidth) { break; } } - debugC(2, kDraciGeneralDebugLevel, "Long line of width %d split into %s\n", lineWidth, start); + debugC(2, kDraciGeneralDebugLevel, "Long line of width %d split into %s", lineWidth, start); } if (end) { *end = '|'; |