mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 19:16:21 +00:00
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
This commit is contained in:
parent
447711b597
commit
87c26fe54b
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 = '|';
|
||||
|
Loading…
x
Reference in New Issue
Block a user