aboutsummaryrefslogtreecommitdiffstats
path: root/alc/panning.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-01-04 18:40:04 -0800
committerChris Robinson <[email protected]>2022-01-04 19:27:29 -0800
commitc77fd6540c4bbe3b57fd313c233021a63357f309 (patch)
treeb70c0d81b62c1d3cb8d6a7ef597b84efe808398a /alc/panning.cpp
parent7ac336b078cae9f96f1ee135a55a0250397b9112 (diff)
Update the HRTF second-order ambisonic decoder
This only needs 14 virtual channels instead of 20.
Diffstat (limited to 'alc/panning.cpp')
-rw-r--r--alc/panning.cpp69
1 files changed, 27 insertions, 42 deletions
diff --git a/alc/panning.cpp b/alc/panning.cpp
index eefcc867..17475160 100644
--- a/alc/panning.cpp
+++ b/alc/panning.cpp
@@ -662,10 +662,7 @@ void InitHrtfPanning(ALCdevice *device)
constexpr float Deg_90{Deg180 / 2.0f /* 90 degrees*/};
constexpr float Deg_45{Deg_90 / 2.0f /* 45 degrees*/};
constexpr float Deg135{Deg_45 * 3.0f /*135 degrees*/};
- constexpr float Deg_35{6.154797086e-01f /* 35~ 36 degrees*/};
- constexpr float Deg_69{1.205932499e+00f /* 69~ 70 degrees*/};
- constexpr float Deg111{1.935660155e+00f /*110~111 degrees*/};
- constexpr float Deg_21{3.648638281e-01f /* 20~ 21 degrees*/};
+ constexpr float Deg_35{6.154797087e-01f /* 35~ 36 degrees*/};
static const AngularPoint AmbiPoints1O[]{
{ EvRadians{ Deg_35}, AzRadians{-Deg_45} },
{ EvRadians{ Deg_35}, AzRadians{-Deg135} },
@@ -676,26 +673,20 @@ void InitHrtfPanning(ALCdevice *device)
{ EvRadians{-Deg_35}, AzRadians{ Deg_45} },
{ EvRadians{-Deg_35}, AzRadians{ Deg135} },
}, AmbiPoints2O[]{
- { EvRadians{-Deg_35}, AzRadians{-Deg_45} },
- { EvRadians{-Deg_35}, AzRadians{-Deg135} },
+ { EvRadians{ 0.0f}, AzRadians{ 0.0f} },
+ { EvRadians{ 0.0f}, AzRadians{ Deg180} },
+ { EvRadians{ 0.0f}, AzRadians{-Deg_90} },
+ { EvRadians{ 0.0f}, AzRadians{ Deg_90} },
+ { EvRadians{ Deg_90}, AzRadians{ 0.0f} },
+ { EvRadians{-Deg_90}, AzRadians{ 0.0f} },
+ { EvRadians{ Deg_35}, AzRadians{-Deg_45} },
{ EvRadians{ Deg_35}, AzRadians{-Deg135} },
- { EvRadians{ Deg_35}, AzRadians{ Deg135} },
{ EvRadians{ Deg_35}, AzRadians{ Deg_45} },
+ { EvRadians{ Deg_35}, AzRadians{ Deg135} },
+ { EvRadians{-Deg_35}, AzRadians{-Deg_45} },
+ { EvRadians{-Deg_35}, AzRadians{-Deg135} },
{ EvRadians{-Deg_35}, AzRadians{ Deg_45} },
{ EvRadians{-Deg_35}, AzRadians{ Deg135} },
- { EvRadians{ Deg_35}, AzRadians{-Deg_45} },
- { EvRadians{-Deg_69}, AzRadians{-Deg_90} },
- { EvRadians{ Deg_69}, AzRadians{ Deg_90} },
- { EvRadians{-Deg_69}, AzRadians{ Deg_90} },
- { EvRadians{ Deg_69}, AzRadians{-Deg_90} },
- { EvRadians{ 0.0f}, AzRadians{-Deg_69} },
- { EvRadians{ 0.0f}, AzRadians{-Deg111} },
- { EvRadians{ 0.0f}, AzRadians{ Deg_69} },
- { EvRadians{ 0.0f}, AzRadians{ Deg111} },
- { EvRadians{-Deg_21}, AzRadians{ Deg180} },
- { EvRadians{ Deg_21}, AzRadians{ Deg180} },
- { EvRadians{ Deg_21}, AzRadians{ 0.0f} },
- { EvRadians{-Deg_21}, AzRadians{ 0.0f} },
};
static const float AmbiMatrix1O[][MaxAmbiChannels]{
{ 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f },
@@ -707,33 +698,27 @@ void InitHrtfPanning(ALCdevice *device)
{ 1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f, 1.250000000e-01f },
{ 1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f, -1.250000000e-01f },
}, AmbiMatrix2O[][MaxAmbiChannels]{
- { 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, 6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f },
- { 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, -6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f },
- { 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, -6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f },
- { 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, -5.000000000e-02f, 6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f },
- { 5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, -6.454972244e-02f, -6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f },
- { 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, 5.000000000e-02f, -6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, -6.454972244e-02f, 0.000000000e+00f },
- { 5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, -5.000000000e-02f, 6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f },
- { 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, 5.000000000e-02f, 6.454972244e-02f, 6.454972244e-02f, 0.000000000e+00f, 6.454972244e-02f, 0.000000000e+00f },
- { 5.000000000e-02f, 3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f },
- { 5.000000000e-02f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f },
- { 5.000000000e-02f, -3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f },
- { 5.000000000e-02f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.454972244e-02f, 9.045084972e-02f, 0.000000000e+00f, -1.232790000e-02f },
- { 5.000000000e-02f, 8.090169944e-02f, 0.000000000e+00f, 3.090169944e-02f, 6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f },
- { 5.000000000e-02f, 8.090169944e-02f, 0.000000000e+00f, -3.090169944e-02f, -6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f },
- { 5.000000000e-02f, -8.090169944e-02f, 0.000000000e+00f, 3.090169944e-02f, -6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f },
- { 5.000000000e-02f, -8.090169944e-02f, 0.000000000e+00f, -3.090169944e-02f, 6.454972244e-02f, 0.000000000e+00f, -5.590169944e-02f, 0.000000000e+00f, -7.216878365e-02f },
- { 5.000000000e-02f, 0.000000000e+00f, -3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, 6.454972244e-02f, 8.449668365e-02f },
- { 5.000000000e-02f, 0.000000000e+00f, 3.090169944e-02f, -8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, -6.454972244e-02f, 8.449668365e-02f },
- { 5.000000000e-02f, 0.000000000e+00f, 3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, 6.454972244e-02f, 8.449668365e-02f },
- { 5.000000000e-02f, 0.000000000e+00f, -3.090169944e-02f, 8.090169944e-02f, 0.000000000e+00f, 0.000000000e+00f, -3.454915028e-02f, -6.454972244e-02f, 8.449668365e-02f },
+ { 7.142857143e-02f, 0.000000000e+00f, 0.000000000e+00f, 1.237179148e-01f, 0.000000000e+00f, 0.000000000e+00f, -7.453559925e-02f, 0.000000000e+00f, 1.290994449e-01f, },
+ { 7.142857143e-02f, 0.000000000e+00f, 0.000000000e+00f, -1.237179148e-01f, 0.000000000e+00f, 0.000000000e+00f, -7.453559925e-02f, 0.000000000e+00f, 1.290994449e-01f, },
+ { 7.142857143e-02f, 1.237179148e-01f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -7.453559925e-02f, 0.000000000e+00f, -1.290994449e-01f, },
+ { 7.142857143e-02f, -1.237179148e-01f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -7.453559925e-02f, 0.000000000e+00f, -1.290994449e-01f, },
+ { 7.142857143e-02f, 0.000000000e+00f, 1.237179148e-01f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 1.490711985e-01f, 0.000000000e+00f, 0.000000000e+00f, },
+ { 7.142857143e-02f, 0.000000000e+00f, -1.237179148e-01f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 1.490711985e-01f, 0.000000000e+00f, 0.000000000e+00f, },
+ { 7.142857143e-02f, 7.142857143e-02f, 7.142857143e-02f, 7.142857143e-02f, 9.682458366e-02f, 9.682458366e-02f, 0.000000000e+00f, 9.682458366e-02f, 0.000000000e+00f, },
+ { 7.142857143e-02f, 7.142857143e-02f, 7.142857143e-02f, -7.142857143e-02f, -9.682458366e-02f, 9.682458366e-02f, 0.000000000e+00f, -9.682458366e-02f, 0.000000000e+00f, },
+ { 7.142857143e-02f, -7.142857143e-02f, 7.142857143e-02f, 7.142857143e-02f, -9.682458366e-02f, -9.682458366e-02f, 0.000000000e+00f, 9.682458366e-02f, 0.000000000e+00f, },
+ { 7.142857143e-02f, -7.142857143e-02f, 7.142857143e-02f, -7.142857143e-02f, 9.682458366e-02f, -9.682458366e-02f, 0.000000000e+00f, -9.682458366e-02f, 0.000000000e+00f, },
+ { 7.142857143e-02f, 7.142857143e-02f, -7.142857143e-02f, 7.142857143e-02f, 9.682458366e-02f, -9.682458366e-02f, 0.000000000e+00f, -9.682458366e-02f, 0.000000000e+00f, },
+ { 7.142857143e-02f, 7.142857143e-02f, -7.142857143e-02f, -7.142857143e-02f, -9.682458366e-02f, -9.682458366e-02f, 0.000000000e+00f, 9.682458366e-02f, 0.000000000e+00f, },
+ { 7.142857143e-02f, -7.142857143e-02f, -7.142857143e-02f, 7.142857143e-02f, -9.682458366e-02f, 9.682458366e-02f, 0.000000000e+00f, -9.682458366e-02f, 0.000000000e+00f, },
+ { 7.142857143e-02f, -7.142857143e-02f, -7.142857143e-02f, -7.142857143e-02f, 9.682458366e-02f, 9.682458366e-02f, 0.000000000e+00f, 9.682458366e-02f, 0.000000000e+00f, },
};
static const float AmbiOrderHFGain1O[MaxAmbiOrder+1]{
- 2.000000000e+00f, 1.154700538e+00f
+ /*ENRGY*/ 2.000000000e+00f, 1.154700538e+00f
}, AmbiOrderHFGain2O[MaxAmbiOrder+1]{
+ /*ENRGY 2.357022604e+00f, 1.825741858e+00f, 9.428090416e-01f*/
/*AMP 1.000000000e+00f, 7.745966692e-01f, 4.000000000e-01f*/
/*RMS*/ 9.128709292e-01f, 7.071067812e-01f, 3.651483717e-01f
- /*ENRGY 2.357022604e+00f, 1.825741858e+00f, 9.428090416e-01f*/
};
static_assert(al::size(AmbiPoints1O) == al::size(AmbiMatrix1O), "First-Order Ambisonic HRTF mismatch");