aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-02-09 21:43:38 -0800
committerChris Robinson <[email protected]>2015-02-10 05:38:16 -0800
commitcf5856ed481009621882078727212e5da65e60ee (patch)
tree6142f7fb61c7381fc191aebc21f79cab5b93d08c
parenta1d4847d078f4f807f5697f299eea834797f4287 (diff)
Correct conversion from polar to cartesian coords for HRTF
A functional no-op (cos(a) == cos(-a), -sin(a) == sin(-a)), but Ambisonics expects the azimuth angle to go counter-clockwise.
-rw-r--r--Alc/hrtf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index 98bcefc2..09ac1709 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -359,9 +359,9 @@ void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALfloat ambi_coeffs[4],
az = (ALfloat)azi_idx / (ALfloat)azcount * F_2PI;
if(az > F_PI) az -= F_2PI;
- x = cosf(az) * cosf(elev);
- y = -sinf(az) * cosf(elev);
- z = sinf(elev);
+ x = cosf(-az) * cosf(elev);
+ y = sinf(-az) * cosf(elev);
+ z = sinf(elev);
gain = 0.0f;
gain += ambi_coeffs[0]*0.7071f; /* sqrt(1.0 / 2.0) */