diff options
author | Chris Robinson <[email protected]> | 2011-05-03 03:15:28 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-05-03 03:15:28 -0700 |
commit | 48def2fecb3e3ff0e8500e3cec3bdc0639580e72 (patch) | |
tree | 550edc904d903a57c8eec854619a0d08d2129fd2 /Alc/hrtf.c | |
parent | ba236ad1084ffc99890f0301f444ddc7d63a64e1 (diff) |
Properly handle elevations that don't have angles up to 180
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r-- | Alc/hrtf.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -27,6 +27,7 @@ typedef struct { ALsizei num_angles; + ALsizei max_angle; ALshort coeffs[][2][HRTF_LENGTH]; } HrtfFilterCoeffs; @@ -36,15 +37,17 @@ static void get_angle_coeffs(const HrtfFilterCoeffs *elev, ALfloat angle, const { if(angle < 0) { - int idx = ((angle > -180.0) ? (int)(angle*(elev->num_angles-1)/-180.0 + 0.5) : - (elev->num_angles-1)); + int idx = ((angle > -elev->max_angle) ? + (int)(angle*(elev->num_angles-1)/-elev->max_angle + 0.5) : + (elev->num_angles-1)); *left = elev->coeffs[idx][1]; *right = elev->coeffs[idx][0]; } else { - int idx = ((angle < 180.0) ? (int)(angle*(elev->num_angles-1)/180.0 + 0.5) : - (elev->num_angles-1)); + int idx = ((angle < elev->max_angle) ? + (int)(angle*(elev->num_angles-1)/elev->max_angle + 0.5) : + (elev->num_angles-1)); *left = elev->coeffs[idx][0]; *right = elev->coeffs[idx][1]; } |