diff options
Diffstat (limited to 'indra/newview/llmutelist.cpp')
-rw-r--r-- | indra/newview/llmutelist.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index e2b5c821ae..5311a594fb 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -72,9 +72,6 @@ #include "llviewerobjectlist.h" -std::map<LLUUID, F32> LLMuteList::sUserVolumeSettings; - - // "emptymutelist" class LLDispatchEmptyMuteList : public LLDispatchHandler { @@ -182,10 +179,19 @@ LLMuteList* LLMuteList::getInstance() // LLMuteList() //----------------------------------------------------------------------------- LLMuteList::LLMuteList() : - mIsLoaded(FALSE) + mIsLoaded(FALSE), + mUserVolumesLoaded(FALSE) { gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); +} +void LLMuteList::loadUserVolumes() +{ + // call once, after LLDir::setLindenUserDir() has been called + if (mUserVolumesLoaded) + return; + mUserVolumesLoaded = TRUE; + // load per-resident voice volume information // conceptually, this is part of the mute list information, although it is only stored locally std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml"); @@ -201,7 +207,7 @@ LLMuteList::LLMuteList() : for (LLSD::map_const_iterator iter = settings_llsd.beginMap(); iter != settings_llsd.endMap(); ++iter) { - sUserVolumeSettings.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal())); + mUserVolumeSettings.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal())); } } @@ -213,7 +219,7 @@ LLMuteList::~LLMuteList() std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml"); LLSD settings_llsd; - for(user_volume_map_t::iterator iter = sUserVolumeSettings.begin(); iter != sUserVolumeSettings.end(); ++iter) + for(user_volume_map_t::iterator iter = mUserVolumeSettings.begin(); iter != mUserVolumeSettings.end(); ++iter) { settings_llsd[iter->first.asString()] = iter->second; } @@ -668,6 +674,8 @@ BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) c //----------------------------------------------------------------------------- void LLMuteList::requestFromServer(const LLUUID& agent_id) { + loadUserVolumes(); + std::string agent_id_string; std::string filename; agent_id.toString(agent_id_string); @@ -705,15 +713,15 @@ void LLMuteList::cache(const LLUUID& agent_id) void LLMuteList::setSavedResidentVolume(const LLUUID& id, F32 volume) { // store new value in volume settings file - sUserVolumeSettings[id] = volume; + mUserVolumeSettings[id] = volume; } F32 LLMuteList::getSavedResidentVolume(const LLUUID& id) { const F32 DEFAULT_VOLUME = 0.5f; - - user_volume_map_t::iterator found_it = sUserVolumeSettings.find(id); - if (found_it != sUserVolumeSettings.end()) + + user_volume_map_t::iterator found_it = mUserVolumeSettings.find(id); + if (found_it != mUserVolumeSettings.end()) { return found_it->second; } |