aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-04-22 23:17:27 -0700
committerChris Robinson <[email protected]>2011-04-22 23:17:27 -0700
commit10a9753183567ad36fbcc3228ded34c5beebdbd2 (patch)
tree6a0dd9a02680df631980ab6670a9aee15728a072 /Alc
parent1e8718fe8787be8c17403b3e19fbf23916ff7193 (diff)
Add a compatibility option to treat cone angles as half angles
All previous versions of the library treated the source cone angles as half angles, which is contrary to the spec. Setting the __ALSOFT_HALF_ANGLE_CONES environment variable to "true" or "1" restores the buggy behavior for compatibility with applications that expect it. This is not a config file option because new apps should not be made to depend on the old behavior.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c7
-rw-r--r--Alc/ALu.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 2dbe52f9..dc781835 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -384,6 +384,9 @@ static ALint RTPrioLevel;
// Output Log File
static FILE *LogFile;
+// Cone scalar
+ALdouble ConeScale = 0.5;
+
///////////////////////////////////////////////////////
@@ -435,6 +438,10 @@ static void alc_init(void)
if(!LogFile)
LogFile = stderr;
+ str = getenv("__ALSOFT_HALF_ANGLE_CONES");
+ if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1))
+ ConeScale = 1.0;
+
InitializeCriticalSection(&g_csMutex);
ALTHUNK_INIT();
ReadALConfig();
diff --git a/Alc/ALu.c b/Alc/ALu.c
index ea5a0319..49cedab8 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -357,8 +357,8 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
MinDist = ALSource->flRefDistance;
MaxDist = ALSource->flMaxDistance;
Rolloff = ALSource->flRollOffFactor;
- InnerAngle = ALSource->flInnerAngle * 0.5f;
- OuterAngle = ALSource->flOuterAngle * 0.5f;
+ InnerAngle = ALSource->flInnerAngle * ConeScale;
+ OuterAngle = ALSource->flOuterAngle * ConeScale;
OuterGainHF = ALSource->OuterGainHF;
AirAbsorptionFactor = ALSource->AirAbsorptionFactor;