aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
authorFilippos Karapetis2009-08-25 08:38:14 +0000
committerFilippos Karapetis2009-08-25 08:38:14 +0000
commited66cad6777a779f5cabeec037a24613da0134bf (patch)
treea63032758b32e3ada2ec0287033edfc5a17ee1c3 /engines/sci/sfx
parentbc20237ae37cf042a0f7c2c49cd0ca68ef76379b (diff)
downloadscummvm-rg350-ed66cad6777a779f5cabeec037a24613da0134bf.tar.gz
scummvm-rg350-ed66cad6777a779f5cabeec037a24613da0134bf.tar.bz2
scummvm-rg350-ed66cad6777a779f5cabeec037a24613da0134bf.zip
- 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
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/core.cpp22
-rw-r--r--engines/sci/sfx/core.h6
-rw-r--r--engines/sci/sfx/sci_midi.h2
-rw-r--r--engines/sci/sfx/softseq/adlib.cpp8
-rw-r--r--engines/sci/sfx/softseq/adlib.h2
-rw-r--r--engines/sci/sfx/softseq/pcjr.h2
6 files changed, 21 insertions, 21 deletions
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<MidiDriver_Adlib *>(_driver)->loadResource(res);
- return static_cast<MidiDriver_Adlib *>(_driver)->open(resmgr->sciVersion() <= SCI_VERSION_0_LATE);
+ return static_cast<MidiDriver_Adlib *>(_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<MidiDriver_PCJr *>(_driver)->open(getPolyphony()); }
+ int open(ResourceManager *resourceManager) { return static_cast<MidiDriver_PCJr *>(_driver)->open(getPolyphony()); }
int getPlayMask() const { return 0x10; }
int getPolyphony() const { return 3; }
bool hasRhythmChannel() const { return false; }