diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llvieweraudio.cpp | 84 |
1 files changed, 45 insertions, 39 deletions
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() | |||
62 | 62 | ||
63 | // load up our initial set of sounds we'll want so they're in memory and ready to be played | 63 | // load up our initial set of sounds we'll want so they're in memory and ready to be played |
64 | 64 | ||
65 | BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio"); | 65 | bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); |
66 | 66 | ||
67 | if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload")) | 67 | if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload")) |
68 | { | 68 | { |
@@ -114,7 +114,9 @@ void init_audio() | |||
114 | void audio_update_volume(bool force_update) | 114 | void audio_update_volume(bool force_update) |
115 | { | 115 | { |
116 | F32 master_volume = gSavedSettings.getF32("AudioLevelMaster"); | 116 | F32 master_volume = gSavedSettings.getF32("AudioLevelMaster"); |
117 | BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio"); | 117 | bool wind_muted = gSavedSettings.getBOOL("MuteWind"); |
118 | bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); | ||
119 | |||
118 | if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized"))) | 120 | if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized"))) |
119 | { | 121 | { |
120 | mute_audio = TRUE; | 122 | mute_audio = TRUE; |
@@ -129,9 +131,9 @@ void audio_update_volume(bool force_update) | |||
129 | gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler")); | 131 | gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler")); |
130 | gAudiop->setDistanceFactor(gSavedSettings.getF32("AudioLevelDistance")); | 132 | gAudiop->setDistanceFactor(gSavedSettings.getF32("AudioLevelDistance")); |
131 | gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); | 133 | gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); |
132 | #ifdef kAUDIO_ENABLE_WIND | 134 | |
135 | if(wind_muted == false) | ||
133 | gAudiop->enableWind(!mute_audio); | 136 | gAudiop->enableWind(!mute_audio); |
134 | #endif | ||
135 | 137 | ||
136 | gAudiop->setMuted(mute_audio); | 138 | gAudiop->setMuted(mute_audio); |
137 | 139 | ||
@@ -197,46 +199,50 @@ void audio_update_listener() | |||
197 | 199 | ||
198 | void audio_update_wind(bool force_update) | 200 | void audio_update_wind(bool force_update) |
199 | { | 201 | { |
200 | #ifdef kAUDIO_ENABLE_WIND | 202 | bool wind_muted = gSavedSettings.getBOOL("MuteWind"); |
201 | // | 203 | bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); |
202 | // Extract height above water to modulate filter by whether above/below water | 204 | |
203 | // | 205 | if(!mute_audio && !wind_muted) |
204 | LLViewerRegion* region = gAgent.getRegion(); | ||
205 | if (region) | ||
206 | { | 206 | { |
207 | static F32 last_camera_water_height = -1000.f; | ||
208 | LLVector3 camera_pos = gAgent.getCameraPositionAgent(); | ||
209 | F32 camera_water_height = camera_pos.mV[VZ] - region->getWaterHeight(); | ||
210 | |||
211 | // | 207 | // |
212 | // Don't update rolloff factor unless water surface has been crossed | 208 | // Extract height above water to modulate filter by whether above/below water |
213 | // | 209 | // |
214 | if (force_update || (last_camera_water_height * camera_water_height) < 0.f) | 210 | LLViewerRegion* region = gAgent.getRegion(); |
211 | if (region) | ||
215 | { | 212 | { |
216 | if (camera_water_height < 0.f) | 213 | static F32 last_camera_water_height = -1000.f; |
217 | { | 214 | LLVector3 camera_pos = gAgent.getCameraPositionAgent(); |
218 | gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff") * LL_ROLLOFF_MULTIPLIER_UNDER_WATER); | 215 | F32 camera_water_height = camera_pos.mV[VZ] - region->getWaterHeight(); |
219 | } | 216 | |
220 | else | 217 | // |
218 | // Don't update rolloff factor unless water surface has been crossed | ||
219 | // | ||
220 | if (force_update || (last_camera_water_height * camera_water_height) < 0.f) | ||
221 | { | 221 | { |
222 | gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); | 222 | if (camera_water_height < 0.f) |
223 | { | ||
224 | gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff") * LL_ROLLOFF_MULTIPLIER_UNDER_WATER); | ||
225 | } | ||
226 | else | ||
227 | { | ||
228 | gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); | ||
229 | } | ||
223 | } | 230 | } |
231 | // this line rotates the wind vector to be listener (agent) relative | ||
232 | // unfortunately we have to pre-translate to undo the translation that | ||
233 | // occurs in the transform call | ||
234 | gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal(gWindVec - gAgent.getVelocity()); | ||
235 | |||
236 | // don't use the setter setMaxWindGain() because we don't | ||
237 | // want to screw up the fade-in on startup by setting actual source gain | ||
238 | // outside the fade-in. | ||
239 | F32 ambient_volume = gSavedSettings.getF32("AudioLevelAmbient"); | ||
240 | gAudiop->mMaxWindGain = gSavedSettings.getBOOL("MuteAmbient") | ||
241 | ? 0.f | ||
242 | : ambient_volume * ambient_volume; | ||
243 | |||
244 | last_camera_water_height = camera_water_height; | ||
245 | gAudiop->updateWind(gRelativeWindVec, camera_water_height); | ||
224 | } | 246 | } |
225 | // this line rotates the wind vector to be listener (agent) relative | ||
226 | // unfortunately we have to pre-translate to undo the translation that | ||
227 | // occurs in the transform call | ||
228 | gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal(gWindVec - gAgent.getVelocity()); | ||
229 | |||
230 | // don't use the setter setMaxWindGain() because we don't | ||
231 | // want to screw up the fade-in on startup by setting actual source gain | ||
232 | // outside the fade-in. | ||
233 | F32 ambient_volume = gSavedSettings.getF32("AudioLevelAmbient"); | ||
234 | gAudiop->mMaxWindGain = gSavedSettings.getBOOL("MuteAmbient") | ||
235 | ? 0.f | ||
236 | : ambient_volume * ambient_volume; | ||
237 | |||
238 | last_camera_water_height = camera_water_height; | ||
239 | gAudiop->updateWind(gRelativeWindVec, camera_water_height); | ||
240 | } | 247 | } |
241 | #endif | ||
242 | } | 248 | } |