aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-05-03 03:15:28 -0700
committerChris Robinson <[email protected]>2011-05-03 03:15:28 -0700
commit48def2fecb3e3ff0e8500e3cec3bdc0639580e72 (patch)
tree550edc904d903a57c8eec854619a0d08d2129fd2
parentba236ad1084ffc99890f0301f444ddc7d63a64e1 (diff)
Properly handle elevations that don't have angles up to 180
-rw-r--r--Alc/hrtf.c11
-rw-r--r--Alc/hrtf_tables.inc28
2 files changed, 21 insertions, 18 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index 6972ec27..09747209 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -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];
}
diff --git a/Alc/hrtf_tables.inc b/Alc/hrtf_tables.inc
index 29324c8b..804093f9 100644
--- a/Alc/hrtf_tables.inc
+++ b/Alc/hrtf_tables.inc
@@ -5,7 +5,7 @@
static const HrtfFilterCoeffs Elev40n = {
- 29, {
+ 29, 180, {
/* a = 0 */
{
{ -8,+8,-6,+14,-12,+18,-27,+20,-20,+10,-17,+20,-39,+2138,+6623,-2555,-8071,+181,-1297,+1448,+8830,+7885,+3327,+4823,+10354,+2975,-4886,-3540,-6390,-7410,-431,-2190,-6705,-3865,-1268,-716,-437,+1002,+1574,+883,+1711,+3056,+942,+46,+535,+301,-300,-1129,-1019,-1168,-1324,-677,-708,-996,-198,+229,+88,+292,+510,+662,+449,-66,-51,-456,-517,+136,+238,+177,+280,+180,-10,-369,-563,-780,-1233,-1004,-476,-175,+175,+349,+472,+513,+292,+268,+32,-320,-548,-635,-472,-203,-30,+75,+49,+31,+52,-76,-118,-90,-59,-145,-252,-208,-118,-103,-96,-191,-281,-246,-184,-178,-119,+2,+45,+58,+94,+103,+57,-30,-82,-109,-152,-187,-226,-214,-266,-249,-149,-44 },
@@ -155,7 +155,7 @@ static const HrtfFilterCoeffs Elev40n = {
};
static const HrtfFilterCoeffs Elev30n = {
- 31, {
+ 31, 180, {
/* a = 0 */
{
{ -8,+6,-4,+5,+0,-4,+3,-28,+34,-59,+59,-83,+82,+655,+6313,+2093,-10148,-2457,-1373,-2539,+8574,+9341,+4579,+5326,+13776,+5453,-7484,-2713,-5026,-10468,-1681,+1057,-5970,-3755,+857,+989,-400,+341,+1379,-235,+133,+1819,-377,-1766,-95,+163,-1102,-1370,-685,-649,-652,+160,+251,-271,+204,+736,+699,+362,+124,+60,-45,-475,-476,-492,-691,-476,-197,-266,-274,+11,+31,-13,+120,+129,-7,-47,-109,-157,-178,-130,-86,-52,-161,-152,-75,-63,-41,-18,-58,-155,-118,-142,-177,-25,-70,-507,-621,-520,-273,+267,+500,+372,+269,-7,-326,-474,-651,-848,-677,-37,+296,+257,+256,+170,+64,+9,-38,+6,+118,+142,+32,-83,-208,-255,-276,-329,-383,-472 },
@@ -315,7 +315,7 @@ static const HrtfFilterCoeffs Elev30n = {
};
static const HrtfFilterCoeffs Elev20n = {
- 37, {
+ 37, 180, {
/* a = 0 */
{
{ +5,-8,+19,-22,+27,-46,+46,-51,+36,-44,+45,+13,+3688,+7158,-7481,-7205,+1978,-4401,+4622,+10998,+4979,+3542,+13675,+9486,-8974,-3592,+147,-10860,-6417,+2107,-5741,-7291,+89,+1780,-60,+738,+4375,+3486,+1545,+2411,+769,-2287,-1589,-1469,-3444,-3779,-2357,-1131,-1542,-770,+1178,+931,+937,+1781,+1529,+1019,+902,+745,+241,-551,-733,-634,-1193,-1165,-731,-970,-899,-304,-106,-35,+185,+519,+471,+361,+398,+240,+3,-181,-301,-416,-537,-486,-295,-376,-379,-170,-148,-190,-28,+98,+126,+120,+142,+68,-51,-133,-139,-97,-133,-98,-26,-57,-124,-55,-40,-132,-67,+9,-147,-226,-221,-219,-139,-21,-13,-100,-74,-10,+2,-58,-183,-257,-250,-279,-303,-256,-314,-427 },
@@ -505,7 +505,7 @@ static const HrtfFilterCoeffs Elev20n = {
};
static const HrtfFilterCoeffs Elev10n = {
- 37, {
+ 37, 180, {
/* a = 0 */
{
{ +6,-9,+21,-31,+35,-55,+65,-84,+81,-88,+98,+8,+4587,+6732,-8759,-4087,+2448,-5277,+6627,+10260,+2468,+6955,+16044,+746,-11932,+1720,-1530,-13711,-4322,+1346,-7485,-5198,+2168,+1744,-413,+1519,+4593,+2711,+1892,+3655,+1260,-1483,+96,-21,-2805,-3756,-2559,-3077,-3620,-1860,-1318,-1034,+1002,+1768,+1524,+1852,+1949,+1564,+1019,+500,+267,-157,-917,-970,-1026,-1457,-1407,-1032,-966,-784,-287,+38,+85,+445,+771,+710,+590,+489,+371,+24,-334,-387,-430,-694,-602,-412,-525,-505,-264,-80,-16,+105,+269,+163,+133,+263,+245,+90,-27,-105,-317,-429,-441,-415,-370,-290,-144,-38,+7,+78,+88,+31,+12,+16,-13,-35,-69,-143,-174,-168,-146,-109,-62,-67,-41,+5,+8,+59 },
@@ -695,7 +695,7 @@ static const HrtfFilterCoeffs Elev10n = {
};
static const HrtfFilterCoeffs Elev0 = {
- 37, {
+ 37, 180, {
/* a = 0 */
{
{ +5,-6,+19,-24,+39,-56,+74,-101,+120,-137,+161,+30,+5321,+6066,-6762,-253,+195,-5129,+7285,+5986,+2332,+11785,+11069,-6536,-5109,+4539,-8167,-13539,-2026,-1365,-7336,-1277,+3012,+80,+1084,+4212,+3286,+1359,+2467,+1543,-905,-191,+1215,-587,-1697,-1097,-1235,-2135,-2711,-2422,-2046,-1331,-253,+114,+194,+681,+1310,+1375,+929,+696,+553,+151,-244,-225,-474,-819,-699,-736,-921,-736,-542,-605,-447,-73,+76,+157,+352,+549,+419,+112,-34,-6,-104,-306,-273,-311,-395,-292,-165,-175,-147,-5,-60,-246,-136,+59,+57,+16,+36,-37,-145,-119,-153,-195,-179,-216,-240,-128,+25,+74,+12,-44,-33,-95,-202,-185,-158,-192,-162,-83,-51,-27,-21,-53,-58,-38,-56,-58 },
@@ -885,7 +885,7 @@ static const HrtfFilterCoeffs Elev0 = {
};
static const HrtfFilterCoeffs Elev10 = {
- 37, {
+ 37, 180, {
/* a = 0 */
{
{ +8,-10,+21,-18,+26,-27,+18,-9,-10,+27,-41,+38,+1898,+8088,-528,-4303,+777,-5855,+2708,+7238,+3222,+11158,+10655,-3431,-4559,+3601,-4772,-13166,-5593,-950,-5732,-3428,+2126,+267,+870,+3637,+2542,+1094,+2453,+2423,+426,-147,+659,-20,-1273,-694,-572,-1972,-2857,-1624,-424,-257,-301,-390,-502,-85,+304,+161,-128,+17,+259,+131,-198,-166,-69,-454,-598,-581,-651,-369,+25,-105,-224,-20,+6,-116,+36,+146,-74,-267,-267,-209,-169,-183,-149,-147,-225,-187,-61,-1,-15,+4,-49,-135,-101,+30,-14,-86,-86,-196,-297,-260,-228,-192,-118,-138,-152,-18,+126,+177,+136,-9,-107,-123,-139,-142,-115,-186,-242,-151,-80,-40,-18,-93,-160,-113,-67,-53 },
@@ -1075,7 +1075,7 @@ static const HrtfFilterCoeffs Elev10 = {
};
static const HrtfFilterCoeffs Elev20 = {
- 37, {
+ 37, 180, {
/* a = 0 */
{
{ -5,+2,-6,+10,+1,+3,+11,-26,+42,-72,+106,-139,+167,+543,+6671,+4276,-2692,-1647,-5872,+792,+4988,+5035,+11773,+7686,-2234,-1219,+1989,-5035,-9992,-7086,-2924,-3516,-3122,+223,+17,+1363,+2937,+2064,+2242,+2440,+1079,+37,+54,+202,+613,+189,+65,-589,-1895,-2557,-1977,-997,-967,-509,+800,+978,+808,+1009,+556,-210,-530,-710,-1033,-1193,-999,-460,-425,-575,-591,-454,-87,+168,+88,-33,+75,+112,+84,+133,+239,+119,-164,-303,-356,-426,-398,-315,-236,-276,-260,-160,-8,+153,+185,+34,-144,-144,-66,-16,-7,-64,-203,-270,-194,-137,-117,-102,-172,-211,-120,+20,+87,+29,-116,-191,-156,-108,-45,-45,-126,-138,-96,-9,+109,+102,-40,-126,-136,-183 },
@@ -1265,7 +1265,7 @@ static const HrtfFilterCoeffs Elev20 = {
};
static const HrtfFilterCoeffs Elev30 = {
- 31, {
+ 31, 180, {
/* a = 0 */
{
{ +5,+6,-7,+20,-39,+55,-86,+127,-163,+207,+93,+5125,+5683,-325,-3557,-7833,+1643,+5327,+6140,+12244,+5368,-2342,+1542,+1864,-6291,-7851,-6563,-4757,-3265,-2425,-783,-732,+1418,+2826,+1586,+2088,+2401,+1556,+1074,+484,-603,-33,-310,-476,-275,-1016,-1580,-1681,-1244,-800,-212,-103,+24,+683,+1268,+1233,+1059,+907,+37,-1098,-1612,-1562,-1192,-1252,-1445,-1205,-574,+32,+174,+120,+112,+197,+120,+187,+365,+400,+168,-141,-318,-402,-499,-483,-342,-299,-345,-312,-157,+47,+212,+176,-2,-147,-140,-82,+2,+59,-23,-243,-341,-249,-151,-94,-139,-235,-257,-138,+29,+146,+113,-44,-164,-173,-122,-66,-64,-138,-203,-180,-99,+19,+91,+47,-49,-102,-62,+3,+33,-9 },
@@ -1425,7 +1425,7 @@ static const HrtfFilterCoeffs Elev30 = {
};
static const HrtfFilterCoeffs Elev40 = {
- 29, {
+ 29, 180, {
/* a = 0 */
{
{ +3,-5,-3,+4,+8,-5,+14,-40,+45,-86,+116,-157,+213,-44,+3991,+5092,+321,-8034,-13665,+2199,+10876,+13927,+13643,+1537,-4033,+847,+2379,-3450,-5203,-6535,-4786,-3083,-3496,-1933,-1842,-358,+1670,+1892,+2485,+2446,+2290,+1971,+951,+406,+127,-1598,-1089,-574,-2112,-1790,-948,-643,-355,+64,+390,+451,+305,+413,+837,+1226,+965,+455,+96,-366,-800,-1142,-1480,-1506,-1381,-1305,-1173,-788,-38,+323,+241,+255,+417,+248,+114,+124,-8,-161,-217,-320,-428,-307,-213,-322,-413,-359,-310,-182,+11,+141,+86,+52,+57,+36,+55,+48,-48,-225,-275,-242,-203,-175,-173,-163,-164,-135,-56,-42,-62,-58,-73,-96,-69,-60,-72,-77,-70,-67,-101,-132,-124,-71,-44,-29 },
@@ -1575,7 +1575,7 @@ static const HrtfFilterCoeffs Elev40 = {
};
static const HrtfFilterCoeffs Elev50 = {
- 23, {
+ 23, 176, {
/* a = 0 */
{
{ +6,+3,-28,+36,-72,+106,-153,+207,-55,+3561,+4741,+2370,-8236,-16173,+2342,+12509,+15337,+11784,-651,-2615,+1849,+1809,-3284,-4373,-6525,-4665,-2274,-3453,-2739,-1821,-132,+714,+1933,+2744,+1924,+2097,+2159,+1087,+120,-81,-368,-231,-1666,-2489,-1566,-1430,-790,+168,+278,+65,+673,+811,+622,+170,-179,+379,+627,+158,-162,+89,-134,-577,-690,-907,-1243,-1497,-1325,-860,-515,-319,-25,+162,+84,+203,+233,+183,+204,+107,-184,-298,-209,-219,-281,-322,-357,-451,-374,-248,-178,-187,-158,-77,+33,+173,+222,+142,-13,-65,-90,-107,-141,-240,-280,-229,-171,-132,-133,-123,-110,-124,-99,-64,-85,-84,-63,-60,-25,-24,-57,-65,-73,-84,-103,-132,-110,-63,-31,-45 },
@@ -1695,7 +1695,7 @@ static const HrtfFilterCoeffs Elev50 = {
};
static const HrtfFilterCoeffs Elev60 = {
- 19, {
+ 19, 180, {
/* a = 0 */
{
{ +16,-28,+24,-11,-17,+31,+549,+3878,+4380,+3365,-10240,-11245,+7885,+11168,+8701,+3347,+1360,+2913,+2769,-1090,-5608,-5508,-5370,-2927,-2680,-2736,-1296,-656,+378,+1081,+2018,+1686,+1672,+1403,+1229,+573,-184,+210,+148,+13,-1031,-1847,-2064,-1499,-978,-426,+221,+579,+548,+262,+530,+725,+549,+266,-196,-528,-380,-199,-209,-157,-203,-411,-550,-658,-544,-684,-1159,-1319,-739,-20,+194,+213,+109,-45,-79,-31,+25,+52,+80,-28,-259,-429,-408,-185,-83,-139,-281,-423,-403,-311,-138,+81,+88,-34,-135,-114,+33,+126,+11,-114,-135,-116,-55,-33,-68,-147,-235,-261,-209,-100,-52,-120,-155,-146,-98,-34,-1,-6,-40,-91,-64,+12,+26,-14,-86,-177,-191,-84 },
@@ -1795,7 +1795,7 @@ static const HrtfFilterCoeffs Elev60 = {
};
static const HrtfFilterCoeffs Elev70 = {
- 13, {
+ 13, 180, {
/* a = 0 */
{
{ -4,-5,-6,+18,-6,+15,-19,+11,-7,-7,+26,-59,+81,+255,+3267,+4223,+4430,-7297,-12655,+5572,+11429,+7082,+3472,+3241,+3322,+2148,-766,-5816,-6343,-5330,-3183,-3044,-2544,-536,+56,+845,+1520,+2423,+1683,+1231,+1250,+1128,+225,-708,-233,-102,-221,-887,-1542,-2059,-1668,-989,-366,+292,+793,+923,+664,+706,+874,+529,+27,-353,-597,-641,-532,-582,-694,-409,-213,-23,-42,-212,-291,-461,-824,-1080,-816,-231,+126,+44,-108,-40,+111,+53,-98,-103,-74,-219,-356,-344,-204,-66,+3,-103,-274,-332,-273,-180,-69,-24,-148,-250,-176,+5,+92,+30,-106,-134,-84,-1,+82,+52,-71,-182,-231,-194,-105,-75,-154,-222,-227,-134,+3,+36,-17,-40,-31,-48 },
@@ -1865,7 +1865,7 @@ static const HrtfFilterCoeffs Elev70 = {
};
static const HrtfFilterCoeffs Elev80 = {
- 7, {
+ 7, 180, {
/* a = 0 */
{
{ +16,-6,+17,-23,+19,-17,+10,+13,-24,+46,+313,+3188,+4578,+4872,-6962,-11476,+5790,+10102,+4320,+3018,+4901,+3465,+1859,-471,-5646,-6097,-4304,-3345,-4194,-2512,-329,+51,+1258,+1929,+2321,+1451,+1180,+1065,+875,-148,-652,-82,+1,-161,-849,-1465,-2030,-1645,-1025,-552,-37,+466,+948,+915,+953,+1080,+560,-195,-704,-688,-349,-137,-513,-979,-725,-297,-239,-194,+28,+73,+16,-128,-445,-789,-801,-398,-132,-398,-584,-276,+85,+117,+68,+44,-82,-130,-80,-85,-144,-80,-97,-224,-365,-374,-239,-103,-114,-275,-372,-239,-1,+92,+19,-98,-115,-39,+68,+146,+101,-79,-195,-200,-150,-71,-71,-177,-254,-246,-145,-3,+40,-12,-139,-229,-164,+16,+145,+119 },
@@ -1905,7 +1905,7 @@ static const HrtfFilterCoeffs Elev80 = {
};
static const HrtfFilterCoeffs Elev90 = {
- 1, {
+ 1, 0, {
/* a = 0 */
{
{ +5,-16,+26,-41,+63,-81,+119,-73,+2020,+4378,+5862,-903,-11453,-1186,+9080,+4800,+2577,+4817,+4371,+2144,+575,-3634,-5593,-3944,-3191,-4101,-3272,-1131,-482,+514,+1269,+2172,+1956,+1147,+1256,+990,-222,-780,+134,+460,+257,-481,-1587,-2274,-1906,-1100,-432,-2,+355,+547,+419,+651,+931,+678,+145,-284,-374,-347,-98,-141,-816,-1128,-690,-358,-272,+105,+75,-125,-120,-96,-275,-592,-607,-361,-364,-647,-563,-77,+190,+92,+42,+0,-123,-222,-170,-55,+59,+53,-195,-453,-387,-120,+23,-107,-440,-607,-424,-74,+136,+51,-75,-11,+93,+170,+173,+79,-115,-263,-269,-222,-146,-100,-138,-198,-199,-118,+6,+70,+29,-59,-127,-124,-20,+69,+38,-69,-132,-141 },