diff options
author | Simei Yin | 2017-08-22 14:12:54 +0200 |
---|---|---|
committer | Simei Yin | 2017-08-22 16:20:15 +0200 |
commit | 867b8dbb9277f2cde6c45c107b15edd1a6f73b10 (patch) | |
tree | 097902d2165356328e7b5e86f961c2d69fdbbfbd /engines/sludge/sound.cpp | |
parent | 4783541529988e2872fea27565d92d2c36d03f7a (diff) | |
download | scummvm-rg350-867b8dbb9277f2cde6c45c107b15edd1a6f73b10.tar.gz scummvm-rg350-867b8dbb9277f2cde6c45c107b15edd1a6f73b10.tar.bz2 scummvm-rg350-867b8dbb9277f2cde6c45c107b15edd1a6f73b10.zip |
SLUDGE: Reset engine when launching a new game data file
Diffstat (limited to 'engines/sludge/sound.cpp')
-rw-r--r-- | engines/sludge/sound.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/engines/sludge/sound.cpp b/engines/sludge/sound.cpp index 6820ae14be..25caa0b9de 100644 --- a/engines/sludge/sound.cpp +++ b/engines/sludge/sound.cpp @@ -43,24 +43,13 @@ const int SoundManager::MAX_SAMPLES = 8; const int SoundManager::MAX_MODS = 3; SoundManager::SoundManager() { - // there's possibility that several sound list played at the same time - _soundListHandles.clear(); - - _soundOK = false; - _silenceIKillYou = false; - _isHandlingSoundList = false; - _soundCache = nullptr; _soundCache = new SoundThing[MAX_SAMPLES]; _modCache = nullptr; _modCache = new SoundThing[MAX_MODS]; - _defVol = 128; - _defSoundVol = 255; - _modLoudness = 0.95f; - - _emptySoundSlot = 0; + init(); } SoundManager::~SoundManager() { @@ -73,14 +62,29 @@ SoundManager::~SoundManager() { _modCache = nullptr; } +void SoundManager::init() { + // there's possibility that several sound list played at the same time + _soundListHandles.clear(); + + _soundOK = false; + _silenceIKillYou = false; + _isHandlingSoundList = false; + + _defVol = 128; + _defSoundVol = 255; + _modLoudness = 0.95f; + + _emptySoundSlot = 0; +} + bool SoundManager::initSoundStuff() { - for (int a = 0; a < MAX_SAMPLES; a ++) { + for (int a = 0; a < MAX_SAMPLES; ++a) { _soundCache[a].fileLoaded = -1; _soundCache[a].looping = false; _soundCache[a].inSoundList = false; } - for (int a = 0; a < MAX_MODS; a ++) { + for (int a = 0; a < MAX_MODS; ++a) { _soundCache[a].fileLoaded = -1; _soundCache[a].looping = false; _soundCache[a].inSoundList = false; |