From 4fb289e346c5727ad51066ddf317e9d2582b96be Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 18 Apr 2013 20:07:39 +0200 Subject: AGI: Get rid of unused SoundMgr parameters --- engines/agi/loader_v1.cpp | 2 +- engines/agi/loader_v2.cpp | 2 +- engines/agi/loader_v3.cpp | 2 +- engines/agi/preagi_winnie.cpp | 2 +- engines/agi/sound.cpp | 14 +++++++------- engines/agi/sound.h | 7 +++---- engines/agi/sound_2gs.cpp | 4 ++-- engines/agi/sound_2gs.h | 4 ++-- engines/agi/sound_midi.cpp | 2 +- engines/agi/sound_midi.h | 4 +--- 10 files changed, 20 insertions(+), 23 deletions(-) diff --git a/engines/agi/loader_v1.cpp b/engines/agi/loader_v1.cpp index 189c98ee98..33e956af41 100644 --- a/engines/agi/loader_v1.cpp +++ b/engines/agi/loader_v1.cpp @@ -254,7 +254,7 @@ int AgiLoader_v1::loadResource(int t, int n) { if (data != NULL) { // Freeing of the raw resource from memory is delegated to the createFromRawResource-function - _vm->_game.sounds[n] = AgiSound::createFromRawResource(data, _vm->_game.dirSound[n].len, n, *_vm->_sound, _vm->_soundemu); + _vm->_game.sounds[n] = AgiSound::createFromRawResource(data, _vm->_game.dirSound[n].len, n, _vm->_soundemu); _vm->_game.dirSound[n].flags |= RES_LOADED; } else { ec = errBadResource; diff --git a/engines/agi/loader_v2.cpp b/engines/agi/loader_v2.cpp index a2ac6f0111..ee69bb5b27 100644 --- a/engines/agi/loader_v2.cpp +++ b/engines/agi/loader_v2.cpp @@ -230,7 +230,7 @@ int AgiLoader_v2::loadResource(int t, int n) { if (data != NULL) { // Freeing of the raw resource from memory is delegated to the createFromRawResource-function - _vm->_game.sounds[n] = AgiSound::createFromRawResource(data, _vm->_game.dirSound[n].len, n, *_vm->_sound, _vm->_soundemu); + _vm->_game.sounds[n] = AgiSound::createFromRawResource(data, _vm->_game.dirSound[n].len, n, _vm->_soundemu); _vm->_game.dirSound[n].flags |= RES_LOADED; } else { ec = errBadResource; diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp index 29635f935b..250d8e7615 100644 --- a/engines/agi/loader_v3.cpp +++ b/engines/agi/loader_v3.cpp @@ -314,7 +314,7 @@ int AgiLoader_v3::loadResource(int t, int n) { data = loadVolRes(&_vm->_game.dirSound[n]); if (data != NULL) { // Freeing of the raw resource from memory is delegated to the createFromRawResource-function - _vm->_game.sounds[n] = AgiSound::createFromRawResource(data, _vm->_game.dirSound[n].len, n, *_vm->_sound, _vm->_soundemu); + _vm->_game.sounds[n] = AgiSound::createFromRawResource(data, _vm->_game.dirSound[n].len, n, _vm->_soundemu); _vm->_game.dirSound[n].flags |= RES_LOADED; } else { ec = errBadResource; diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 53863a8c7e..37f8661367 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -1134,7 +1134,7 @@ bool WinnieEngine::playSound(ENUM_WTP_SOUND iSound) { file.read(data, size); file.close(); - _game.sounds[0] = AgiSound::createFromRawResource(data, size, 0, *_sound, _soundemu); + _game.sounds[0] = AgiSound::createFromRawResource(data, size, 0, _soundemu); _sound->startSound(0, 0); bool cursorShowing = CursorMan.showMouse(false); diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp index ca3d799ecc..3ae4d548dc 100644 --- a/engines/agi/sound.cpp +++ b/engines/agi/sound.cpp @@ -36,25 +36,25 @@ namespace Agi { // TODO: add support for variable sampling rate in the output device // -AgiSound *AgiSound::createFromRawResource(uint8 *data, uint32 len, int resnum, SoundMgr &manager, int soundemu) { +AgiSound *AgiSound::createFromRawResource(uint8 *data, uint32 len, int resnum, int soundemu) { if (data == NULL || len < 2) // Check for too small resource or no resource at all return NULL; uint16 type = READ_LE_UINT16(data); // For V1 sound resources if (type != AGI_SOUND_SAMPLE && (type & 0xFF) == 0x01) - return new PCjrSound(data, len, resnum, manager); + return new PCjrSound(data, len, resnum); switch (type) { // Create a sound object based on the type case AGI_SOUND_SAMPLE: - return new IIgsSample(data, len, resnum, manager); + return new IIgsSample(data, len, resnum); case AGI_SOUND_MIDI: - return new IIgsMidi(data, len, resnum, manager); + return new IIgsMidi(data, len, resnum); case AGI_SOUND_4CHN: if (soundemu == SOUND_EMU_MIDI) { - return new MIDISound(data, len, resnum, manager); + return new MIDISound(data, len, resnum); } else { - return new PCjrSound(data, len, resnum, manager); + return new PCjrSound(data, len, resnum); } } @@ -62,7 +62,7 @@ AgiSound *AgiSound::createFromRawResource(uint8 *data, uint32 len, int resnum, S return NULL; } -PCjrSound::PCjrSound(uint8 *data, uint32 len, int resnum, SoundMgr &manager) : AgiSound(manager) { +PCjrSound::PCjrSound(uint8 *data, uint32 len, int resnum) : AgiSound() { _data = data; // Save the resource pointer _len = len; // Save the resource's length _type = READ_LE_UINT16(data); // Read sound resource's type diff --git a/engines/agi/sound.h b/engines/agi/sound.h index 6fd8dd516e..528becbb58 100644 --- a/engines/agi/sound.h +++ b/engines/agi/sound.h @@ -93,7 +93,7 @@ public: */ class AgiSound { public: - AgiSound(SoundMgr &manager) : _manager(manager), _isPlaying(false), _isValid(false) {} + AgiSound() : _isPlaying(false), _isValid(false) {} virtual ~AgiSound() {} virtual void play() { _isPlaying = true; } virtual void stop() { _isPlaying = false; } @@ -108,17 +108,16 @@ public: * from memory using free() or delegate the responsibility onwards to some other * function! */ - static AgiSound *createFromRawResource(uint8 *data, uint32 len, int resnum, SoundMgr &manager, int soundemu); + static AgiSound *createFromRawResource(uint8 *data, uint32 len, int resnum, int soundemu); protected: - SoundMgr &_manager; ///< AGI sound manager object bool _isPlaying; ///< Is the sound playing? bool _isValid; ///< Is this a valid sound object? }; class PCjrSound : public AgiSound { public: - PCjrSound(uint8 *data, uint32 len, int resnum, SoundMgr &manager); + PCjrSound(uint8 *data, uint32 len, int resnum); ~PCjrSound() { free(_data); } virtual uint16 type() { return _type; } const uint8 *getVoicePointer(uint voiceNum); diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp index bfc8d4d8f3..f088ad3a01 100644 --- a/engines/agi/sound_2gs.cpp +++ b/engines/agi/sound_2gs.cpp @@ -447,7 +447,7 @@ void SoundGen2GS::setProgramChangeMapping(const IIgsMidiProgramMapping *mapping) _progToInst = mapping; } -IIgsMidi::IIgsMidi(uint8 *data, uint32 len, int resnum, SoundMgr &manager) : AgiSound(manager) { +IIgsMidi::IIgsMidi(uint8 *data, uint32 len, int resnum) : AgiSound() { _data = data; // Save the resource pointer _ptr = _data + 2; // Set current position to just after the header _len = len; // Save the resource's length @@ -472,7 +472,7 @@ static bool convertWave(Common::SeekableReadStream &source, int8 *dest, uint len return !(source.eos() || source.err()); } -IIgsSample::IIgsSample(uint8 *data, uint32 len, int resnum, SoundMgr &manager) : AgiSound(manager) { +IIgsSample::IIgsSample(uint8 *data, uint32 len, int resnum) : AgiSound() { Common::MemoryReadStream stream(data, len, DisposeAfterUse::YES); // Check that the header was read ok and that it's of the correct type diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h index 404f4a47a1..12e7b7b951 100644 --- a/engines/agi/sound_2gs.h +++ b/engines/agi/sound_2gs.h @@ -144,7 +144,7 @@ public: class IIgsMidi : public AgiSound { public: - IIgsMidi(uint8 *data, uint32 len, int resnum, SoundMgr &manager); + IIgsMidi(uint8 *data, uint32 len, int resnum); ~IIgsMidi() { if (_data != NULL) free(_data); } virtual uint16 type() { return _type; } virtual const uint8 *getPtr() { return _ptr; } @@ -161,7 +161,7 @@ public: class IIgsSample : public AgiSound { public: - IIgsSample(uint8 *data, uint32 len, int resnum, SoundMgr &manager); + IIgsSample(uint8 *data, uint32 len, int resnum); ~IIgsSample() { delete[] _sample; } virtual uint16 type() { return _header.type; } const IIgsSampleHeader &getHeader() const { return _header; } diff --git a/engines/agi/sound_midi.cpp b/engines/agi/sound_midi.cpp index 47d354093b..24e3ca8fb7 100644 --- a/engines/agi/sound_midi.cpp +++ b/engines/agi/sound_midi.cpp @@ -59,7 +59,7 @@ namespace Agi { static uint32 convertSND2MIDI(byte *snddata, byte **data); -MIDISound::MIDISound(uint8 *data, uint32 len, int resnum, SoundMgr &manager) : AgiSound(manager) { +MIDISound::MIDISound(uint8 *data, uint32 len, int resnum) : AgiSound() { _data = data; // Save the resource pointer _len = len; // Save the resource's length _type = READ_LE_UINT16(data); // Read sound resource's type diff --git a/engines/agi/sound_midi.h b/engines/agi/sound_midi.h index 36bd66ee76..ac1b100b12 100644 --- a/engines/agi/sound_midi.h +++ b/engines/agi/sound_midi.h @@ -33,7 +33,7 @@ namespace Agi { class MIDISound : public AgiSound { public: - MIDISound(uint8 *data, uint32 len, int resnum, SoundMgr &manager); + MIDISound(uint8 *data, uint32 len, int resnum); ~MIDISound() { free(_data); } virtual uint16 type() { return _type; } uint8 *_data; ///< Raw sound resource data @@ -61,8 +61,6 @@ public: private: bool _isGM; - - SoundMgr *_manager; }; } // End of namespace Agi -- cgit v1.2.3