aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorJamieson Christian2003-09-28 00:03:24 +0000
committerJamieson Christian2003-09-28 00:03:24 +0000
commit044bcd5430a9ba1b19e10d4d4e3a193358166991 (patch)
tree3af39ea65d71f9de3deedb3c116d782fa97b9b8d /scumm
parent1d40ce68c2fd93abdef86989ae534b124f175068 (diff)
downloadscummvm-rg350-044bcd5430a9ba1b19e10d4d4e3a193358166991.tar.gz
scummvm-rg350-044bcd5430a9ba1b19e10d4d4e3a193358166991.tar.bz2
scummvm-rg350-044bcd5430a9ba1b19e10d4d4e3a193358166991.zip
Added terminate() to the MusicEngine and publicized
the iMuse implementation. This allows the termination sequence to be done BEFORE object destruction, so that the destructor is not making calls that may not be appropriate during object destruction. (Virtual functions were the concern, although I'm not sure any of that was happening anyway. Oh well, better to be safe than sorry.) I implemented an empty terminate() in the base class, but the other MusicEngine derivatives may have stuff in their destructors that should be moved to this method. I didn't check. svn-id: r10452
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse.cpp5
-rw-r--r--scumm/imuse.h1
-rw-r--r--scumm/imuse_internal.h1
-rw-r--r--scumm/music.h1
-rw-r--r--scumm/scummvm.cpp5
5 files changed, 7 insertions, 6 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 30ca18ba98..9076cec2d4 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -69,10 +69,6 @@ _snm_trigger_index(0)
memset(_active_notes,0,sizeof(_active_notes));
}
-IMuseInternal::~IMuseInternal() {
- terminate();
-}
-
byte *IMuseInternal::findStartOfSound(int sound) {
byte *ptr = NULL;
int32 size, pos;
@@ -1783,6 +1779,7 @@ int32 IMuse::doCommand (int numargs, int args[]) { in(); int32 ret = _target->do
int IMuse::clear_queue() { in(); int ret = _target->clear_queue(); out(); return ret; }
void IMuse::setBase(byte **base) { in(); _target->setBase(base); out(); }
uint32 IMuse::property(int prop, uint32 value) { in(); uint32 ret = _target->property(prop, value); out(); return ret; }
+void IMuse::terminate() { in(); _target->terminate(); out(); }
// The IMuse::create method provides a front-end factory
// for creating IMuseInternal without exposing that class
diff --git a/scumm/imuse.h b/scumm/imuse.h
index 3337f08b5e..62012de460 100644
--- a/scumm/imuse.h
+++ b/scumm/imuse.h
@@ -74,6 +74,7 @@ public:
int clear_queue();
void setBase(byte **base);
uint32 property(int prop, uint32 value);
+ void terminate();
// Factory methods
static IMuse *create(OSystem *syst, SoundMixer *mixer, MidiDriver *midi);
diff --git a/scumm/imuse_internal.h b/scumm/imuse_internal.h
index 6363fa4c3d..0bc88e7a5e 100644
--- a/scumm/imuse_internal.h
+++ b/scumm/imuse_internal.h
@@ -440,7 +440,6 @@ protected:
public:
IMuseInternal();
- ~IMuseInternal();
int initialize(OSystem *syst, SoundMixer *mixer, MidiDriver *midi);
void reallocateMidiChannels(MidiDriver *midi);
diff --git a/scumm/music.h b/scumm/music.h
index ff08d18e89..c3b730d7a0 100644
--- a/scumm/music.h
+++ b/scumm/music.h
@@ -37,6 +37,7 @@ public:
virtual void stopAllSounds() = 0;
virtual int getSoundStatus(int sound) const = 0;
// virtual int getMusicTimer() const = 0;
+ virtual void terminate() {}
};
#endif
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index fcdad80ae9..410458be5c 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -824,7 +824,10 @@ Scumm::~Scumm () {
delete _confirmExitDialog;
delete _sound;
- delete _musicEngine;
+ if (_musicEngine) {
+ _musicEngine->terminate();
+ delete _musicEngine;
+ }
free(_languageBuffer);
free(_audioNames);