aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood/sound.cpp
diff options
context:
space:
mode:
authorjohndoe1232013-01-29 12:03:05 +0000
committerWillem Jan Palenstijn2013-05-08 20:47:43 +0200
commit70fdfd9d572b4c395dfa4d3fbff791e064d4079d (patch)
tree457ca8255d935d9920a75cffe75f9ea1ed77782b /engines/neverhood/sound.cpp
parentc96d2475b100610271c974043a8a9c4322b8e60b (diff)
downloadscummvm-rg350-70fdfd9d572b4c395dfa4d3fbff791e064d4079d.tar.gz
scummvm-rg350-70fdfd9d572b4c395dfa4d3fbff791e064d4079d.tar.bz2
scummvm-rg350-70fdfd9d572b4c395dfa4d3fbff791e064d4079d.zip
NEVERHOOD: Delete all sound/music items on exit
- Minor cleanup
Diffstat (limited to 'engines/neverhood/sound.cpp')
-rw-r--r--engines/neverhood/sound.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp
index 9e0e572ca0..a479bf26f9 100644
--- a/engines/neverhood/sound.cpp
+++ b/engines/neverhood/sound.cpp
@@ -233,21 +233,18 @@ void SoundItem::setVolume(int volume) {
void SoundItem::update() {
if (_playOnceAfterCountdown) {
- if (_currCountdown == 0) {
+ if (_currCountdown == 0)
_currCountdown = _initialCountdown;
- } else if (--_currCountdown == 0) {
+ else if (--_currCountdown == 0)
_soundResource->play();
- }
} else if (_playOnceAfterRandomCountdown) {
if (_currCountdown == 0) {
if (_minCountdown > 0 && _maxCountdown > 0 && _minCountdown < _maxCountdown)
_currCountdown = _vm->_rnd->getRandomNumberRng(_minCountdown, _maxCountdown);
- } else if (--_currCountdown == 0) {
+ } else if (--_currCountdown == 0)
_soundResource->play();
- }
- } else if (_playLooping && !_soundResource->isPlaying()) {
- _soundResource->play(); // TODO Looping parameter?
- }
+ } else if (_playLooping && !_soundResource->isPlaying())
+ _soundResource->play();
}
// SoundMan
@@ -257,7 +254,10 @@ SoundMan::SoundMan(NeverhoodEngine *vm)
}
SoundMan::~SoundMan() {
- // TODO Clean up
+ for (uint i = 0; i < _soundItems.size(); ++i)
+ delete _soundItems[i];
+ for (uint i = 0; i < _musicItems.size(); ++i)
+ delete _musicItems[i];
}
void SoundMan::addMusic(uint32 groupNameHash, uint32 musicFileHash) {
@@ -709,6 +709,10 @@ AudioResourceMan::AudioResourceMan(NeverhoodEngine *vm)
}
AudioResourceMan::~AudioResourceMan() {
+ for (uint i = 0; i < _soundItems.size(); ++i)
+ delete _soundItems[i];
+ for (uint i = 0; i < _musicItems.size(); ++i)
+ delete _musicItems[i];
}
int16 AudioResourceMan::addSound(uint32 fileHash) {