summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2014-03-24 14:15:56 -0400
committerOz Linden <oz@lindenlab.com>2014-03-24 14:15:56 -0400
commit6db0a2a7ea60df31f4d5deb84f2135bf2ea9f955 (patch)
treeba67138361e3af388174bfca2bf0cb5982bf47db /indra
parentcb2bd577099f87881d467249cac679200bb367f0 (diff)
parent0bc8e67ebb969888364395b8ceea02393d14e9f5 (diff)
merge changes for DRTVWR-360
Diffstat (limited to 'indra')
-rwxr-xr-xindra/cmake/Copy3rdPartyLibs.cmake4
-rw-r--r--indra/cmake/FMODEX.cmake2
-rw-r--r--indra/llaudio/llaudioengine_fmodex.cpp25
-rw-r--r--indra/llaudio/llaudioengine_fmodex.h4
-rwxr-xr-xindra/media_plugins/winmmshim/winmm_shim.cpp81
-rwxr-xr-xindra/newview/viewer_manifest.py17
6 files changed, 87 insertions, 46 deletions
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
index 44c2d3ac27..f98e88b697 100755
--- a/indra/cmake/Copy3rdPartyLibs.cmake
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -64,6 +64,7 @@ if(WINDOWS)
endif(USE_TCMALLOC)
if (FMODEX)
+ set(debug_files ${debug_files} fmodexL.dll)
set(release_files ${release_files} fmodex.dll)
endif (FMODEX)
@@ -294,7 +295,8 @@ elseif(LINUX)
endif (USE_TCMALLOC)
if (FMODEX)
- set(release_file ${release_files} "libfmodex.so")
+ set(debug_files ${debug_files} "libfmodexL.so")
+ set(release_files ${release_files} "libfmodex.so")
endif (FMODEX)
else(WINDOWS)
diff --git a/indra/cmake/FMODEX.cmake b/indra/cmake/FMODEX.cmake
index 65bc1cabeb..163260137b 100644
--- a/indra/cmake/FMODEX.cmake
+++ b/indra/cmake/FMODEX.cmake
@@ -39,7 +39,7 @@ if (FMODEX)
optimized fmodex)
endif (WINDOWS)
set(FMODEX_LIBRARIES ${FMODEX_LIBRARY})
- set(FMODEX_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodex)
+ set(FMODEX_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/)
endif (FMODEX_LIBRARY AND FMODEX_INCLUDE_DIR)
endif (STANDALONE)
endif (FMODEX)
diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp
index e9b74b8f41..36e8044a25 100644
--- a/indra/llaudio/llaudioengine_fmodex.cpp
+++ b/indra/llaudio/llaudioengine_fmodex.cpp
@@ -5,7 +5,7 @@
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2014, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -55,11 +55,13 @@ LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler)
mWindDSP = NULL;
mSystem = NULL;
mEnableProfiler = enable_profiler;
+ mWindDSPDesc = new FMOD_DSP_DESCRIPTION();
}
LLAudioEngine_FMODEX::~LLAudioEngine_FMODEX()
{
+ delete mWindDSPDesc;
}
@@ -320,8 +322,8 @@ void LLAudioEngine_FMODEX::shutdown()
llinfos << "LLAudioEngine_FMODEX::shutdown() closing FMOD Ex" << llendl;
if ( mSystem ) // speculative fix for MAINT-2657
{
- mSystem->close();
- mSystem->release();
+ mSystem->close();
+ mSystem->release();
}
llinfos << "LLAudioEngine_FMODEX::shutdown() done closing FMOD Ex" << llendl;
@@ -347,15 +349,14 @@ bool LLAudioEngine_FMODEX::initWind()
if (!mWindDSP)
{
- FMOD_DSP_DESCRIPTION dspdesc;
- memset(&dspdesc, 0, sizeof(FMOD_DSP_DESCRIPTION)); //Set everything to zero
- strncpy(dspdesc.name,"Wind Unit", sizeof(dspdesc.name)); //Set name to "Wind Unit"
- dspdesc.channels=2;
- dspdesc.read = &windCallback; //Assign callback.
- if(Check_FMOD_Error(mSystem->createDSP(&dspdesc, &mWindDSP), "FMOD::createDSP"))
+ memset(mWindDSPDesc, 0, sizeof(*mWindDSPDesc)); //Set everything to zero
+ strncpy(mWindDSPDesc->name, "Wind Unit", sizeof(mWindDSPDesc->name));
+ mWindDSPDesc->channels = 2;
+ mWindDSPDesc->read = &windCallback; // Assign callback - may be called from arbitrary threads
+ if (Check_FMOD_Error(mSystem->createDSP(mWindDSPDesc, &mWindDSP), "FMOD::createDSP"))
return false;
- if(mWindGen)
+ if (mWindGen)
delete mWindGen;
float frequency = 44100;
@@ -364,6 +365,7 @@ bool LLAudioEngine_FMODEX::initWind()
mWindDSP->setUserData((void*)mWindGen);
}
+ // *TODO: Should this guard against multiple plays?
if (mWindDSP)
{
mSystem->playDSP(FMOD_CHANNEL_FREE, mWindDSP, false, 0);
@@ -741,6 +743,9 @@ void LLAudioChannelFMODEX::set3DMode(bool use3d)
}
}
+// *NOTE: This is almost certainly being called on the mixer thread,
+// not the main thread. May have implications for callees or audio
+// engine shutdown.
FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *originalbuffer, float *newbuffer, unsigned int length, int inchannels, int outchannels)
{
diff --git a/indra/llaudio/llaudioengine_fmodex.h b/indra/llaudio/llaudioengine_fmodex.h
index 415a9ed0ef..ca389d489f 100644
--- a/indra/llaudio/llaudioengine_fmodex.h
+++ b/indra/llaudio/llaudioengine_fmodex.h
@@ -5,7 +5,7 @@
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2014, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -41,6 +41,7 @@ namespace FMOD
class Sound;
class DSP;
}
+typedef struct FMOD_DSP_DESCRIPTION FMOD_DSP_DESCRIPTION;
//Interfaces
class LLAudioEngine_FMODEX : public LLAudioEngine
@@ -74,6 +75,7 @@ protected:
LLWindGen<MIXBUFFERFORMAT> *mWindGen;
+ FMOD_DSP_DESCRIPTION *mWindDSPDesc;
FMOD::DSP *mWindDSP;
FMOD::System *mSystem;
bool mEnableProfiler;
diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp
index aac349bf57..49a1c9dba3 100755
--- a/indra/media_plugins/winmmshim/winmm_shim.cpp
+++ b/indra/media_plugins/winmmshim/winmm_shim.cpp
@@ -4,7 +4,7 @@
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2010-2014, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,8 +30,8 @@
using std::wstring;
-static float sVolumeLevel = 1.f;
-static bool sMute = false;
+static float sVolumeLevel = 1.f; // Could be covered by critical section,
+static bool sMute = false; // not needed with atomicity and alignment.
static CRITICAL_SECTION sCriticalSection;
BOOL APIENTRY DllMain( HMODULE hModule,
@@ -39,37 +39,44 @@ BOOL APIENTRY DllMain( HMODULE hModule,
LPVOID lpReserved
)
{
- InitializeCriticalSection(&sCriticalSection);
+ if (DLL_PROCESS_ATTACH == ul_reason_for_call)
+ {
+ InitializeCriticalSection(&sCriticalSection);
+ }
return TRUE;
}
void ll_winmm_shim_initialize(){
- static bool initialized = false;
- // do this only once
- EnterCriticalSection(&sCriticalSection);
+ static volatile bool initialized = false;
+
+ // do this only once using double-check locking
if (!initialized)
- { // bind to original winmm.dll
- TCHAR system_path[MAX_PATH];
- TCHAR dll_path[MAX_PATH];
- ::GetSystemDirectory(system_path, MAX_PATH);
-
- // grab winmm.dll from system path, where it should live
- wsprintf(dll_path, "%s\\winmm.dll", system_path);
- HMODULE winmm_handle = ::LoadLibrary(dll_path);
-
- if (winmm_handle != NULL)
- { // we have a dll, let's get out pointers!
- initialized = true;
- init_function_pointers(winmm_handle);
- ::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n");
- }
- else
- {
- // failed to initialize real winmm.dll
- ::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n");
+ {
+ EnterCriticalSection(&sCriticalSection);
+ if (!initialized)
+ { // bind to original winmm.dll
+ TCHAR system_path[MAX_PATH];
+ TCHAR dll_path[MAX_PATH];
+ ::GetSystemDirectory(system_path, MAX_PATH);
+
+ // grab winmm.dll from system path, where it should live
+ wsprintf(dll_path, "%s\\winmm.dll", system_path);
+ HMODULE winmm_handle = ::LoadLibrary(dll_path);
+
+ if (winmm_handle != NULL)
+ { // we have a dll, let's get out pointers!
+ init_function_pointers(winmm_handle);
+ ::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n");
+ initialized = true; // Last thing after completing setup
+ }
+ else
+ {
+ // failed to initialize real winmm.dll
+ ::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n");
+ }
}
+ LeaveCriticalSection(&sCriticalSection);
}
- LeaveCriticalSection(&sCriticalSection);
}
@@ -84,7 +91,7 @@ extern "C"
int mBitsPerSample;
};
typedef std::map<HWAVEOUT, WaveOutFormat*> wave_out_map_t;
- static wave_out_map_t sWaveOuts;
+ static wave_out_map_t sWaveOuts; // Covered by sCriticalSection
MMRESULT WINAPI waveOutOpen( LPHWAVEOUT phwo, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
{
@@ -100,7 +107,9 @@ extern "C"
&& ((fdwOpen & WAVE_FORMAT_QUERY) == 0)) // not just querying for format support
{ // remember the requested bits per sample, and associate with the given handle
WaveOutFormat* wave_outp = new WaveOutFormat(pwfx->wBitsPerSample);
+ EnterCriticalSection(&sCriticalSection);
sWaveOuts.insert(std::make_pair(*phwo, wave_outp));
+ LeaveCriticalSection(&sCriticalSection);
}
return result;
}
@@ -108,13 +117,15 @@ extern "C"
MMRESULT WINAPI waveOutClose( HWAVEOUT hwo)
{
ll_winmm_shim_initialize();
+ EnterCriticalSection(&sCriticalSection);
wave_out_map_t::iterator found_it = sWaveOuts.find(hwo);
if (found_it != sWaveOuts.end())
{ // forget what we know about this handle
delete found_it->second;
sWaveOuts.erase(found_it);
}
- return waveOutClose_orig( hwo);
+ LeaveCriticalSection(&sCriticalSection);
+ return waveOutClose_orig(hwo);
}
MMRESULT WINAPI waveOutWrite( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh)
@@ -128,11 +139,19 @@ extern "C"
}
else if (sVolumeLevel != 1.f)
{ // need to apply volume level
+ int bits_per_sample(0);
+
+ EnterCriticalSection(&sCriticalSection);
wave_out_map_t::iterator found_it = sWaveOuts.find(hwo);
if (found_it != sWaveOuts.end())
{
- WaveOutFormat* formatp = found_it->second;
- switch (formatp->mBitsPerSample){
+ bits_per_sample = found_it->second->mBitsPerSample;
+ }
+ LeaveCriticalSection(&sCriticalSection);
+ if (bits_per_sample)
+ {
+ switch (bits_per_sample)
+ {
case 8:
{
char volume = (char)(sVolumeLevel * 127.f);
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index fe0774b409..f7b3a45e8d 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -7,7 +7,7 @@
$LicenseInfo:firstyear=2006&license=viewerlgpl$
Second Life Viewer Source Code
-Copyright (C) 2006-2011, Linden Research, Inc.
+Copyright (C) 2006-2014, Linden Research, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -749,7 +749,6 @@ class Darwin_i386_Manifest(ViewerManifest):
"libcollada14dom.dylib",
"libexpat.1.5.2.dylib",
"libexception_handler.dylib",
- "libfmodex.dylib",
"libGLOD.dylib",
):
dylibs += path_optional(os.path.join(libdir, libfile), libfile)
@@ -765,6 +764,20 @@ class Darwin_i386_Manifest(ViewerManifest):
'SLVoice',
):
self.path2basename(libdir, libfile)
+
+ # dylibs that vary based on configuration
+ if self.args['configuration'].lower() == 'debug':
+ for libfile in (
+ "libfmodexL.dylib",
+ ):
+ dylibs += path_optional(os.path.join("../packages/lib/debug",
+ libfile), libfile)
+ else:
+ for libfile in (
+ "libfmodex.dylib",
+ ):
+ dylibs += path_optional(os.path.join("../packages/lib/release",
+ libfile), libfile)
# our apps
for app_bld_dir, app in (("mac_crash_logger", "mac-crash-logger.app"),