aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSylvain Dupont2010-10-29 22:00:31 +0000
committerSylvain Dupont2010-10-29 22:00:31 +0000
commitecd3e29fe0854c632e5a7688b171e24561c70fc2 (patch)
tree6599b8cf395eae74566213c90e658f7f989ed802 /engines
parentc9442e26ad70fa18dbcee3814ca586e2bc45bdf8 (diff)
downloadscummvm-rg350-ecd3e29fe0854c632e5a7688b171e24561c70fc2.tar.gz
scummvm-rg350-ecd3e29fe0854c632e5a7688b171e24561c70fc2.tar.bz2
scummvm-rg350-ecd3e29fe0854c632e5a7688b171e24561c70fc2.zip
TOON: Stops all Sfx/voice when exiting a room
Caused crashs when exiting when a sfx or voice was still playing Bug found by Thomas svn-id: r53928
Diffstat (limited to 'engines')
-rw-r--r--engines/toon/audio.cpp8
-rw-r--r--engines/toon/audio.h1
-rw-r--r--engines/toon/toon.cpp8
3 files changed, 16 insertions, 1 deletions
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index c3ab2b2fd6..4381dad6f7 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -191,6 +191,14 @@ int32 AudioManager::playSFX(int32 id, int volume , bool genericSFX) {
return -1;
}
+void AudioManager::stopAllSfxs() {
+ for (int32 i = 3; i < 16; i++) {
+ if (_channels[i] && _channels[i]->isPlaying()) {
+ _channels[i]->stop(false);
+ }
+ }
+}
+
void AudioManager::stopCurrentVoice() {
debugC(1, kDebugAudio, "stopCurrentVoice()");
diff --git a/engines/toon/audio.h b/engines/toon/audio.h
index 32295fdadd..e0676c2992 100644
--- a/engines/toon/audio.h
+++ b/engines/toon/audio.h
@@ -132,6 +132,7 @@ public:
void playVoice(int32 id, bool genericVoice);
int32 playSFX(int32 id, int volume, bool genericSFX);
void stopCurrentVoice();
+ void stopAllSfxs();
void setMusicVolume(int32 volume);
void stopMusic();
void muteVoice(bool mute);
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index c47c2c18df..7a6a2fc87a 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -1572,11 +1572,17 @@ void ToonEngine::exitScene() {
_gameState->_mouseState = -1;
}
+ _audioManager->killAllAmbientSFX();
+ _audioManager->stopAllSfxs();
+ _audioManager->stopCurrentVoice();
+ _currentTextLine = 0;
+ _currentTextLineId = -1;
+ _currentTextLineCharacterId = 0;
+
char temp[256];
strcpy(temp, createRoomFilename(Common::String::printf("%s.pak", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
resources()->closePackage(temp);
- _audioManager->killAllAmbientSFX();
_drew->stopWalk();
_flux->stopWalk();