From 90636b367eb655699de8414ba855045627eec63f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Sep 2017 19:41:46 -0400 Subject: TITANIC: Free wave files on game exit like original does --- engines/titanic/sound/qmixer.cpp | 5 ----- engines/titanic/sound/qmixer.h | 1 - engines/titanic/sound/sound.cpp | 6 ++++++ engines/titanic/sound/sound.h | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/titanic/sound/qmixer.cpp b/engines/titanic/sound/qmixer.cpp index a1091a9763..f373b19704 100644 --- a/engines/titanic/sound/qmixer.cpp +++ b/engines/titanic/sound/qmixer.cpp @@ -241,11 +241,6 @@ void QMixer::qsWaveMixPump() { /*------------------------------------------------------------------------*/ -QMixer::ChannelEntry::~ChannelEntry() { - for (Common::List::iterator i = _sounds.begin(); i != _sounds.end(); ++i) - delete (*i)._waveFile; -} - byte QMixer::ChannelEntry::getRawVolume() const { // Emperically decided adjustment divisor for distances const double ADJUSTMENT_FACTOR = 5.0; diff --git a/engines/titanic/sound/qmixer.h b/engines/titanic/sound/qmixer.h index c6d7fcd520..2241521c86 100644 --- a/engines/titanic/sound/qmixer.h +++ b/engines/titanic/sound/qmixer.h @@ -204,7 +204,6 @@ class QMixer { ChannelEntry() : _volume(0), _panRate(0), _volumeChangeStart(0), _volumeChangeEnd(0), _volumeStart(0), _volumeEnd(0), _distance(0.0), _resetDistance(true) {} - ~ChannelEntry(); /** * Calculates the raw volume level to pass to ScummVM playStream, taking diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index befe1a8e09..3c5801e418 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -26,6 +26,12 @@ namespace Titanic { +CSoundItem::~CSoundItem() { + delete _waveFile; +} + +/*------------------------------------------------------------------------*/ + CSound::CSound(CGameManager *owner, Audio::Mixer *mixer) : _gameManager(owner), _soundManager(mixer) { g_vm->_movieManager.setSoundManager(&_soundManager); diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index c767a3d75f..ee2b8cc13d 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -52,6 +52,7 @@ public: CSoundItem(File *dialogueFile, int speechId) : ListItem(), _waveFile(nullptr), _dialogueFileHandle(dialogueFile), _speechId(speechId), _active(false), _disposeAfterUse(DisposeAfterUse::NO) {} + virtual ~CSoundItem(); }; class CSoundItemList : public List { -- cgit v1.2.3