aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2011-05-12 23:09:48 +1000
committerPaul Gilbert2011-05-24 21:25:49 +1000
commitb3fb2b5db8aa73703dc86fdcd06be0d7d0c1b0b6 (patch)
treee856508257568bc38942508c6f2b7bf58d9b3fba /engines
parent3457253f03cd5a57281735360fc600f0fe831298 (diff)
downloadscummvm-rg350-b3fb2b5db8aa73703dc86fdcd06be0d7d0c1b0b6.tar.gz
scummvm-rg350-b3fb2b5db8aa73703dc86fdcd06be0d7d0c1b0b6.tar.bz2
scummvm-rg350-b3fb2b5db8aa73703dc86fdcd06be0d7d0c1b0b6.zip
TSAGE: More code for installing sound drivers
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/sound.cpp57
-rw-r--r--engines/tsage/sound.h27
2 files changed, 62 insertions, 22 deletions
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 062fb6dda8..6082537766 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -44,7 +44,7 @@ SoundManager::SoundManager() {
_volume = 127;
_suspendCtr = 0;
_disableCtr = 0;
- _field153 = 0;
+ _suspendedCount = 0;
_driversDetected = false;
}
@@ -152,7 +152,7 @@ void SoundManager::installDriver(int driverNum) {
byte *bankData = _resourceManager->getResource(RES_BANK, ROLAND_DRIVER_NUM, 0, true);
if (bankData) {
// Install the patch bank data
- _sfInstallPatchBank(bankData);
+ _sfInstallPatchBank(driver, bankData);
DEALLOCATE(bankData);
} else {
// Could not locate patch bank data, so unload the driver
@@ -368,6 +368,10 @@ bool SoundManager::_sfIsOnPlayList(Sound *sound) {
return result;
}
+void SoundManager::_sfRethinkSoundDrivers() {
+
+}
+
void SoundManager::_sfRethinkVoiceTypes() {
}
@@ -459,15 +463,29 @@ void SoundManager::_sfExtractGroupMask() {
}
bool SoundManager::_sfInstallDriver(SoundDriver *driver) {
- return false;
+ if (!driver->open())
+ return false;
+
+ sfManager()._installedDrivers.push_back(driver);
+ uint32 *maskList = driver->getGroupMaskList();
+ driver->_groupMask = *maskList;
+
+ _sfExtractGroupMask();
+ _sfRethinkSoundDrivers();
+ driver->setVolume(sfManager()._volume);
+
+ return true;
}
void SoundManager::_sfUnInstallDriver(SoundDriver *driver) {
+ sfManager()._installedDrivers.remove(driver);
+ _sfExtractGroupMask();
+ _sfRethinkSoundDrivers();
}
-void SoundManager::_sfInstallPatchBank(const byte *bankData) {
-
+void SoundManager::_sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
+ driver->installPatchBank(bankData);
}
/**
@@ -535,10 +553,10 @@ Sound::Sound() {
_holdAt = false;
_cueValue = -1;
_volume1 = -1;
- _field1F = 0;
+ _volume3 = 0;
_volume2 = 0;
- _field21 = 0;
- _field22 = 0;
+ _volume5 = 0;
+ _volume4 = 0;
_timeIndex = 0;
_field26 = 0;
_trackInfo.count = 0;
@@ -701,21 +719,21 @@ void Sound::mute(bool flag) {
_globals->_soundManager.restartSoundServer();
}
-void Sound::fade(int volume1, int volume2, int v3, int v4) {
+void Sound::fade(int volume1, int volume2, int volume3, int volume4) {
_globals->_soundManager.suspendSoundServer();
if (volume1 > 127)
volume1 = 127;
if (volume2 > 127)
volume2 = 127;
- if (v3 > 255)
- v3 = 255;
+ if (volume3 > 255)
+ volume3 = 255;
_volume1 = volume1;
_volume2 = volume2;
- _field1F = v3;
- _field21 = 0;
- _field22 = v4;
+ _volume3 = volume3;
+ _volume5 = 0;
+ _volume4 = volume4;
_globals->_soundManager.restartSoundServer();
}
@@ -851,4 +869,15 @@ void ASound::fade(int v1, int v2, int v3, int v4, Action *action) {
_sound.fade(v1, v2, v3, v4);
}
+
+/*--------------------------------------------------------------------------*/
+
+SoundDriver::SoundDriver() {
+ _driverNum = 0;
+ _minVersion = _maxVersion = 0;
+ _groupMaskList = NULL;
+
+ _groupMask = 0;
+}
+
} // End of namespace tSage
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 26c26817a5..22132bc6ca 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -58,11 +58,20 @@ public:
Common::String _shortDescription, _longDescription;
int _driverNum;
int _minVersion, _maxVersion;
+ uint32 *_groupMaskList;
+ // The following fields were originally held in separate arrays in the SoundManager class
+ uint32 _groupMask;
public:
+ SoundDriver();
+
const Common::String &getShortDriverDescription() { return _shortDescription; }
const Common::String &getLongDriverDescription() { return _longDescription; }
- virtual void setVolume(int volume) = 0;
+ virtual bool open() { return true; }
+ virtual void close() {}
+ virtual uint32 *getGroupMaskList() const { return _groupMaskList; }
+ virtual void setVolume(int volume) {}
+ virtual void installPatchBank(const byte *data) {}
};
class SoundManager : public SaveListener {
@@ -77,7 +86,7 @@ public:
int _volume;
int _disableCtr;
int _suspendCtr;
- int _field153;
+ int _suspendedCount;
bool _driversDetected;
Common::List<Sound *> _soundList;
Common::List<SoundDriverEntry> _availableDrivers;
@@ -137,6 +146,7 @@ public:
static void _sfAddToPlayList(Sound *sound);
static void _sfRemoveFromPlayList(Sound *sound);
static bool _sfIsOnPlayList(Sound *sound);
+ static void _sfRethinkSoundDrivers();
static void _sfRethinkVoiceTypes();
static void _sfUpdateVolume(Sound *sound);
static void _sfDereferenceAll();
@@ -147,7 +157,7 @@ public:
static void _sfExtractGroupMask();
static bool _sfInstallDriver(SoundDriver *driver);
static void _sfUnInstallDriver(SoundDriver *driver);
- static void _sfInstallPatchBank(const byte *bankData);
+ static void _sfInstallPatchBank(SoundDriver *driver, const byte *bankData);
static void _sfDoAddToPlayList(Sound *sound);
static bool _sfDoRemoveFromPlayList(Sound *sound);
static void _sfDoUpdateVolume(Sound *sound);
@@ -175,10 +185,10 @@ public:
int _holdAt;
int _cueValue;
int _volume1;
- int _field1F;
+ int _volume3;
int _volume2;
- int _field21;
- int _field22;
+ int _volume5;
+ int _volume4;
uint _timeIndex;
int _field26;
int _field28[SOUND_ARR_SIZE];
@@ -215,7 +225,7 @@ public:
bool isMuted() const;
void pause(bool flag);
void mute(bool flag);
- void fade(int v1, int v2, int v3, int v4);
+ void fade(int volume1, int volume2, int volume3, int v4);
void setTimeIndex(uint32 timeIndex);
uint32 getTimeIndex() const;
int getCueValue() const;
@@ -271,7 +281,8 @@ public:
class AdlibSoundDriver: public SoundDriver {
public:
- void setVolume(int volume) {}
+ virtual void setVolume(int volume) {}
+ virtual void installPatchBank(const byte *data) {}
};
} // End of namespace tSage