From 44df5c35678ae050ab072e64c09ccbe142077898 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 19 Dec 2007 14:14:26 -0800 Subject: MacOSX doesn't like global szDebug and g_mutex symbol names --- Alc/ALc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Alc') diff --git a/Alc/ALc.c b/Alc/ALc.c index a721f0de..b4ec8e9f 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -33,7 +33,7 @@ /////////////////////////////////////////////////////// // DEBUG INFORMATION -char szDebug[256]; +char _alDebug[256]; /////////////////////////////////////////////////////// @@ -193,7 +193,7 @@ static void InitAL(void) int i; const char *devs; - InitializeCriticalSection(&g_mutex); + InitializeCriticalSection(&_alMutex); ALTHUNK_INIT(); ReadALConfig(); @@ -303,7 +303,7 @@ ALCvoid SetALCError(ALenum errorCode) ALCvoid SuspendContext(ALCcontext *pContext) { (void)pContext; - EnterCriticalSection(&g_mutex); + EnterCriticalSection(&_alMutex); } @@ -315,7 +315,7 @@ ALCvoid SuspendContext(ALCcontext *pContext) ALCvoid ProcessContext(ALCcontext *pContext) { (void)pContext; - LeaveCriticalSection(&g_mutex); + LeaveCriticalSection(&_alMutex); } -- cgit v1.2.3 From 5b0514a829afcdca201096f8f1c38ab684d45b49 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 20 Dec 2007 21:40:22 -0800 Subject: Do the channel pannings based on output channel count This should make it a bit easier to extend in the future --- Alc/ALu.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'Alc') diff --git a/Alc/ALu.c b/Alc/ALu.c index 0821d6b4..87764592 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -319,20 +319,8 @@ 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. Convert pannings into channel volumes + //6. Convert normalized position into pannings, then into channel volumes + aluNormalize(Position); switch(OutputFormat) { case AL_FORMAT_MONO8: @@ -344,6 +332,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 @@ -351,6 +340,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 -- cgit v1.2.3