From f3d9d88f58d38fedbf6d65d825d6183013086898 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Nov 2016 20:26:51 -0500 Subject: TITANIC: Fix stopping all playing sounds when loading a savegame --- engines/titanic/sound/qmixer.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/engines/titanic/sound/qmixer.cpp b/engines/titanic/sound/qmixer.cpp index ecc0bbcba4..b3910f846a 100644 --- a/engines/titanic/sound/qmixer.cpp +++ b/engines/titanic/sound/qmixer.cpp @@ -60,12 +60,19 @@ void QMixer::qsWaveMixFreeWave(Audio::SoundHandle &handle) { } void QMixer::qsWaveMixFlushChannel(int iChannel, uint flags) { - Common::List::iterator i; - Common::List &sounds = _channels[iChannel]._sounds; - for (i = sounds.begin(); i != sounds.end(); ++i) - _mixer->stopHandle((*i)._soundHandle); - - sounds.clear(); + if (flags & QMIX_OPENALL) { + // Ignore channel, and flush all the channels + for (uint idx = 0; idx < _channels.size(); ++idx) + qsWaveMixFlushChannel(idx, 0); + } else { + // Flush the specified channel + Common::List::iterator i; + Common::List &sounds = _channels[iChannel]._sounds; + for (i = sounds.begin(); i != sounds.end(); ++i) + _mixer->stopHandle((*i)._soundHandle); + + sounds.clear(); + } } void QMixer::qsWaveMixSetPanRate(int iChannel, uint flags, uint rate) { -- cgit v1.2.3