aboutsummaryrefslogtreecommitdiff
path: root/engines/sword2/sound.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-04-01 16:11:29 +0000
committerTorbjörn Andersson2010-04-01 16:11:29 +0000
commitd38f71c1e45f4b45f2e11e02315957d40657f3f3 (patch)
treee4d9f6a3d98b7cd987f4045563c63955f1bba952 /engines/sword2/sound.cpp
parentaee05cd21d5da6de39f23e5250af00f05a94fb5d (diff)
downloadscummvm-rg350-d38f71c1e45f4b45f2e11e02315957d40657f3f3.tar.gz
scummvm-rg350-d38f71c1e45f4b45f2e11e02315957d40657f3f3.tar.bz2
scummvm-rg350-d38f71c1e45f4b45f2e11e02315957d40657f3f3.zip
Added an "fxq" debugger command to print the FX queue. I guess it might help in
debugging the "No free slot in FX queue!" bug I've heard of but never actually seen. (See for instance bug #2976008, "BS2: Game lockup in British Museum".) svn-id: r48458
Diffstat (limited to 'engines/sword2/sound.cpp')
-rw-r--r--engines/sword2/sound.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp
index 4273da67b8..25069e83cd 100644
--- a/engines/sword2/sound.cpp
+++ b/engines/sword2/sound.cpp
@@ -42,6 +42,7 @@
#include "sword2/sword2.h"
#include "sword2/defs.h"
#include "sword2/header.h"
+#include "sword2/console.h"
#include "sword2/logic.h"
#include "sword2/resman.h"
#include "sword2/sound.h"
@@ -49,6 +50,8 @@
#include "sound/decoders/wave.h"
#include "sound/decoders/vag.h"
+#define Debug_Printf _vm->_debugger->DebugPrintf
+
namespace Sword2 {
Sound::Sound(Sword2Engine *vm) {
@@ -377,4 +380,44 @@ void Sound::unpauseAllSound() {
unpauseFx();
}
+void Sound::printFxQueue() {
+ int freeSlots = 0;
+
+ for (int i = 0; i < FXQ_LENGTH; i++) {
+ if (_fxQueue[i].resource) {
+ const char *type;
+
+ switch (_fxQueue[i].type) {
+ case FX_SPOT:
+ type = "SPOT";
+ break;
+ case FX_LOOP:
+ type = "LOOP";
+ break;
+ case FX_RANDOM:
+ type = "RANDOM";
+ break;
+ case FX_SPOT2:
+ type = "SPOT2";
+ break;
+ case FX_LOOPING:
+ type = "LOOPING";
+ break;
+ default:
+ type = "UNKNOWN";
+ break;
+ }
+
+ Debug_Printf("%d: res: %d ('%s') %s (%d) delay: %d vol: %d pan: %d\n",
+ i, _fxQueue[i].resource,
+ _vm->_resman->fetchName(_fxQueue[i].resource),
+ type, _fxQueue[i].type, _fxQueue[i].delay,
+ _fxQueue[i].volume, _fxQueue[i].pan);
+ } else {
+ freeSlots++;
+ }
+ }
+ Debug_Printf("Free slots: %d\n", freeSlots);
+}
+
} // End of namespace Sword2