aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-05-19 17:57:14 -0700
committerChris Robinson <[email protected]>2011-05-19 17:57:14 -0700
commit7396aaf2c28ef4e16c3f27d0cc3c06cc09134d41 (patch)
tree994c34cc602b4fd03d7eee2bc3ca3620c142a771
parent555ccce4eec6afbe3a14fe5a9de6d04e1e74fdcd (diff)
Fix HRTF elevation calculation
-rw-r--r--Alc/ALu.c2
-rw-r--r--Alc/hrtf.c8
-rw-r--r--OpenAL32/Include/alMain.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index a4304448..ce68cdf9 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -669,7 +669,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
{
const ALshort *hrtf_left, *hrtf_right;
- GetHrtfCoeffs(atan2(Position[1], -Position[2]*ZScale) * (180.0/M_PI),
+ GetHrtfCoeffs(asin(Position[1]) * (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++)
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index 09747209..da461dcf 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -53,14 +53,14 @@ static void get_angle_coeffs(const HrtfFilterCoeffs *elev, ALfloat angle, const
}
}
-void GetHrtfCoeffs(ALfloat azimuth, ALfloat angle, const ALshort **left, const ALshort **right)
+void GetHrtfCoeffs(ALfloat elevation, ALfloat angle, const ALshort **left, const ALshort **right)
{
int idx;
- if(azimuth > 90.f) azimuth = 90.f - (azimuth - 90.f);
- else if(azimuth < -90.f) azimuth = -90.f - (azimuth - -90.f);
+ if(elevation > 90.f) elevation = 90.f - (elevation - 90.f);
+ else if(elevation < -90.f) elevation = -90.f - (elevation - -90.f);
- idx = (int)(azimuth/10.0 + 0.5);
+ idx = (int)(elevation/10.0 + 0.5);
if(idx >= 9) return get_angle_coeffs(&Elev90, angle, left, right);
if(idx >= 8) return get_angle_coeffs(&Elev80, angle, left, right);
if(idx >= 7) return get_angle_coeffs(&Elev70, angle, left, right);
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index e0c05ea8..67481e67 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -600,7 +600,7 @@ ALboolean IsValidChannels(ALenum type);
#define HRTF_BITS (7)
#define HRTF_LENGTH (1<<HRTF_BITS)
#define HRTF_LENGTH_MASK (HRTF_LENGTH-1)
-void GetHrtfCoeffs(ALfloat azimuth, ALfloat angle, const ALshort **left, const ALshort **right);
+void GetHrtfCoeffs(ALfloat elevation, ALfloat angle, const ALshort **left, const ALshort **right);
void al_print(const char *fname, unsigned int line, const char *fmt, ...)
PRINTF_STYLE(3,4);