[Scummvm-cvs-logs] SF.net SVN: scummvm:[49725] scummvm/trunk/engines/saga
sev at users.sourceforge.net
sev at users.sourceforge.net
Tue Jun 15 12:25:34 CEST 2010
Revision: 49725
http://scummvm.svn.sourceforge.net/scummvm/?rev=49725&view=rev
Author: sev
Date: 2010-06-15 10:25:34 +0000 (Tue, 15 Jun 2010)
Log Message:
-----------
SAGA: Fix bug #2886141.
Bug #2886141: "ITE: Cumulative Snoring sounds in Prince's Bedroom".
Implemented safeguard against running same looped sound more
than once.
Modified Paths:
--------------
scummvm/trunk/engines/saga/sfuncs.cpp
scummvm/trunk/engines/saga/sndres.cpp
scummvm/trunk/engines/saga/sound.cpp
scummvm/trunk/engines/saga/sound.h
Modified: scummvm/trunk/engines/saga/sfuncs.cpp
===================================================================
--- scummvm/trunk/engines/saga/sfuncs.cpp 2010-06-15 10:25:13 UTC (rev 49724)
+++ scummvm/trunk/engines/saga/sfuncs.cpp 2010-06-15 10:25:34 UTC (rev 49725)
@@ -1464,6 +1464,8 @@
} else {
_vm->_sound->stopSound();
}
+
+ debug(1, "sfPlayLoopedSound(%d)", param);
}
// Script function #72 (0x48)
Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp 2010-06-15 10:25:13 UTC (rev 49724)
+++ scummvm/trunk/engines/saga/sndres.cpp 2010-06-15 10:25:34 UTC (rev 49725)
@@ -159,7 +159,7 @@
return;
}
- _vm->_sound->playSound(buffer, volume, loop);
+ _vm->_sound->playSound(buffer, volume, loop, resourceId);
}
void SndRes::playVoice(uint32 resourceId) {
Modified: scummvm/trunk/engines/saga/sound.cpp
===================================================================
--- scummvm/trunk/engines/saga/sound.cpp 2010-06-15 10:25:13 UTC (rev 49724)
+++ scummvm/trunk/engines/saga/sound.cpp 2010-06-15 10:25:34 UTC (rev 49725)
@@ -105,10 +105,20 @@
_mixer->playStream(soundType, handle, Audio::makeLoopingAudioStream(stream, loop ? 0 : 1), -1, volume);
}
-void Sound::playSound(SoundBuffer &buffer, int volume, bool loop) {
+void Sound::playSound(SoundBuffer &buffer, int volume, bool loop, int resId) {
+ // WORKAROUND
+ // Prevent playing same looped sound for several times
+ // Fixes bug #2886141: "ITE: Cumulative Snoring sounds in Prince's Bedroom"
+ for (int i = 0; i < SOUND_HANDLES; i++)
+ if (_handles[i].type == kEffectHandle && _handles[i].resId == resId) {
+ debug(1, "Skipped playing SFX #%d", resId);
+ return;
+ }
+
SndHandle *handle = getHandle();
handle->type = kEffectHandle;
+ handle->resId = resId;
playSoundBuffer(&handle->handle, buffer, 2 * volume, handle->type, loop);
}
@@ -129,6 +139,7 @@
if (_handles[i].type == kEffectHandle) {
_mixer->stopHandle(_handles[i].handle);
_handles[i].type = kFreeHandle;
+ _handles[i].resId = -1;
}
}
Modified: scummvm/trunk/engines/saga/sound.h
===================================================================
--- scummvm/trunk/engines/saga/sound.h 2010-06-15 10:25:13 UTC (rev 49724)
+++ scummvm/trunk/engines/saga/sound.h 2010-06-15 10:25:34 UTC (rev 49725)
@@ -63,6 +63,7 @@
struct SndHandle {
Audio::SoundHandle handle;
sndHandleType type;
+ int resId;
};
class Sound {
@@ -71,7 +72,7 @@
Sound(SagaEngine *vm, Audio::Mixer *mixer);
~Sound();
- void playSound(SoundBuffer &buffer, int volume, bool loop);
+ void playSound(SoundBuffer &buffer, int volume, bool loop, int resId);
void pauseSound();
void resumeSound();
void stopSound();
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