From e6c8c40ef0c63fb6cdc08d60e35a10fbaac1aede Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 11 Jan 2009 05:09:43 -0700 Subject: Wind disabled by default, ambient wind muting fixed, added debug setting 'MuteWind' --- ChangeLog.txt | 10 +++ linden/indra/newview/app_settings/settings.xml | 13 +++- linden/indra/newview/llvieweraudio.cpp | 84 ++++++++++++++------------ linden/indra/newview/llvieweraudio.h | 2 - 4 files changed, 67 insertions(+), 42 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7c1e841..b8002f6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,13 @@ +2009-01-11 McCabe Maxsted + + * linden/indra/newview/llvieweraudio.cpp: + Wind disabled by default, ambient wind muting fixed, added debug setting 'MuteAudio'. + * linden/indra/newview/llvieweraudio.h: + Ditto. + * linden/indra/newview/app_settings/settings.xml: + Ditto. + + 2009-01-08 McCabe Maxsted * linden/indra/cmake/CopyWinLibs.cmake: diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index ca3dd81..7e591bf 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -4820,7 +4820,7 @@ MuteAmbient Comment - Ambient sound effects, such as wind noise, play at 0 volume + Ambient sound effects, play at 0 volume Persist 1 Type @@ -4905,6 +4905,17 @@ Value 1 + MuteWind + + Comment + Mute inworld wind generation + Persist + 1 + Type + Boolean + Value + 1 + NewCacheLocation Comment diff --git a/linden/indra/newview/llvieweraudio.cpp b/linden/indra/newview/llvieweraudio.cpp index 122a0bc..bc25649 100644 --- a/linden/indra/newview/llvieweraudio.cpp +++ b/linden/indra/newview/llvieweraudio.cpp @@ -62,7 +62,7 @@ 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")) { @@ -114,7 +114,9 @@ void init_audio() void audio_update_volume(bool force_update) { F32 master_volume = gSavedSettings.getF32("AudioLevelMaster"); - BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio"); + bool wind_muted = gSavedSettings.getBOOL("MuteWind"); + bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); + if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized"))) { mute_audio = TRUE; @@ -129,9 +131,9 @@ void audio_update_volume(bool force_update) gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler")); gAudiop->setDistanceFactor(gSavedSettings.getF32("AudioLevelDistance")); gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); -#ifdef kAUDIO_ENABLE_WIND + + if(wind_muted == false) gAudiop->enableWind(!mute_audio); -#endif gAudiop->setMuted(mute_audio); @@ -197,46 +199,50 @@ void audio_update_listener() void audio_update_wind(bool force_update) { -#ifdef kAUDIO_ENABLE_WIND - // - // Extract height above water to modulate filter by whether above/below water - // - LLViewerRegion* region = gAgent.getRegion(); - if (region) + bool wind_muted = gSavedSettings.getBOOL("MuteWind"); + bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); + + if(!mute_audio && !wind_muted) { - static F32 last_camera_water_height = -1000.f; - LLVector3 camera_pos = gAgent.getCameraPositionAgent(); - F32 camera_water_height = camera_pos.mV[VZ] - region->getWaterHeight(); - // - // Don't update rolloff factor unless water surface has been crossed - // - if (force_update || (last_camera_water_height * camera_water_height) < 0.f) + // Extract height above water to modulate filter by whether above/below water + // + LLViewerRegion* region = gAgent.getRegion(); + if (region) { - if (camera_water_height < 0.f) - { - gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff") * LL_ROLLOFF_MULTIPLIER_UNDER_WATER); - } - else + static F32 last_camera_water_height = -1000.f; + LLVector3 camera_pos = gAgent.getCameraPositionAgent(); + F32 camera_water_height = camera_pos.mV[VZ] - region->getWaterHeight(); + + // + // Don't update rolloff factor unless water surface has been crossed + // + if (force_update || (last_camera_water_height * camera_water_height) < 0.f) { - gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); + if (camera_water_height < 0.f) + { + gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff") * LL_ROLLOFF_MULTIPLIER_UNDER_WATER); + } + else + { + gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); + } } + // this line rotates the wind vector to be listener (agent) relative + // unfortunately we have to pre-translate to undo the translation that + // occurs in the transform call + gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal(gWindVec - gAgent.getVelocity()); + + // 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 ambient_volume = gSavedSettings.getF32("AudioLevelAmbient"); + gAudiop->mMaxWindGain = gSavedSettings.getBOOL("MuteAmbient") + ? 0.f + : ambient_volume * ambient_volume; + + last_camera_water_height = camera_water_height; + gAudiop->updateWind(gRelativeWindVec, camera_water_height); } - // this line rotates the wind vector to be listener (agent) relative - // unfortunately we have to pre-translate to undo the translation that - // occurs in the transform call - gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal(gWindVec - gAgent.getVelocity()); - - // 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 ambient_volume = gSavedSettings.getF32("AudioLevelAmbient"); - gAudiop->mMaxWindGain = gSavedSettings.getBOOL("MuteAmbient") - ? 0.f - : ambient_volume * ambient_volume; - - last_camera_water_height = camera_water_height; - gAudiop->updateWind(gRelativeWindVec, camera_water_height); } -#endif } diff --git a/linden/indra/newview/llvieweraudio.h b/linden/indra/newview/llvieweraudio.h index 6ab7c7f..b4a299c 100644 --- a/linden/indra/newview/llvieweraudio.h +++ b/linden/indra/newview/llvieweraudio.h @@ -32,8 +32,6 @@ #ifndef LL_VIEWERAUDIO_H #define LL_VIEWERAUDIO_H -// comment out to turn off wind -#define kAUDIO_ENABLE_WIND //#define kAUDIO_ENABLE_WATER 1 // comment out to turn off water #define kAUDIO_NUM_BUFFERS 30 #define kAUDIO_NUM_SOURCES 30 -- cgit v1.1