aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
authorEugene Sandulenko2010-09-18 09:43:23 +0000
committerEugene Sandulenko2010-10-12 23:57:45 +0000
commitb2003364ff109e1f0170ea87fe379496631f6040 (patch)
tree13fd66b92bd0908cd30389a5aa55b24822201317 /engines/sword25
parent08ce5575faed22287e3133b07deec12c7739e8fe (diff)
downloadscummvm-rg350-b2003364ff109e1f0170ea87fe379496631f6040.tar.gz
scummvm-rg350-b2003364ff109e1f0170ea87fe379496631f6040.tar.bz2
scummvm-rg350-b2003364ff109e1f0170ea87fe379496631f6040.zip
SWORD25: Fix freeze with sound code. Now game is really playable.
svn-id: r53371
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/sfx/soundengine.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index dbbb6aa0e8..308c8dd6e5 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -110,14 +110,16 @@ void SoundEngine::ResumeLayer(uint layer) {
}
SndHandle *SoundEngine::getHandle(uint *id) {
- for (uint i = 0; i < SOUND_HANDLES; i++) {
+
+ // NOTE: Index 0 means error. Thus we're not using it
+ for (uint i = 1; i < SOUND_HANDLES; i++) {
if (_handles[i].type != kFreeHandle && !_mixer->isSoundHandleActive(_handles[i].handle)) {
debugC(kDebugSound, 5, "Handle %d has finished playing", i);
_handles[i].type = kFreeHandle;
}
}
- for (uint i = 0; i < SOUND_HANDLES; i++) {
+ for (uint i = 1; i < SOUND_HANDLES; i++) {
if (_handles[i].type == kFreeHandle) {
debugC(kDebugSound, 5, "Allocated handle %d", i);
if (id)
@@ -160,8 +162,6 @@ uint SoundEngine::PlaySoundEx(const Common::String &fileName, SOUND_TYPES type,
uint id;
SndHandle *handle = getHandle(&id);
- Resource *ResourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(fileName);
-
debugC(1, kDebugSound, "SoundEngine::PlaySoundEx(%s, %d, %f, %f, %d, %d, %d, %d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer);
_mixer->playStream(getType(type), &(handle->handle), stream, -1, (byte)(volume * 255), (int8)(pan * 127));