diff --git a/apps/openmw/mwsound/sound_buffer.hpp b/apps/openmw/mwsound/sound_buffer.hpp index 61d569e131..5c45ac08aa 100644 --- a/apps/openmw/mwsound/sound_buffer.hpp +++ b/apps/openmw/mwsound/sound_buffer.hpp @@ -60,8 +60,12 @@ namespace MWSound ~SoundBufferPool(); + /// Lookup a soundId for its sound data (resource name, local volume, + /// minRange, and maxRange) Sound_Buffer* lookup(const std::string& soundId) const; + /// Lookup a soundId for its sound data (resource name, local volume, + /// minRange, and maxRange), and ensure it's ready for use. Sound_Buffer* load(const std::string& soundId); void use(Sound_Buffer& sfx) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 03ad58088a..44465e5a76 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -120,20 +120,6 @@ namespace MWSound return DecoderPtr(new DEFAULT_DECODER (mVFS)); } - // Lookup a soundId for its sound data (resource name, local volume, - // minRange, and maxRange) - Sound_Buffer *SoundManager::lookupSound(const std::string &soundId) const - { - return mSoundBuffers.lookup(soundId); - } - - // Lookup a soundId for its sound data (resource name, local volume, - // minRange, and maxRange), and ensure it's ready for use. - Sound_Buffer *SoundManager::loadSound(const std::string &soundId) - { - return mSoundBuffers.load(soundId); - } - DecoderPtr SoundManager::loadVoice(const std::string &voicefile) { try @@ -509,7 +495,7 @@ namespace MWSound if(!mOutput->isInitialized()) return nullptr; - Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId)); + Sound_Buffer *sfx = mSoundBuffers.load(Misc::StringUtils::lowerCase(soundId)); if(!sfx) return nullptr; // Only one copy of given sound can be played at time, so stop previous copy @@ -545,7 +531,7 @@ namespace MWSound return nullptr; // Look up the sound in the ESM data - Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId)); + Sound_Buffer *sfx = mSoundBuffers.load(Misc::StringUtils::lowerCase(soundId)); if(!sfx) return nullptr; // Only one copy of given sound can be played at time on ptr, so stop previous copy @@ -597,7 +583,7 @@ namespace MWSound return nullptr; // Look up the sound in the ESM data - Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId)); + Sound_Buffer *sfx = mSoundBuffers.load(Misc::StringUtils::lowerCase(soundId)); if(!sfx) return nullptr; SoundPtr sound = getSoundRef(); @@ -645,7 +631,7 @@ namespace MWSound if(!mOutput->isInitialized()) return; - Sound_Buffer *sfx = lookupSound(Misc::StringUtils::lowerCase(soundId)); + Sound_Buffer *sfx = mSoundBuffers.lookup(Misc::StringUtils::lowerCase(soundId)); if (!sfx) return; stopSound(sfx, ptr); @@ -697,7 +683,7 @@ namespace MWSound SoundMap::iterator snditer = mActiveSounds.find(ptr); if(snditer != mActiveSounds.end()) { - Sound_Buffer *sfx = lookupSound(Misc::StringUtils::lowerCase(soundId)); + Sound_Buffer *sfx = mSoundBuffers.lookup(Misc::StringUtils::lowerCase(soundId)); if (sfx == nullptr) return; for(SoundBufferRefPair &sndbuf : snditer->second) @@ -713,7 +699,7 @@ namespace MWSound SoundMap::const_iterator snditer = mActiveSounds.find(ptr); if(snditer != mActiveSounds.end()) { - Sound_Buffer *sfx = lookupSound(Misc::StringUtils::lowerCase(soundId)); + Sound_Buffer *sfx = mSoundBuffers.lookup(Misc::StringUtils::lowerCase(soundId)); return std::find_if(snditer->second.cbegin(), snditer->second.cend(), [this,sfx](const SoundBufferRefPair &snd) -> bool { return snd.second == sfx && mOutput->isSoundPlaying(snd.first.get()); } @@ -826,7 +812,7 @@ namespace MWSound bool soundIdChanged = false; - Sound_Buffer* sfx = lookupSound(update.mId); + Sound_Buffer* sfx = mSoundBuffers.lookup(update.mId); if (mLastCell != cell) { const auto snditer = mActiveSounds.find(MWWorld::ConstPtr()); diff --git a/apps/openmw/mwsound/soundmanagerimp.hpp b/apps/openmw/mwsound/soundmanagerimp.hpp index 21004dc94a..6b9de800f0 100644 --- a/apps/openmw/mwsound/soundmanagerimp.hpp +++ b/apps/openmw/mwsound/soundmanagerimp.hpp @@ -99,9 +99,6 @@ namespace MWSound Sound_Buffer *insertSound(const std::string &soundId, const ESM::Sound *sound); - Sound_Buffer *lookupSound(const std::string &soundId) const; - Sound_Buffer *loadSound(const std::string &soundId); - // returns a decoder to start streaming, or nullptr if the sound was not found DecoderPtr loadVoice(const std::string &voicefile);