aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/app_settings/settings.xml13
-rw-r--r--linden/indra/newview/llvieweraudio.cpp84
-rw-r--r--linden/indra/newview/llvieweraudio.h2
3 files changed, 57 insertions, 42 deletions
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 @@
4820 <key>MuteAmbient</key> 4820 <key>MuteAmbient</key>
4821 <map> 4821 <map>
4822 <key>Comment</key> 4822 <key>Comment</key>
4823 <string>Ambient sound effects, such as wind noise, play at 0 volume</string> 4823 <string>Ambient sound effects, play at 0 volume</string>
4824 <key>Persist</key> 4824 <key>Persist</key>
4825 <integer>1</integer> 4825 <integer>1</integer>
4826 <key>Type</key> 4826 <key>Type</key>
@@ -4905,6 +4905,17 @@
4905 <key>Value</key> 4905 <key>Value</key>
4906 <integer>1</integer> 4906 <integer>1</integer>
4907 </map> 4907 </map>
4908 <key>MuteWind</key>
4909 <map>
4910 <key>Comment</key>
4911 <string>Mute inworld wind generation</string>
4912 <key>Persist</key>
4913 <integer>1</integer>
4914 <key>Type</key>
4915 <string>Boolean</string>
4916 <key>Value</key>
4917 <integer>1</integer>
4918 </map>
4908 <key>NewCacheLocation</key> 4919 <key>NewCacheLocation</key>
4909 <map> 4920 <map>
4910 <key>Comment</key> 4921 <key>Comment</key>
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()
114void audio_update_volume(bool force_update) 114void 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
198void audio_update_wind(bool force_update) 200void 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}
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 @@
32#ifndef LL_VIEWERAUDIO_H 32#ifndef LL_VIEWERAUDIO_H
33#define LL_VIEWERAUDIO_H 33#define LL_VIEWERAUDIO_H
34 34
35// comment out to turn off wind
36#define kAUDIO_ENABLE_WIND
37//#define kAUDIO_ENABLE_WATER 1 // comment out to turn off water 35//#define kAUDIO_ENABLE_WATER 1 // comment out to turn off water
38#define kAUDIO_NUM_BUFFERS 30 36#define kAUDIO_NUM_BUFFERS 30
39#define kAUDIO_NUM_SOURCES 30 37#define kAUDIO_NUM_SOURCES 30