diff options
author | Paul Gilbert | 2014-11-07 22:09:09 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-12-12 22:24:34 -0500 |
commit | dc218d53ef9d9b6de11e26e1b793204d416fc9db (patch) | |
tree | 89bc2ad30076b0554c7f0ef62a64b2dc98ea58ea /engines/access/sound.cpp | |
parent | 63bacba2d906f650e702ba544c5a49528452b5b2 (diff) | |
download | scummvm-rg350-dc218d53ef9d9b6de11e26e1b793204d416fc9db.tar.gz scummvm-rg350-dc218d53ef9d9b6de11e26e1b793204d416fc9db.tar.bz2 scummvm-rg350-dc218d53ef9d9b6de11e26e1b793204d416fc9db.zip |
ACCESS: Merge the sound resource and priority lists
Diffstat (limited to 'engines/access/sound.cpp')
-rw-r--r-- | engines/access/sound.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp index dd8cf16189..075bfc005e 100644 --- a/engines/access/sound.cpp +++ b/engines/access/sound.cpp @@ -44,14 +44,17 @@ SoundManager::~SoundManager() { void SoundManager::clearSounds() { for (uint i = 0; i < _soundTable.size(); ++i) - delete _soundTable[i]; + delete _soundTable[i]._res; _soundTable.clear(); - _soundPriority.clear(); } void SoundManager::queueSound(int idx, int fileNum, int subfile) { - delete _soundTable[idx]; - _soundTable[idx] = _vm->_files->loadFile(fileNum, subfile); + if (idx >= (int)_soundTable.size()) + _soundTable.resize(idx + 1); + + delete _soundTable[idx]._res; + _soundTable[idx]._res = _vm->_files->loadFile(fileNum, subfile); + _soundTable[idx]._priority = 1; } Resource *SoundManager::loadSound(int fileNum, int subfile) { @@ -59,8 +62,8 @@ Resource *SoundManager::loadSound(int fileNum, int subfile) { } void SoundManager::playSound(int soundIndex) { - int priority = _soundPriority[soundIndex]; - playSound(_soundTable[soundIndex], priority); + int priority = _soundTable[soundIndex]._priority; + playSound(_soundTable[soundIndex]._res, priority); } void SoundManager::playSound(Resource *res, int priority) { @@ -76,8 +79,8 @@ void SoundManager::loadSounds(Common::Array<RoomInfo::SoundIdent> &sounds) { clearSounds(); for (uint i = 0; i < sounds.size(); ++i) { - _soundTable.push_back(loadSound(sounds[i]._fileNum, sounds[i]._subfile)); - _soundPriority.push_back(sounds[i]._priority); + Resource *sound = loadSound(sounds[i]._fileNum, sounds[i]._subfile); + _soundTable.push_back(SoundEntry(sound, sounds[i]._priority)); } } |