Merge branch 'master' of git://github.com/Shyotl/SingularityViewer

Conflicts:
	indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml - Resolved to the eye's pleasure.
This commit is contained in:
Lirusaito
2012-07-20 10:41:25 -04:00
15 changed files with 68 additions and 60 deletions

View File

@@ -47,7 +47,6 @@
#include "lllistener.h"
const F32 LL_WIND_UPDATE_INTERVAL = 0.1f;
const F32 LL_ROLLOFF_MULTIPLIER_UNDER_WATER = 5.f; // How much sounds are weaker under water
const F32 LL_WIND_UNDERWATER_CENTER_FREQ = 20.f;
const F32 ATTACHED_OBJECT_TIMEOUT = 5.0f;

View File

@@ -72,6 +72,8 @@ bool attemptDelayLoad()
FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels);
FMOD::ChannelGroup *LLAudioEngine_FMODEX::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0};
LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler)
{
mInited = false;
@@ -159,7 +161,13 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
U32 fmod_flags = FMOD_INIT_NORMAL;
if(mEnableProfiler)
{
fmod_flags |= FMOD_INIT_ENABLE_PROFILE;
mSystem->createChannelGroup("None", &mChannelGroups[AUDIO_TYPE_NONE]);
mSystem->createChannelGroup("SFX", &mChannelGroups[AUDIO_TYPE_SFX]);
mSystem->createChannelGroup("UI", &mChannelGroups[AUDIO_TYPE_UI]);
mSystem->createChannelGroup("Ambient", &mChannelGroups[AUDIO_TYPE_AMBIENT]);
}
#if LL_LINUX
bool audio_ok = false;
@@ -604,6 +612,9 @@ void LLAudioChannelFMODEX::play()
Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::pause");
getSource()->setPlayedOnce(true);
if(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()])
mChannelp->setChannelGroup(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]);
}

View File

@@ -44,6 +44,7 @@ namespace FMOD
{
class System;
class Channel;
class ChannelGroup;
class Sound;
class DSP;
}
@@ -83,6 +84,9 @@ protected:
FMOD::DSP *mWindDSP;
FMOD::System *mSystem;
bool mEnableProfiler;
public:
static FMOD::ChannelGroup *mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT];
};

View File

@@ -106,6 +106,15 @@ void LLListener_FMODEX::commitDeferredChanges()
void LLListener_FMODEX::setRolloffFactor(F32 factor)
{
//An internal FMODEx optimization skips 3D updates if there have not been changes to the 3D sound environment.
//Sadly, a change in rolloff is not accounted for, thus we must touch the listener properties as well.
//In short: Changing the position ticks a dirtyflag inside fmodex, which makes it not skip 3D processing next update call.
if(mRolloffFactor != factor)
{
LLVector3 pos = mVelocity - LLVector3(0.f,0.f,.1f);
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)pos.mV, NULL, NULL, NULL);
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mVelocity.mV, NULL, NULL, NULL);
}
mRolloffFactor = factor;
mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor);
}

View File

@@ -70,9 +70,7 @@ LLStreamingAudio_FMODEX::LLStreamingAudio_FMODEX(FMOD::System *system) :
mCurrentInternetStreamp(NULL),
mFMODInternetStreamChannelp(NULL),
mGain(1.0f),
mMetaData(NULL),
mStarvedProgress(0),
mStarvedNoProgressFrames(0)
mMetaData(NULL)
{
// Number of milliseconds of audio to buffer for the audio card.
// Must be larger than the usual Second Life frame stutter time.
@@ -252,27 +250,10 @@ void LLStreamingAudio_FMODEX::update()
llinfos << " (diskbusy="<<diskbusy<<")" << llendl;
llinfos << " (progress="<<progress<<")" << llendl;
mFMODInternetStreamChannelp->setMute(true);
mStarvedProgress = progress;
mStarvedNoProgressFrames = 0;
}
else if(mStarvedProgress == progress)
{
if(++mStarvedNoProgressFrames >= 10)
{
//we got 10 consecutive updates of 0 progress made on the stream buffer. It probably stalled.
llinfos << "Stream unable to recover from starvation. Halting." << llendl;
stop();
return;
}
}
else
{
mStarvedNoProgressFrames = 0;
mStarvedProgress = progress;
}
mLastStarved.start();
}
else if(mLastStarved.getStarted() && mLastStarved.getElapsedTimeF32() > 5.f)
else if(mLastStarved.getStarted() && mLastStarved.getElapsedTimeF32() > 1.f)
{
mLastStarved.stop();
mFMODInternetStreamChannelp->setMute(false);

View File

@@ -80,8 +80,6 @@ private:
F32 mGain;
LLTimer mLastStarved;
unsigned int mStarvedProgress;
unsigned int mStarvedNoProgressFrames;
LLSD *mMetaData;
};

View File

@@ -1801,6 +1801,17 @@
<key>Value</key>
<real>1.0</real>
</map>
<key>AudioLevelUnderwaterRolloff</key>
<map>
<key>Comment</key>
<string>Controls the distance-based dropoff of audio volume when camera is submerged (fraction or multiple of default audio rolloff)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>4.0</real>
</map>
<key>AudioLevelSFX</key>
<map>
<key>Comment</key>

View File

@@ -105,6 +105,7 @@ void LLPanelAudioPrefs::refreshValues()
mPreviousMediaVolume = gSavedSettings.getF32("AudioLevelMedia");
mPreviousDoppler = gSavedSettings.getF32("AudioLevelDoppler");
mPreviousRolloff = gSavedSettings.getF32("AudioLevelRolloff");
mPreviousUnderwaterRolloff = gSavedSettings.getF32("AudioLevelUnderwaterRolloff");
mPreviousMoneyThreshold = gSavedSettings.getF32("UISndMoneyChangeThreshold");
mPreviousHealthThreshold = gSavedSettings.getF32("UISndHealthReductionThreshold");
@@ -126,6 +127,7 @@ void LLPanelAudioPrefs::cancel()
gSavedSettings.setF32("AudioLevelMedia", mPreviousMediaVolume);
gSavedSettings.setF32("AudioLevelDoppler", mPreviousDoppler );
gSavedSettings.setF32("AudioLevelRolloff", mPreviousRolloff );
gSavedSettings.setF32("AudioLevelUnderwaterRolloff", mPreviousUnderwaterRolloff );
gSavedSettings.setF32("UISndMoneyChangeThreshold", mPreviousMoneyThreshold );
gSavedSettings.setF32("UISndHealthReductionThreshold", mPreviousHealthThreshold );

View File

@@ -67,6 +67,7 @@ private:
F32 mPreviousDoppler;
F32 mPreviousDistance;
F32 mPreviousRolloff;
F32 mPreviousUnderwaterRolloff;
S32 mPreviousBitrate;

View File

@@ -224,6 +224,9 @@ BOOL LLPanelDisplay::postBuild()
mGraphicsBorder = getChild<LLViewBorder>("GraphicsBorder");
// Enable Transparent Water
mCtrlTransparentWater = getChild<LLCheckBoxCtrl>("TransparentWater");
//----------------------------------------------------------------------------
// Enable Bump/Shiny
mCtrlBumpShiny = getChild<LLCheckBoxCtrl>("BumpShiny");
@@ -414,6 +417,7 @@ void LLPanelDisplay::refresh()
mQualityPerformance = gSavedSettings.getU32("RenderQualityPerformance");
mCustomSettings = gSavedSettings.getBOOL("RenderCustomSettings");
mTransparentWater = gSavedSettings.getBOOL("RenderTransparentWater");
// shader settings
mBumpShiny = gSavedSettings.getBOOL("RenderObjectBump");
mShaderEnable = gSavedSettings.getBOOL("VertexShaderEnable");
@@ -678,6 +682,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden)
llassert(mSkyFactorText != NULL);
llassert(mPostProcessText != NULL);
llassert(mCtrlTransparentWater != NULL);
llassert(mCtrlBumpShiny != NULL);
llassert(mCtrlWindLight != NULL);
llassert(mCtrlAvatarVP != NULL);
@@ -730,6 +735,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden)
mSkyFactorText->setVisible(!isHidden);
mPostProcessText->setVisible(!isHidden);
mCtrlTransparentWater->setVisible(!isHidden);
mCtrlBumpShiny->setVisible(!isHidden);
mCtrlWindLight->setVisible(!isHidden);
mCtrlAvatarVP->setVisible(!isHidden);
@@ -777,6 +783,7 @@ void LLPanelDisplay::cancel()
gSavedSettings.setBOOL("RenderCustomSettings", mCustomSettings);
gSavedSettings.setBOOL("RenderTransparentWater", mTransparentWater);
gSavedSettings.setBOOL("RenderObjectBump", mBumpShiny);
gSavedSettings.setBOOL("VertexShaderEnable", mShaderEnable);
gSavedSettings.setBOOL("WindLightUseAtmosShaders", mWindLight);

View File

@@ -107,6 +107,7 @@ protected:
LLSliderCtrl *mCtrlPostProcess; // Max Particle
LLSliderCtrl *mCtrlNonImpostors; // Max non-impostors
LLCheckBoxCtrl *mCtrlTransparentWater;
LLCheckBoxCtrl *mCtrlBumpShiny;
LLCheckBoxCtrl *mCtrlWindLight;
LLCheckBoxCtrl *mCtrlAvatarVP;
@@ -155,6 +156,7 @@ protected:
S32 mQualityPerformance;
BOOL mCustomSettings;
BOOL mTransparentWater;
BOOL mBumpShiny;
BOOL mShaderEnable;
BOOL mWindLight;

View File

@@ -134,6 +134,7 @@ void audio_update_volume(bool force_update)
static const LLCachedControl<bool> mute_when_minimized("MuteWhenMinimized",true);
static const LLCachedControl<F32> audio_level_doppler("AudioLevelDoppler",1.0);
static const LLCachedControl<F32> audio_level_rolloff("AudioLevelRolloff",1.0);
static const LLCachedControl<F32> audio_level_underwater_rolloff("AudioLevelUnderwaterRolloff",3.0);
BOOL mute_audio = _mute_audio;
if (!gViewerWindow->getActive() && mute_when_minimized)
{
@@ -147,7 +148,11 @@ void audio_update_volume(bool force_update)
gAudiop->setMasterGain ( master_volume );
gAudiop->setDopplerFactor(audio_level_doppler);
gAudiop->setRolloffFactor(audio_level_rolloff);
if(!LLViewerCamera::getInstance()->cameraUnderWater())
gAudiop->setRolloffFactor( audio_level_rolloff );
else
gAudiop->setRolloffFactor( audio_level_underwater_rolloff );
gAudiop->setMuted(mute_audio);
if (force_update)
@@ -215,32 +220,8 @@ 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)
if(gAgent.getRegion())
{
static F32 last_camera_water_height = -1000.f;
LLVector3 camera_pos = gAgentCamera.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)
{
static const LLCachedControl<F32> audio_level_rolloff("AudioLevelRolloff",1);
if (camera_water_height < 0.f)
{
gAudiop->setRolloffFactor(audio_level_rolloff * LL_ROLLOFF_MULTIPLIER_UNDER_WATER);
}
else
{
gAudiop->setRolloffFactor(audio_level_rolloff);
}
}
// Scale down the contribution of weather-simulation wind to the
// ambient wind noise. Wind velocity averages 3.5 m/s, with gusts to 7 m/s
// whereas steady-state avatar walk velocity is only 3.2 m/s.
@@ -289,8 +270,7 @@ void audio_update_wind(bool force_update)
gAudiop->mMaxWindGain = llmax(gAudiop->mMaxWindGain - volume_delta, 0.f);
}
last_camera_water_height = camera_water_height;
gAudiop->updateWind(gRelativeWindVec, camera_water_height);
gAudiop->updateWind(gRelativeWindVec, gAgentCamera.getCameraPositionAgent()[VZ] - gAgent.getRegion()->getWaterHeight());
}
#endif
}

View File

@@ -700,6 +700,7 @@ void settings_setup_listeners()
gSavedSettings.getControl("AudioLevelVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
gSavedSettings.getControl("AudioLevelUnderwaterRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
gSavedSettings.getControl("AudioStreamingMusic")->getSignal()->connect(boost::bind(&handleAudioStreamMusicChanged, _2));
gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));
gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2));

View File

@@ -9,8 +9,9 @@
<check_box bottom_delta="-20" control_name="ParcelMediaAutoPlayEnable" follows="top" height="16" initial_value="true" label="Automatically play media" left="162" name="auto_streaming_video"/>
<check_box bottom_delta="-20" control_name="MediaEnableFilter" follows="top" height="16" initial_value="true" label="Ask for permission (enables filtering)" name="streaming_video"/>
<check_box bottom_delta="-25" control_name="MuteWhenMinimized" follows="top" height="16" initial_value="true" label="Mute Audio When Window Minimized" left="142" name="mute_when_minimized"/>
<slider bottom_delta="-20" control_name="AudioLevelDoppler" edit_text="true" follows="top" height="15" increment="0.1" initial_val="1" label="Doppler Effect" label_width="69" left="148" max_val="2" min_val="0" name="Doppler Effect" show_text="true" width="219" />
<slider bottom_delta="-20" control_name="AudioLevelRolloff" edit_text="true" follows="top" height="15" increment="0.1" initial_val="1" label="Rolloff Factor" label_width="69" max_val="2" min_val="0" name="Rolloff Factor" width="219"/>
<spinner bottom_delta="-20" control_name="UISndMoneyChangeThreshold" decimal_digits="0" follows="top" height="16" increment="10" initial_val="10" label="[CURRENCY] change threshold:" label_width="128" max_val="10000" min_val="0" name="currency_change_threshold" width="192"/>
<slider bottom_delta="-20" control_name="AudioLevelDoppler" edit_text="true" follows="top" height="15" increment="0.1" initial_val="1" label="Doppler Effect" label_width="130" left="148" max_val="2" min_val="0" name="Doppler Effect" show_text="true" width="300" />
<slider bottom_delta="-20" control_name="AudioLevelRolloff" edit_text="true" follows="top" height="15" increment="0.1" initial_val="1" label="Rolloff Factor (Default)" label_width="130" max_val="2" min_val="0" name="Rolloff Factor" width="300"/>
<slider bottom_delta="-20" control_name="AudioLevelUnderwaterRolloff" edit_text="true" follows="top" height="15" increment="0.1" initial_val="3" label="Rolloff Factor (Underwater)" label_width="130" max_val="8" min_val="0" name="Underwater Rolloff Factor" width="300"/>
<spinner bottom_delta="-20" control_name="UISndMoneyChangeThreshold" decimal_digits="0" follows="top" height="16" increment="10" initial_val="10" label="[CURRENCY] change threshold:" label_width="128" max_val="10000" min_val="0" name="currency_change_threshold" width="192"/>
<spinner bottom_delta="-20" control_name="UISndHealthReductionThreshold" decimal_digits="0" follows="top" height="16" increment="10" initial_val="20" label="Health Change Threshold" label_width="128" max_val="10000" min_val="0" name="Health Change Threshold" width="192" />
</panel>

View File

@@ -39,27 +39,28 @@
<check_box bottom="-96" control_name="RenderCustomSettings" label="Custom" left="395" initial_value="true" name="CustomSettings"/>
<!--view_border bevel_style="none" bottom="-395" height="280" left="5" name="GraphicsBorder" width="485"/-->
<text bottom="-130" height="12" left="10" name="ShadersText">Shaders:</text>
<check_box bottom_delta="-23" control_name="RenderObjectBump" height="16" initial_value="true" label="Bump mapping and shiny" left="10" name="BumpShiny"/>
<check_box bottom_delta="-23" control_name="RenderTransparentWater" height="16" initial_value="true" label="Transparent water" left="10" name="TransparentWater"/>
<check_box bottom_delta="-17" control_name="RenderObjectBump" height="16" initial_value="true" label="Bump mapping and shiny" left="10" name="BumpShiny"/>
<check_box bottom_delta="-17" control_name="RenderLocalLights" height="16" label="Local Lights" name="LightingDetailRadio"/>
<check_box bottom_delta="-17" control_name="VertexShaderEnable" height="16" initial_value="true" label="Basic shaders" left_delta="0" name="BasicShaders" tool_tip="Disabling this option may prevent some graphics card drivers from crashing."/>
<check_box bottom_delta="-17" control_name="WindLightUseAtmosShaders" initial_value="true" label="Atmospheric shaders" left_delta="0" name="WindLightUseAtmosShaders"/>
<check_box bottom_delta="-17" control_name="RenderDeferred" initial_value="true" label="Lighting and Shadows" tool_tip="Deferred Shading" left_delta="0" name="RenderDeferred"/>
<check_box bottom_delta="-17" control_name="RenderDeferredSSAO" height="16" initial_value="true" label="Ambient Occlusion" left_delta="0" name="UseSSAO"/>
<check_box bottom_delta="-17" control_name="RenderDepthOfField" initial_value="true" label="Depth of Field" left_delta="0" name="RenderDepthOfField"/>
<text bottom_delta="-20" height="12" left="15" name="TerrainScaleText">Terrain Scale:</text>
<text bottom_delta="-17" height="12" left="15" name="TerrainScaleText">Terrain Scale:</text>
<combo_box bottom_delta="-22" control_name="RenderTerrainScale" label="Terrain Scale" left_delta="-2" name="TerrainScaleCombo" width="160" height="16">
<combo_item name="Low" value="12">Low</combo_item>
<combo_item name="Medium" value="9">Medium</combo_item>
<combo_item name="High" value="7">High</combo_item>
<combo_item name="Ultra" value="5">Ultra</combo_item>
</combo_box>
<text bottom_delta="-20" height="12" left="15" name="ShadowDetailText">Shadows:</text>
<text bottom_delta="-17" height="12" left="15" name="ShadowDetailText">Shadows:</text>
<combo_box bottom_delta="-22" control_name="RenderShadowDetail" label="Shadow Detail" left_delta="-2" name="ShadowDetailCombo" width="160" height="16">
<combo_item name="0" value="0">Disabled</combo_item>
<combo_item name="1" value="1">Sun/Moon</combo_item>
<combo_item name="2" value="2">Sun/Moon + Projectors</combo_item>
</combo_box>
<text bottom_delta="-20" height="12" left="15" name="ReflectionDetailText">Water Reflections:</text>
<text bottom_delta="-17" height="12" left="15" name="ReflectionDetailText">Water Reflections:</text>
<combo_box bottom_delta="-22" control_name="RenderReflectionDetail" label="Reflection Detail" left_delta="-2" name="ReflectionDetailCombo" width="160" height="16">
<combo_item name="0" value="0">Minimal</combo_item>
<combo_item name="1" value="1">Terrain and trees</combo_item>
@@ -68,7 +69,7 @@
<combo_item name="4" value="4">Everything</combo_item>
</combo_box>
<slider bottom_delta="-24" left="5" control_name="RenderAvatarPhysicsLODFactor" increment="0.1" label=" Avatar Physics:" label_width="79" max_val="1" min_val="0" name="AvatarPhysicsDetail" show_text="false" width="160"/>
<slider bottom_delta="-20" left="5" control_name="RenderAvatarPhysicsLODFactor" increment="0.1" label=" Avatar Physics:" label_width="79" max_val="1" min_val="0" name="AvatarPhysicsDetail" show_text="false" width="160"/>
<text bottom_delta="-2" left="170" height="12" name="AvatarPhysicsDetailText">Off</text>
<!--text bottom="-131" height="12" left="464" name="DrawDistanceMeterText1">m</text-->
<text bottom="-131" height="12" left="470" name="DrawDistanceMeterText2">m</text>