aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-09-24 10:48:04 -0400
committerPaul Gilbert2017-09-24 10:48:04 -0400
commit947894ce1f71c12cc904b1c2fd82aa827df8574f (patch)
tree9bda091aea8344d5975a0d744bf192c90e412109 /engines
parentb724ea65301ff2259e1638426da99c94a9966d65 (diff)
downloadscummvm-rg350-947894ce1f71c12cc904b1c2fd82aa827df8574f.tar.gz
scummvm-rg350-947894ce1f71c12cc904b1c2fd82aa827df8574f.tar.bz2
scummvm-rg350-947894ce1f71c12cc904b1c2fd82aa827df8574f.zip
TITANIC: Free any active wave files on exit
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/sound/qmixer.cpp9
-rw-r--r--engines/titanic/sound/qmixer.h3
2 files changed, 11 insertions, 1 deletions
diff --git a/engines/titanic/sound/qmixer.cpp b/engines/titanic/sound/qmixer.cpp
index a3c06da2f8..a1091a9763 100644
--- a/engines/titanic/sound/qmixer.cpp
+++ b/engines/titanic/sound/qmixer.cpp
@@ -29,6 +29,10 @@ namespace Titanic {
QMixer::QMixer(Audio::Mixer *mixer) : _mixer(mixer) {
}
+QMixer::~QMixer() {
+ _channels.clear();
+}
+
bool QMixer::qsWaveMixInitEx(const QMIXCONFIG &config) {
assert(_channels.empty());
assert(config.iChannels > 0 && config.iChannels < 256);
@@ -237,6 +241,11 @@ void QMixer::qsWaveMixPump() {
/*------------------------------------------------------------------------*/
+QMixer::ChannelEntry::~ChannelEntry() {
+ for (Common::List<SoundEntry>::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 17ca441e83..c6d7fcd520 100644
--- a/engines/titanic/sound/qmixer.h
+++ b/engines/titanic/sound/qmixer.h
@@ -204,6 +204,7 @@ 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
@@ -217,7 +218,7 @@ protected:
Audio::Mixer *_mixer;
public:
QMixer(Audio::Mixer *mixer);
- virtual ~QMixer() {}
+ virtual ~QMixer();
/**
* Initializes the mixer