summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c7
-rw-r--r--Alc/ALu.c6
-rw-r--r--OpenAL32/Include/alMain.h1
3 files changed, 11 insertions, 3 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index df1a3ec2..f3096b73 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -393,6 +393,9 @@ static FILE *LogFile;
// Cone scalar
ALdouble ConeScale = 0.5;
+// Localized Z scalar for mono sources
+ALdouble ZScale = 1.0;
+
///////////////////////////////////////////////////////
@@ -466,6 +469,10 @@ static void alc_init(void)
if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1))
ConeScale = 1.0;
+ str = getenv("__ALSOFT_REVERSE_Z");
+ if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1))
+ ZScale = -1.0;
+
InitializeCriticalSection(&g_csMutex);
ALTHUNK_INIT();
ReadALConfig();
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 96fa8579..dc37bcfa 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -822,8 +822,8 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
{
const ALshort *hrtf_left, *hrtf_right;
- GetHrtfCoeffs(atan2(Position[1], -Position[2]) * (180.0/M_PI),
- atan2(Position[0], -Position[2]) * (180.0/M_PI),
+ GetHrtfCoeffs(atan2(Position[1], -Position[2]*ZScale) * (180.0/M_PI),
+ atan2(Position[0], -Position[2]*ZScale) * (180.0/M_PI),
&hrtf_left, &hrtf_right);
for(i = 0;i < HRTF_LENGTH;i++)
{
@@ -835,7 +835,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
else
{
- pos = aluCart2LUTpos(-Position[2], Position[0]);
+ pos = aluCart2LUTpos(-Position[2]*ZScale, Position[0]);
SpeakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
DirGain = aluSqrt(Position[0]*Position[0] + Position[2]*Position[2]);
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index c4aad342..ec51eb44 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -604,6 +604,7 @@ void al_print(const char *fname, unsigned int line, const char *fmt, ...)
#define AL_PRINT(...) al_print(__FILE__, __LINE__, __VA_ARGS__)
extern ALdouble ConeScale;
+extern ALdouble ZScale;
#ifdef __cplusplus
}