diff options
author | Oliver Kiehl | 2003-06-15 09:55:10 +0000 |
---|---|---|
committer | Oliver Kiehl | 2003-06-15 09:55:10 +0000 |
commit | 4d5db88535feb690b5968b23af26163389c5f563 (patch) | |
tree | b9f82f8a94f884a487c65f55a875f2b5d9f5acee /simon | |
parent | 16e5c50bad251132bca851ffb6f6c68c936d8336 (diff) | |
download | scummvm-rg350-4d5db88535feb690b5968b23af26163389c5f563.tar.gz scummvm-rg350-4d5db88535feb690b5968b23af26163389c5f563.tar.bz2 scummvm-rg350-4d5db88535feb690b5968b23af26163389c5f563.zip |
cleanup
svn-id: r8502
Diffstat (limited to 'simon')
-rw-r--r-- | simon/simon.cpp | 20 | ||||
-rw-r--r-- | simon/simon.h | 3 | ||||
-rw-r--r-- | simon/sound.cpp | 8 | ||||
-rw-r--r-- | simon/sound.h | 4 |
4 files changed, 23 insertions, 12 deletions
diff --git a/simon/simon.cpp b/simon/simon.cpp index 488a27fe10..8e7736aa4e 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -1075,23 +1075,25 @@ void SimonEngine::playSting(uint a) { char filename[11]; uint16 size; - File _mus_file; + File mus_file; + uint16 *mus_offsets; + sprintf(filename, "STINGS%i.MUS", _midi_sfx); - _mus_file.open(filename, _gameDataPath); - if (!_mus_file.isOpen()) { + mus_file.open(filename, _gameDataPath); + if (!mus_file.isOpen()) { warning("Can't load sound effect from '%s'", filename); return; } - size = _mus_file.readUint16LE(); - _mus_offsets = (uint16 *)malloc(size); + size = mus_file.readUint16LE(); + mus_offsets = (uint16 *)malloc(size); - _mus_file.seek(0, SEEK_SET); - if (_mus_file.read(_mus_offsets, size) != size) + mus_file.seek(0, SEEK_SET); + if (mus_file.read(mus_offsets, size) != size) error("Can't read offsets"); - _mus_file.seek(_mus_offsets[a], SEEK_SET); - midi.loadSMF (&_mus_file, a, true); + mus_file.seek(mus_offsets[a], SEEK_SET); + midi.loadSMF (&mus_file, a, true); midi.startTrack (0); } diff --git a/simon/simon.h b/simon/simon.h index 49ef7d3d57..0d024d7fa2 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -104,9 +104,6 @@ struct GameSpecificSettings; class SimonEngine : public Engine { void errorString(const char *buf_input, char *buf_output); public: - File *_mus_file; - uint16 *_mus_offsets; - void playSting(uint a); byte *_vc_ptr; /* video code ptr */ diff --git a/simon/sound.cpp b/simon/sound.cpp index df27b1d0b0..9b24987356 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -138,12 +138,14 @@ void SimonSound::readSfxFile(const char *filename, const char *gameDataPath) { } } + delete _effects; _effects = new WavSound(_mixer, file); } void SimonSound::loadSfxTable(File *gameFile, uint32 base) { stopAll(); + delete _effects; if (_game & GF_WIN) _effects = new WavSound(_mixer, gameFile, base); else @@ -159,6 +161,7 @@ void SimonSound::playVoice(uint sound) { if (file->isOpen() == false) { warning("Can't open voice file %s", filename); } else { + delete _voice; _voice = new WavSound(_mixer, file, _offsets); } } @@ -265,6 +268,11 @@ SimonSound::Sound::Sound(SoundMixer *mixer, File *file, uint32 *offsets) { _offsets = offsets; } +SimonSound::Sound::~Sound() { delete _file; } +SimonSound::WavSound::~WavSound() { delete _file; } +SimonSound::VocSound::~VocSound() { delete _file; } +SimonSound::MP3Sound::~MP3Sound() { delete _file; } + #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif diff --git a/simon/sound.h b/simon/sound.h index b9d2a20d74..40bce72735 100644 --- a/simon/sound.h +++ b/simon/sound.h @@ -31,6 +31,7 @@ private: public: Sound(SoundMixer *mixer, File *file, uint32 base = 0); Sound(SoundMixer *mixer, File *file, uint32 *offsets); + virtual ~Sound(); virtual int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0) = 0; }; @@ -38,18 +39,21 @@ private: public: WavSound(SoundMixer *mixer, File *file, uint32 base = 0) : Sound(mixer, file, base) {}; WavSound(SoundMixer *mixer, File *file, uint32 *offsets) : Sound(mixer, file, offsets) {}; + ~WavSound(); int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0); }; class VocSound : public Sound { public: VocSound(SoundMixer *mixer, File *file, uint32 base = 0) : Sound(mixer, file, base) {}; + ~VocSound(); int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0); }; class MP3Sound : public Sound { public: MP3Sound(SoundMixer *mixer, File *file, uint32 base = 0) : Sound(mixer, file, base) {}; + ~MP3Sound(); int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0); }; |