diff options
author | Paul Gilbert | 2011-05-07 14:13:52 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-05-07 14:13:52 +1000 |
commit | 43dbf9ff56b932f0f0b8fe09361af87c64a68d16 (patch) | |
tree | b7e2ff236cee2a83ee09a82979ef365c6cc50dec /engines/tsage/sound.cpp | |
parent | c470d1e6d2977622530ae53f1620e813849720c9 (diff) | |
download | scummvm-rg350-43dbf9ff56b932f0f0b8fe09361af87c64a68d16.tar.gz scummvm-rg350-43dbf9ff56b932f0f0b8fe09361af87c64a68d16.tar.bz2 scummvm-rg350-43dbf9ff56b932f0f0b8fe09361af87c64a68d16.zip |
TSAGE: Implemented more _sf methods
Diffstat (limited to 'engines/tsage/sound.cpp')
-rw-r--r-- | engines/tsage/sound.cpp | 92 |
1 files changed, 81 insertions, 11 deletions
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 2b7a2c686d..39ebf07221 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -94,7 +94,7 @@ Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) { } void SoundManager::installConfigDrivers() { - + installDriver(ADLIB_DRIVER_NUM); } Common::List<SoundDriverEntry> &SoundManager::getDriverList(bool detectFlag) { @@ -329,6 +329,10 @@ void SoundManager::listenerSynchronise(Serialiser &s) { /*--------------------------------------------------------------------------*/ +SoundManager &SoundManager::sfManager() { + return _globals->_soundManager; +} + void SoundManager::_soSetTimeIndex(int timeIndex) { warning("TODO: _soSetTimeIndex"); } @@ -346,12 +350,19 @@ int SoundManager::_sfDetermineGroup(const byte *soundData) { return 0; } -void SoundManager::_sfAddToPlayList(Sound*soundData) { - +void SoundManager::_sfAddToPlayList(Sound *sound) { + ++sfManager()._suspendCtr; + _sfDoAddToPlayList(sound); + sound->_field6 = 0; + _sfRethinkVoiceTypes(); + --sfManager()._suspendCtr; } void SoundManager::_sfRemoveFromPlayList(Sound *sound) { - + ++sfManager()._suspendCtr; + if (_sfDoRemoveFromPlayList(sound)) + _sfRethinkVoiceTypes(); + --sfManager()._suspendCtr; } bool SoundManager::_sfIsOnPlayList(Sound *sound) { @@ -368,23 +379,35 @@ void SoundManager::_sfRethinkVoiceTypes() { void SoundManager::_sfUpdateVolume(Sound *sound) { _sfDereferenceAll(); - sub_233EE(sound); + _sfDoUpdateVolume(sound); } void SoundManager::_sfDereferenceAll() { - -} - -void SoundManager::sub_233EE(Sound *sound) { - + // Orignal used handles for both the driver list and voiceStructPtrs list. This method then refreshed + // pointer lists based on the handles. Since in ScummVM we're just using pointers directly, this + // method doesn't need any implementation } void SoundManager::_sfUpdatePriority(Sound *sound) { + ++_globals->_soundManager._suspendCtr; + int tempPriority = (sound->_priority2 == 255) ? sound->_soundPriority : sound->_priority; + if (sound->_priority != tempPriority) { + sound->_priority = tempPriority; + if (_sfDoRemoveFromPlayList(sound)) { + _sfDoAddToPlayList(sound); + _sfRethinkVoiceTypes(); + } + } + + --_globals->_soundManager._suspendCtr; } void SoundManager::_sfUpdateLoop(Sound *sound) { - + if (sound->_loopFlag2) + sound->_loopFlag = sound->_loop; + else + sound->_loopFlag = sound->_loopFlag2; } void SoundManager::_sfSetMasterVol(int volume) { @@ -452,6 +475,53 @@ void SoundManager::_sfInstallPatchBank(const byte *bankData) { } +/** + * Adds the specified sound in the playing sound list, inserting in order of priority + */ +void SoundManager::_sfDoAddToPlayList(Sound *sound) { + ++sfManager()._suspendCtr; + + Common::List<Sound *>::iterator i = sfManager()._playList.begin(); + while ((i != sfManager()._playList.end()) && (sound->_priority > (*i)->_priority)) + ++i; + + sfManager()._playList.insert(i, sound); + --sfManager()._suspendCtr; +} + +/** + * Removes the specified sound from the play list + */ +bool SoundManager::_sfDoRemoveFromPlayList(Sound *sound) { + ++sfManager()._suspendCtr; + + bool result = false; + for (Common::List<Sound *>::iterator i = sfManager()._playList.begin(); i != sfManager()._playList.end(); ++i) { + if (*i == sound) { + result = true; + sfManager()._playList.erase(i); + break; + } + } + + --sfManager()._suspendCtr; + return result; +} + +void SoundManager::_sfDoUpdateVolume(Sound *sound) { + ++_globals->_soundManager._suspendCtr; + + for (int idx = 0; idx < 16; ++idx) { + Sound *snd = sfManager()._voiceStructPtrs[idx]; + if (!snd) + continue; + + // TODO: More stuff + } + + --_globals->_soundManager._suspendCtr; +} + /*--------------------------------------------------------------------------*/ Sound::Sound() { |