aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-06-26 23:04:41 +0000
committerMax Horn2003-06-26 23:04:41 +0000
commitaa19687a4c9affcdb03ae76e269766dd6237ca4c (patch)
tree718b41aa29daec48341f1b913cda1aa6f6ffb6f8 /scumm
parent1ec54d032e65af70890c6d53209608deb409fae9 (diff)
downloadscummvm-rg350-aa19687a4c9affcdb03ae76e269766dd6237ca4c.tar.gz
scummvm-rg350-aa19687a4c9affcdb03ae76e269766dd6237ca4c.tar.bz2
scummvm-rg350-aa19687a4c9affcdb03ae76e269766dd6237ca4c.zip
fixed memory leak when restarting
svn-id: r8661
Diffstat (limited to 'scumm')
-rw-r--r--scumm/sound.cpp20
-rw-r--r--scumm/sound.h2
2 files changed, 11 insertions, 11 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 85ea5ef4e0..e400911349 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -95,14 +95,13 @@ Sound::Sound(Scumm *parent) {
_current_cache = 0;
_current_cd_sound = 0;
+ _sfxFile = 0;
+
_bundle = new Bundle();
}
Sound::~Sound() {
- if (_sfxFile) {
- _sfxFile->close();
- delete _sfxFile;
- }
+ delete _sfxFile;
delete _bundle;
}
@@ -771,9 +770,10 @@ void Sound::setupSound() {
_scumm->_imuse->set_master_volume(_sound_volume_master);
_scumm->_imuse->set_music_volume(_sound_volume_music);
- _scumm->_mixer->setVolume(_sound_volume_sfx * _sound_volume_master / 255);
- _scumm->_mixer->setMusicVolume(_sound_volume_music);
}
+ _scumm->_mixer->setVolume(_sound_volume_sfx * _sound_volume_master / 255);
+ _scumm->_mixer->setMusicVolume(_sound_volume_music);
+ delete _sfxFile;
_sfxFile = openSfxFile();
}
@@ -1065,7 +1065,7 @@ void Sound::bundleMusicHandler(Scumm *scumm) {
if (_pauseBundleMusic)
return;
- if (_musicBundleToBeRemoved == true) {
+ if (_musicBundleToBeRemoved) {
_scumm->_timer->releaseProcedure(&music_handler);
_nameBundleMusic = "";
if (_bundleMusicTrack != -1) {
@@ -1554,7 +1554,7 @@ int Sound::playMP3CDTrack(int track, int num_loops, int start, int delay) {
}
int Sound::stopMP3CD() {
- if (_dig_cd_playing == true) {
+ if (_dig_cd_playing) {
_scumm->_mixer->stop(_dig_cd_index);
_dig_cd_playing = false;
_dig_cd_track = 0;
@@ -1566,8 +1566,8 @@ int Sound::stopMP3CD() {
return -1;
}
-int Sound::pollMP3CD() const{
- if (_dig_cd_playing == true)
+int Sound::pollMP3CD() const {
+ if (_dig_cd_playing)
return 1;
return 0;
}
diff --git a/scumm/sound.h b/scumm/sound.h
index f0f8d2551a..78d6878cc3 100644
--- a/scumm/sound.h
+++ b/scumm/sound.h
@@ -93,11 +93,11 @@ protected:
bool _dig_cd_playing;
DigitalTrackInfo *_track_info[CACHE_TRACKS];
+ int _current_cache;
Scumm *_scumm;
public:
- int _current_cache;
int32 _bundleMusicPosition;
int _talkChannel; /* Mixer channel actor is talking on */