From ba3e89b5c731ed6dc36d4650928be8081b3289f5 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 18 Jan 2013 16:43:19 -0800 Subject: first push - patch from CmdCupCake plus force FMODEX on --- indra/newview/CMakeLists.txt | 57 +++++++++++++++++++++------ indra/newview/app_settings/settings.xml | 44 +++++++++++++++++++++ indra/newview/linux_tools/wrapper.sh | 12 ++++-- indra/newview/llstartup.cpp | 15 +++++++ indra/newview/llvieweraudio.cpp | 70 +++++++++++++++------------------ indra/newview/llviewercontrol.cpp | 1 + indra/newview/viewer_manifest.py | 18 +++++++++ 7 files changed, 162 insertions(+), 55 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b569808a06..793b01baa1 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -10,7 +10,8 @@ include(DirectX) include(OpenSSL) include(DragDrop) include(EXPAT) -include(FMOD) +include(FMODEX) +set(FMOD OFF) include(OPENAL) include(FindOpenGL) include(Hunspell) @@ -52,6 +53,14 @@ if (NOT HAVOK_TPV) add_subdirectory(${LLPHYSICSEXTENSIONS_SRC_DIR} llphysicsextensions) endif (NOT HAVOK_TPV) +if(FMODEX) + include_directories(${FMODEX_INCLUDE_DIR}) +endif(FMODEX) + +if(FMOD) + include_directories(${FMOD_INCLUDE_DIR}) +endif(FMOD) + include_directories( ${DBUSGLIB_INCLUDE_DIRS} ${JSONCPP_INCLUDE_DIR} @@ -61,7 +70,6 @@ include_directories( ${LLCOMMON_INCLUDE_DIRS} ${LLCOREHTTP_INCLUDE_DIRS} ${LLPHYSICS_INCLUDE_DIRS} - ${FMOD_INCLUDE_DIR} ${LLIMAGE_INCLUDE_DIRS} ${LLKDU_INCLUDE_DIRS} ${LLINVENTORY_INCLUDE_DIRS} @@ -1521,10 +1529,15 @@ if (OPENAL) set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_OPENAL") endif (OPENAL) -if (FMOD) - set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMOD") +if (FMOD OR FMODEX) + if (FMODEX) + set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODEX") + endif (FMODEX) + if (FMOD) + set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMOD") + endif (FMOD) - if (DARWIN) + if (DARWIN AND FMOD) set(fmodwrapper_SOURCE_FILES fmodwrapper.cpp) add_library(fmodwrapper SHARED ${fmodwrapper_SOURCE_FILES}) set(fmodwrapper_needed_LIBRARIES ${FMOD_LIBRARY} ${CARBON_LIBRARY}) @@ -1537,11 +1550,16 @@ if (FMOD) ) set(FMODWRAPPER_LIBRARY fmodwrapper) target_link_libraries(fmodwrapper ${fmodwrapper_needed_LIBRARIES}) - else (DARWIN) - # fmodwrapper unnecessary on linux or windows - set(FMODWRAPPER_LIBRARY ${FMOD_LIBRARY}) - endif (DARWIN) -endif (FMOD) + else (DARWIN AND FMOD) + # fmodwrapper unnecessary on linux or windows for fmod and darwin for fmodex + if (FMODEX) + set(FMODWRAPPER_LIBRARY ${FMODEX_LIBRARY}) + endif (FMODEX) + if (FMOD) + set(FMODWRAPPER_LIBRARY ${FMOD_LIBRARY}) + endif (FMOD) + endif (DARWIN AND FMOD) +endif (FMOD OR FMODEX) set_source_files_properties(llstartup.cpp PROPERTIES COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS}") @@ -1616,9 +1634,6 @@ if (WINDOWS) ${SHARED_LIB_STAGING_DIR}/Release/openjpeg.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjpeg.dll ${SHARED_LIB_STAGING_DIR}/Debug/openjpegd.dll - ${SHARED_LIB_STAGING_DIR}/Release/fmod.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/fmod.dll - ${SHARED_LIB_STAGING_DIR}/Debug/fmod.dll ${SHARED_LIB_STAGING_DIR}/Release/msvcr100.dll ${SHARED_LIB_STAGING_DIR}/Release/msvcp100.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/msvcr100.dll @@ -1683,6 +1698,22 @@ if (WINDOWS) windows-updater ) + if (FMODEX) + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/fmodex.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/fmodex.dll + ${SHARED_LIB_STAGING_DIR}/Debug/fmodexL.dll + ) + endif (FMODEX) + + if (FMOD) + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/fmod.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/fmod.dll + ${SHARED_LIB_STAGING_DIR}/Debug/fmod.dll + ) + endif (FMOD) + add_custom_command( OUTPUT ${CMAKE_CFG_INTDIR}/copy_touched.bat COMMAND ${PYTHON_EXECUTABLE} diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2e91d10cd3..995546ab23 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -269,6 +269,17 @@ Value 1.0 + AudioLevelUnderwaterRolloff + + Comment + Controls the distance-based dropoff of audio volume underwater(fraction or multiple of default audio rolloff) + Persist + 1 + Type + F32 + Value + 5.0 + AudioLevelSFX Comment @@ -14094,5 +14105,38 @@ Value 0 + FMODExProfilerEnable + + Comment + Enable profiler tool if using FMOD Ex + Persist + 1 + Type + Boolean + Value + 0 + + FMODExDecodeBufferSize + + Comment + Sets the streaming decode buffer size (in milliseconds) + Persist + 1 + Type + U32 + Value + 1000 + + FMODExStreamBufferSize + + Comment + Sets the streaming buffer size (in milliseconds) + Persist + 1 + Type + U32 + Value + 7000 + diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 20936c6460..71b7e74c63 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -4,17 +4,21 @@ ## These options are for self-assisted troubleshooting during this beta ## testing phase; you should not usually need to touch them. +## - Avoids using any FMOD Ex audio driver. +#export LL_BAD_FMODEX_DRIVER=x ## - Avoids using any OpenAL audio driver. #export LL_BAD_OPENAL_DRIVER=x ## - Avoids using any FMOD audio driver. #export LL_BAD_FMOD_DRIVER=x +## - Avoids using the FMOD Ex PulseAudio audio driver. +#export LL_BAD_FMOD_PULSEAUDIO=x +## - Avoids using the FMOD or FMOD Ex ALSA audio driver. +#export LL_BAD_FMOD_ALSA=x +## - Avoids using the FMOD or FMOD Ex OSS audio driver. +#export LL_BAD_FMOD_OSS=x ## - Avoids using the FMOD ESD audio driver. #export LL_BAD_FMOD_ESD=x -## - Avoids using the FMOD OSS audio driver. -#export LL_BAD_FMOD_OSS=x -## - Avoids using the FMOD ALSA audio driver. -#export LL_BAD_FMOD_ALSA=x ## - Avoids the optional OpenGL extensions which have proven most problematic ## on some hardware. Disabling this option may cause BETTER PERFORMANCE but diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 0e3007724b..6a874d1af5 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -37,6 +37,10 @@ #include "llviewermedia_streamingaudio.h" #include "llaudioengine.h" +#ifdef LL_FMODEX +# include "llaudioengine_fmodex.h" +#endif + #ifdef LL_FMOD # include "llaudioengine_fmod.h" #endif @@ -623,6 +627,17 @@ bool idle_startup() { gAudiop = NULL; +#ifdef LL_FMODEX + if (!gAudiop +#if !LL_WINDOWS + && NULL == getenv("LL_BAD_FMODEX_DRIVER") +#endif // !LL_WINDOWS + ) + { + gAudiop = (LLAudioEngine *) new LLAudioEngine_FMODEX(gSavedSettings.getBOOL("FMODExProfilerEnable")); + } +#endif + #ifdef LL_OPENAL if (!gAudiop #if !LL_WINDOWS diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 8d8c401dac..f349eeac63 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -43,6 +43,8 @@ #include "llparcel.h" #include "llviewermessage.h" +#include "llstreamingaudio.h" + ///////////////////////////////////////////////////////// LLViewerAudio::LLViewerAudio() : @@ -101,6 +103,11 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) else { mFadeState = FADE_IN; + + LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl(); + if(stream && stream->supportsAdjustableBufferSizes()) + stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize")); + gAudiop->startInternetStream(mNextStreamURI); startFading(); registerIdleListener(); @@ -156,6 +163,11 @@ bool LLViewerAudio::onIdleUpdate() if (!mNextStreamURI.empty()) { mFadeState = FADE_IN; + + LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl(); + if(stream && stream->supportsAdjustableBufferSizes()) + stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize")); + gAudiop->startInternetStream(mNextStreamURI); startFading(); } @@ -385,7 +397,12 @@ void audio_update_volume(bool force_update) gAudiop->setMasterGain ( master_volume ); gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler")); - gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); + + if(!LLViewerCamera::getInstance()->cameraUnderWater()) + gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); + else + gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelUnderwaterRolloff")); + gAudiop->setMuted(mute_audio || progress_view_visible); if (force_update) @@ -466,44 +483,22 @@ 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) { - 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 LLUICachedControl rolloff("AudioLevelRolloff", 1.0f); - if (camera_water_height < 0.f) - { - gAudiop->setRolloffFactor(rolloff * LL_ROLLOFF_MULTIPLIER_UNDER_WATER); - } - else - { - gAudiop->setRolloffFactor(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. - // Without this the world feels desolate on first login when you are - // standing still. - static LLUICachedControl wind_level("AudioLevelWind", 0.5f); - LLVector3 scaled_wind_vec = gWindVec * wind_level; - - // Mix in the avatar's motion, subtract because when you walk north, - // the apparent wind moves south. - LLVector3 final_wind_vec = scaled_wind_vec - gAgent.getVelocity(); - + // 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. + // Without this the world feels desolate on first login when you are + // standing still. + static LLUICachedControl wind_level("AudioLevelWind", 0.5f); + LLVector3 scaled_wind_vec = gWindVec * wind_level; + + // Mix in the avatar's motion, subtract because when you walk north, + // the apparent wind moves south. + LLVector3 final_wind_vec = scaled_wind_vec - gAgent.getVelocity(); + // rotate the wind vector to be listener (agent) relative gRelativeWindVec = gAgent.getFrameAgent().rotateToLocal( final_wind_vec ); @@ -536,8 +531,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 } diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 051f5f4485..a62f73deef 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -655,6 +655,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("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index ea75d4f4f6..cdd227e9fe 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -367,6 +367,14 @@ class WindowsManifest(ViewerManifest): print err.message print "Skipping COLLADA and GLOD libraries (assumming linked statically)" + # Get fmodex dll, continue if missing + try: + if self.args['configuration'].lower() == 'debug': + self.path("fmodexL.dll") + else: + self.path("fmodex.dll") + except: + print "Skipping fmodex audio library(assuming other audio engine)" # Get fmod dll, continue if missing if not self.path("fmod.dll"): @@ -743,6 +751,7 @@ class DarwinManifest(ViewerManifest): "libcollada14dom.dylib", "libexpat.1.5.2.dylib", "libexception_handler.dylib", + "libfmodex.dylib", "libGLOD.dylib", ): dylibs += path_optional(os.path.join(libdir, libfile), libfile) @@ -1125,6 +1134,15 @@ class Linux_i686Manifest(LinuxManifest): except: print "Skipping libfmod-3.75.so - not found" pass + + try: + self.path("libfmodex-*.so") + self.path("libfmodex.so") + pass + except: + print "Skipping libfmodex.so - not found" + pass + self.end_prefix("lib") # Vivox runtimes -- cgit v1.2.3