From ed66cad6777a779f5cabeec037a24613da0134bf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 25 Aug 2009 08:38:14 +0000 Subject: - Simplified the parameters of some functions - Replaced some EngineState parameters - The SCI version is now obtained from the resource manager or the segment manager, thereby simplifying several functions - Plugged 2 leaks in the fallback detector - Renamed the segment manager and resource manager to "segmentManager" and "resourceManager" in all places, for consistency svn-id: r43722 --- engines/sci/sfx/core.cpp | 22 +++++++++++----------- engines/sci/sfx/core.h | 6 +++--- engines/sci/sfx/sci_midi.h | 2 +- engines/sci/sfx/softseq/adlib.cpp | 8 ++++---- engines/sci/sfx/softseq/adlib.h | 2 +- engines/sci/sfx/softseq/pcjr.h | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) (limited to 'engines/sci/sfx') diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index c8cf773eae..bc5dd02878 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -87,12 +87,12 @@ public: ~SfxPlayer(); /* Initializes the player - ** Parameters: (ResourceManager *) resmgr: A resource manager for driver initialization + ** Parameters: (ResourceManager *) resourceManager: A resource manager for driver initialization ** (int) expected_latency: Expected delay in between calls to 'maintenance' ** (in microseconds) ** Returns : (int) Common::kNoError on success, Common::kUnknownError on failure */ - Common::Error init(ResourceManager *resmgr, int expected_latency); + Common::Error init(ResourceManager *resourceManager, int expected_latency); /* Adds an iterator to the song player ** Parameters: (songx_iterator_t *) it: The iterator to play @@ -223,7 +223,7 @@ void SfxPlayer::player_timer_callback(void *refCon) { /* API implementation */ -Common::Error SfxPlayer::init(ResourceManager *resmgr, int expected_latency) { +Common::Error SfxPlayer::init(ResourceManager *resourceManager, int expected_latency) { MidiDriverType musicDriver = MidiDriver::detectMusicDriver(MDT_PCSPK | MDT_ADLIB); switch(musicDriver) { @@ -252,7 +252,7 @@ Common::Error SfxPlayer::init(ResourceManager *resmgr, int expected_latency) { _mutex = new Common::Mutex(); _mididrv->setTimerCallback(this, player_timer_callback); - _mididrv->open(resmgr); + _mididrv->open(resourceManager); _mididrv->setVolume(_volume); return Common::kNoError; @@ -354,7 +354,7 @@ SfxState::SfxState() { SfxState::~SfxState() { if (_syncResource) - _resMgr->unlockResource(_syncResource); + _resourceManager->unlockResource(_syncResource); } @@ -639,7 +639,7 @@ static int sfx_play_iterator_pcm(SongIterator *it, SongHandle handle) { #define DELAY (1000000 / SFX_TICKS_PER_SEC) -void SfxState::sfx_init(ResourceManager *resmgr, int flags) { +void SfxState::sfx_init(ResourceManager *resourceManager, int flags) { _songlib._lib = 0; _song = NULL; _flags = flags; @@ -661,7 +661,7 @@ void SfxState::sfx_init(ResourceManager *resmgr, int flags) { /* Initialise player */ /*-------------------*/ - if (!resmgr) { + if (!resourceManager) { warning("[SFX] Warning: No resource manager present, cannot initialise player"); return; } @@ -673,13 +673,13 @@ void SfxState::sfx_init(ResourceManager *resmgr, int flags) { return; } - if (player->init(resmgr, DELAY / 1000)) { + if (player->init(resourceManager, DELAY / 1000)) { warning("[SFX] Song player reported error, disabled"); delete player; player = NULL; } - _resMgr = resmgr; + _resourceManager = resourceManager; } void SfxState::sfx_exit() { @@ -1137,13 +1137,13 @@ Audio::AudioStream* SfxState::getAudioStream(uint32 number, uint32 volume, int * Sci::Resource* audioRes; if (volume == 65535) { - audioRes = _resMgr->findResource(ResourceId(kResourceTypeAudio, number), false); + audioRes = _resourceManager->findResource(ResourceId(kResourceTypeAudio, number), false); if (!audioRes) { warning("Failed to find audio entry %i", number); return NULL; } } else { - audioRes = _resMgr->findResource(ResourceId(kResourceTypeAudio36, volume, number), false); + audioRes = _resourceManager->findResource(ResourceId(kResourceTypeAudio36, volume, number), false); if (!audioRes) { warning("Failed to find audio entry (%i, %i, %i, %i, %i)", volume, (number >> 24) & 0xff, (number >> 16) & 0xff, (number >> 8) & 0xff, number & 0xff); diff --git a/engines/sci/sfx/core.h b/engines/sci/sfx/core.h index e7eba85c99..fc480aa452 100644 --- a/engines/sci/sfx/core.h +++ b/engines/sci/sfx/core.h @@ -52,7 +52,7 @@ public: // FIXME, make private bool _suspended; /**< Whether we are suspended */ Resource *_syncResource; /**< Used by kDoSync for speech syncing in CD talkie games */ uint _syncOffset; - ResourceManager *_resMgr; + ResourceManager *_resourceManager; public: SfxState(); @@ -63,10 +63,10 @@ public: /***********/ /* Initializes the sound engine - ** Parameters: (ResourceManager *) resmgr: Resource manager for initialization + ** Parameters: (ResourceManager *) resourceManager: Resource manager for initialization ** (int) flags: SFX_STATE_FLAG_* */ - void sfx_init(ResourceManager *resmgr, int flags); + void sfx_init(ResourceManager *resourceManager, int flags); /** Deinitializes the sound subsystem. */ void sfx_exit(); diff --git a/engines/sci/sfx/sci_midi.h b/engines/sci/sfx/sci_midi.h index ed97c9db1a..7cff14bdb0 100644 --- a/engines/sci/sfx/sci_midi.h +++ b/engines/sci/sfx/sci_midi.h @@ -67,7 +67,7 @@ protected: MidiDriver *_driver; public: int open() { return open(NULL); } - virtual int open(ResourceManager *resmgr) { return _driver->open(); } + virtual int open(ResourceManager *resourceManager) { return _driver->open(); } virtual void close() { _driver->close(); } virtual void send(uint32 b) { _driver->send(b); } uint32 getBaseTempo() { return _driver->getBaseTempo(); } diff --git a/engines/sci/sfx/softseq/adlib.cpp b/engines/sci/sfx/softseq/adlib.cpp index 33ccc28360..ba5d364cc5 100644 --- a/engines/sci/sfx/softseq/adlib.cpp +++ b/engines/sci/sfx/softseq/adlib.cpp @@ -623,11 +623,11 @@ void MidiDriver_Adlib::loadResource(Resource *res) { } } -int MidiPlayer_Adlib::open(ResourceManager *resmgr) { - assert(resmgr != NULL); +int MidiPlayer_Adlib::open(ResourceManager *resourceManager) { + assert(resourceManager != NULL); // Load up the patch.003 file, parse out the instruments - Resource *res = resmgr->findResource(ResourceId(kResourceTypePatch, 3), 0); + Resource *res = resourceManager->findResource(ResourceId(kResourceTypePatch, 3), 0); if (!res) { warning("ADLIB: Failed to load patch.003"); @@ -641,7 +641,7 @@ int MidiPlayer_Adlib::open(ResourceManager *resmgr) { static_cast(_driver)->loadResource(res); - return static_cast(_driver)->open(resmgr->sciVersion() <= SCI_VERSION_0_LATE); + return static_cast(_driver)->open(resourceManager->sciVersion() <= SCI_VERSION_0_LATE); } } // End of namespace Sci diff --git a/engines/sci/sfx/softseq/adlib.h b/engines/sci/sfx/softseq/adlib.h index 38f755bec0..bf72c2e15a 100644 --- a/engines/sci/sfx/softseq/adlib.h +++ b/engines/sci/sfx/softseq/adlib.h @@ -146,7 +146,7 @@ private: class MidiPlayer_Adlib : public MidiPlayer { public: MidiPlayer_Adlib() { _driver = new MidiDriver_Adlib(g_system->getMixer()); } - int open(ResourceManager *resmgr); + int open(ResourceManager *resourceManager); int getPlayMask() const { return 0x04; } int getPolyphony() const { return MidiDriver_Adlib::kVoices; } bool hasRhythmChannel() const { return false; } diff --git a/engines/sci/sfx/softseq/pcjr.h b/engines/sci/sfx/softseq/pcjr.h index 8bfa5ab8b1..9a88812c94 100644 --- a/engines/sci/sfx/softseq/pcjr.h +++ b/engines/sci/sfx/softseq/pcjr.h @@ -67,7 +67,7 @@ private: class MidiPlayer_PCJr : public MidiPlayer { public: MidiPlayer_PCJr() { _driver = new MidiDriver_PCJr(g_system->getMixer()); } - int open(ResourceManager *resmgr) { return static_cast(_driver)->open(getPolyphony()); } + int open(ResourceManager *resourceManager) { return static_cast(_driver)->open(getPolyphony()); } int getPlayMask() const { return 0x10; } int getPolyphony() const { return 3; } bool hasRhythmChannel() const { return false; } -- cgit v1.2.3