summaryrefslogtreecommitdiff
path: root/indra/newview/llvieweraudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvieweraudio.cpp')
-rw-r--r--indra/newview/llvieweraudio.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index e9163abb4f..b3b4f43e57 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -76,7 +76,7 @@ LLViewerAudio::~LLViewerAudio()
void LLViewerAudio::registerIdleListener()
{
- if(mIdleListnerActive==false)
+ if (!mIdleListnerActive)
{
mIdleListnerActive = true;
doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this)));
@@ -355,9 +355,9 @@ void init_audio()
// load up our initial set of sounds we'll want so they're in memory and ready to be played
- BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
+ bool mute_audio = gSavedSettings.getBOOL("MuteAudio");
- if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload"))
+ if (!mute_audio && false == gSavedSettings.getBOOL("NoPreload"))
{
gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndAlert")));
gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndBadKeystroke")));
@@ -398,10 +398,10 @@ void init_audio()
void audio_update_volume(bool force_update)
{
F32 master_volume = gSavedSettings.getF32("AudioLevelMaster");
- BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
+ bool mute_audio = gSavedSettings.getBOOL("MuteAudio");
LLProgressView* progress = gViewerWindow->getProgressView();
- BOOL progress_view_visible = FALSE;
+ bool progress_view_visible = false;
if (progress)
{
@@ -410,7 +410,7 @@ void audio_update_volume(bool force_update)
if (!gViewerWindow->getActive() && gSavedSettings.getBOOL("MuteWhenMinimized"))
{
- mute_audio = TRUE;
+ mute_audio = true;
}
F32 mute_volume = mute_audio ? 0.0f : 1.0f;
@@ -464,7 +464,7 @@ void audio_update_volume(bool force_update)
}
F32 music_volume = gSavedSettings.getF32("AudioLevelMusic");
- BOOL music_muted = gSavedSettings.getBOOL("MuteMusic");
+ bool music_muted = gSavedSettings.getBOOL("MuteMusic");
F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume();
music_volume = mute_volume * master_volume * music_volume * fade_volume;
@@ -473,7 +473,7 @@ void audio_update_volume(bool force_update)
// Streaming Media
F32 media_volume = gSavedSettings.getF32("AudioLevelMedia");
- BOOL media_muted = gSavedSettings.getBOOL("MuteMedia");
+ bool media_muted = gSavedSettings.getBOOL("MuteMedia");
media_volume = mute_volume * master_volume * media_volume;
LLViewerMedia::getInstance()->setVolume( media_muted ? 0.0f : media_volume );
@@ -482,7 +482,7 @@ void audio_update_volume(bool force_update)
{
F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
voice_volume = mute_volume * master_volume * voice_volume;
- BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
+ bool voice_mute = gSavedSettings.getBOOL("MuteVoice");
LLVoiceClient *voice_inst = LLVoiceClient::getInstance();
voice_inst->setVoiceVolume(voice_mute ? 0.f : voice_volume);
voice_inst->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
@@ -554,8 +554,13 @@ void audio_update_wind(bool force_update)
// don't use the setter setMaxWindGain() because we don't
// want to screw up the fade-in on startup by setting actual source gain
// outside the fade-in.
- F32 master_volume = gSavedSettings.getBOOL("MuteAudio") ? 0.f : gSavedSettings.getF32("AudioLevelMaster");
- F32 ambient_volume = gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient");
+ static LLCachedControl<bool> mute_audio(gSavedSettings, "MuteAudio");
+ static LLCachedControl<bool> mute_ambient(gSavedSettings, "MuteAmbient");
+ static LLCachedControl<F32> level_master(gSavedSettings, "AudioLevelMaster");
+ static LLCachedControl<F32> level_ambient(gSavedSettings, "AudioLevelAmbient");
+
+ F32 master_volume = mute_audio() ? 0.f : level_master();
+ F32 ambient_volume = mute_ambient() ? 0.f : level_ambient();
F32 max_wind_volume = master_volume * ambient_volume;
const F32 WIND_SOUND_TRANSITION_TIME = 2.f;