aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-20 21:48:17 -0800
committerChris Robinson <[email protected]>2007-12-20 21:48:17 -0800
commit229bc0d7e14f2671b420ea995101fc38523285d2 (patch)
tree0217bc2b4fc04ae0fb445b6bc456b52745396737
parent7bf9ebf5450840c20d2453fcf7fc1f1b37f979ec (diff)
parent5b0514a829afcdca201096f8f1c38ab684d45b49 (diff)
Merge branch 'master' into efx-experiment
-rw-r--r--Alc/ALc.c8
-rw-r--r--Alc/ALu.c28
-rw-r--r--CMakeLists.txt6
-rw-r--r--OpenAL32/Include/alMain.h10
-rw-r--r--OpenAL32/OpenAL32.c6
5 files changed, 30 insertions, 28 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index aba408f4..8c824a2d 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -34,7 +34,7 @@
///////////////////////////////////////////////////////
// DEBUG INFORMATION
-char szDebug[256];
+char _alDebug[256];
///////////////////////////////////////////////////////
@@ -206,7 +206,7 @@ static void InitAL(void)
int i;
const char *devs;
- InitializeCriticalSection(&g_mutex);
+ InitializeCriticalSection(&_alMutex);
ALTHUNK_INIT();
ReadALConfig();
@@ -316,7 +316,7 @@ ALCvoid SetALCError(ALenum errorCode)
ALCvoid SuspendContext(ALCcontext *pContext)
{
(void)pContext;
- EnterCriticalSection(&g_mutex);
+ EnterCriticalSection(&_alMutex);
}
@@ -328,7 +328,7 @@ ALCvoid SuspendContext(ALCcontext *pContext)
ALCvoid ProcessContext(ALCcontext *pContext)
{
(void)pContext;
- LeaveCriticalSection(&g_mutex);
+ LeaveCriticalSection(&_alMutex);
}
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 30cd727f..2ae19ed3 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -378,20 +378,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
Matrix[2][0] = U[2]; Matrix[2][1] = V[2]; Matrix[2][2] = -N[2];
aluMatrixVector(Position, Matrix);
- //6. Convert normalized position into left/right front/back pannings
- if(Distance != 0.0f)
- {
- aluNormalize(Position);
- PanningLR = 0.5f + 0.5f*Position[0];
- PanningFB = 0.5f + 0.5f*Position[2];
- }
- else
- {
- PanningLR = 0.5f;
- PanningFB = 0.5f;
- }
-
- //7. Apply filter gains and filters
+ //6. Apply filter gains and filters
switch(ALSource->DirectFilter.filter)
{
case AL_FILTER_LOWPASS:
@@ -415,8 +402,11 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
*drygainhf = DryGainHF;
*wetgainhf = WetGainHF;
- //8. Convert pannings into channel volumes
+ //7. Convert pannings into channel volumes
WetMix *= ALSource->Send[0].Slot.Gain;
+
+ //8. Convert normalized position into pannings, then into channel volumes
+ aluNormalize(Position);
switch(OutputFormat)
{
case AL_FORMAT_MONO8:
@@ -428,6 +418,7 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
break;
case AL_FORMAT_STEREO8:
case AL_FORMAT_STEREO16:
+ PanningLR = 0.5f + 0.5f*Position[0];
drysend[0] = ConeVolume * ListenerGain * DryMix * aluSqrt(1.0f-PanningLR); //L Direct
drysend[1] = ConeVolume * ListenerGain * DryMix * aluSqrt( PanningLR); //R Direct
wetsend[0] = ListenerGain * WetMix * aluSqrt(1.0f-PanningLR); //L Room
@@ -435,6 +426,13 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
break;
case AL_FORMAT_QUAD8:
case AL_FORMAT_QUAD16:
+ // Apply a scalar so each individual speaker has more weight
+ PanningLR = 0.5f + (0.5f*Position[0]*1.41421356f);
+ PanningLR = __min(1.0f, PanningLR);
+ PanningLR = __max(0.0f, PanningLR);
+ PanningFB = 0.5f + (0.5f*Position[2]*1.41421356f);
+ PanningFB = __min(1.0f, PanningFB);
+ PanningFB = __max(0.0f, PanningFB);
drysend[0] = ConeVolume * ListenerGain * DryMix * aluSqrt((1.0f-PanningLR)*(1.0f-PanningFB)); //FL Direct
drysend[1] = ConeVolume * ListenerGain * DryMix * aluSqrt(( PanningLR)*(1.0f-PanningFB)); //FR Direct
drysend[2] = ConeVolume * ListenerGain * DryMix * aluSqrt((1.0f-PanningLR)*( PanningFB)); //BL Direct
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d480a0ac..df42e1f9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,8 +35,10 @@ SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_BUILD_VERSION}"
IF("${WIN32}")
SET(LIBNAME openal32)
+ SET(TARGET_OPTS "PREFIX \"\"")
ELSE()
SET(LIBNAME openal)
+ SET(TARGET_OPTS "")
ENDIF()
@@ -259,7 +261,9 @@ ADD_DEFINITIONS(-DAL_BUILD_LIBRARY)
# Build a shared library
ADD_LIBRARY(${LIBNAME} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
-SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION} SOVERSION ${LIB_MAJOR_VERSION})
+SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION}
+ SOVERSION ${LIB_MAJOR_VERSION}
+ ${TARGET_OPTS})
TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS})
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 5a221065..168991b7 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -72,18 +72,18 @@ extern "C"
{
#endif
-extern CRITICAL_SECTION g_mutex;
+extern CRITICAL_SECTION _alMutex;
-extern char szDebug[256];
+extern char _alDebug[256];
#define AL_PRINT(...) do { \
int _al_print_i; \
char *_al_print_fn = strrchr(__FILE__, '/'); \
if(!_al_print_fn) _al_print_fn = __FILE__; \
else _al_print_fn += 1; \
- _al_print_i = snprintf(szDebug, sizeof(szDebug), "AL lib: %s:%d: ", _al_print_fn, __LINE__); \
- snprintf(szDebug+_al_print_i, sizeof(szDebug)-_al_print_i, __VA_ARGS__); \
- fprintf(stderr, "%s", szDebug); \
+ _al_print_i = snprintf(_alDebug, sizeof(_alDebug), "AL lib: %s:%d: ", _al_print_fn, __LINE__); \
+ snprintf(_alDebug+_al_print_i, sizeof(_alDebug)-_al_print_i, __VA_ARGS__); \
+ fprintf(stderr, "%s", _alDebug); \
} while(0)
diff --git a/OpenAL32/OpenAL32.c b/OpenAL32/OpenAL32.c
index f79ddc0c..8510c7cb 100644
--- a/OpenAL32/OpenAL32.c
+++ b/OpenAL32/OpenAL32.c
@@ -25,7 +25,7 @@
#include "alAuxEffectSlot.h"
#include "alThunk.h"
-CRITICAL_SECTION g_mutex;
+CRITICAL_SECTION _alMutex;
#ifdef _WIN32
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
@@ -43,7 +43,7 @@ BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
ReleaseALBuffers();
FreeALConfig();
ALTHUNK_EXIT();
- DeleteCriticalSection(&g_mutex);
+ DeleteCriticalSection(&_alMutex);
break;
}
return TRUE;
@@ -63,7 +63,7 @@ static void my_deinit()
ReleaseALFilters();
FreeALConfig();
ALTHUNK_EXIT();
- DeleteCriticalSection(&g_mutex);
+ DeleteCriticalSection(&_alMutex);
}
#endif
#endif