[Scummvm-cvs-logs] SF.net SVN: scummvm:[46168] scummvm/trunk/engines/draci
spalek at users.sourceforge.net
spalek at users.sourceforge.net
Sat Nov 28 01:07:22 CET 2009
Revision: 46168
http://scummvm.svn.sourceforge.net/scummvm/?rev=46168&view=rev
Author: spalek
Date: 2009-11-28 00:07:22 +0000 (Sat, 28 Nov 2009)
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/trunk/engines/draci/animation.cpp
scummvm/trunk/engines/draci/sound.cpp
scummvm/trunk/engines/draci/sprite.cpp
Modified: scummvm/trunk/engines/draci/animation.cpp
===================================================================
--- scummvm/trunk/engines/draci/animation.cpp 2009-11-27 23:08:55 UTC (rev 46167)
+++ scummvm/trunk/engines/draci/animation.cpp 2009-11-28 00:07:22 UTC (rev 46168)
@@ -116,7 +116,15 @@
// 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;
}
}
Modified: scummvm/trunk/engines/draci/sound.cpp
===================================================================
--- scummvm/trunk/engines/draci/sound.cpp 2009-11-27 23:08:55 UTC (rev 46167)
+++ scummvm/trunk/engines/draci/sound.cpp 2009-11-28 00:07:22 UTC (rev 46168)
@@ -180,8 +180,10 @@
}
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 @@
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 @@
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;
}
}
Modified: scummvm/trunk/engines/draci/sprite.cpp
===================================================================
--- scummvm/trunk/engines/draci/sprite.cpp 2009-11-27 23:08:55 UTC (rev 46167)
+++ scummvm/trunk/engines/draci/sprite.cpp 2009-11-28 00:07:22 UTC (rev 46168)
@@ -341,7 +341,7 @@
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 = '|';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list