aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-11-16 14:33:09 -0800
committerChris Robinson <[email protected]>2019-11-16 14:33:09 -0800
commitc86a28af5cd88dd3515297fd55a9914718f28d13 (patch)
tree04fbd13602ac2b3377e803b765af5980556cc7a9 /alc
parent6ad252efdaf2f4a9ed569097c35b8b781f9f1d50 (diff)
Simplify some pi statements
Diffstat (limited to 'alc')
-rw-r--r--alc/panning.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/alc/panning.cpp b/alc/panning.cpp
index b754d18b..893147a0 100644
--- a/alc/panning.cpp
+++ b/alc/panning.cpp
@@ -523,34 +523,37 @@ void InitCustomPanning(ALCdevice *device, bool hqdec, const AmbDecConf *conf,
void InitHrtfPanning(ALCdevice *device)
{
constexpr float PI{al::MathDefs<float>::Pi()};
+ constexpr float PI_2{al::MathDefs<float>::Pi() / 2.0f};
+ constexpr float PI_4{al::MathDefs<float>::Pi() / 4.0f};
+ constexpr float PI3_4{al::MathDefs<float>::Pi() * 3.0f / 4.0f};
const float CornerElev{static_cast<float>(std::atan2(1.0, std::sqrt(2.0)))};
static const AngularPoint AmbiPoints[]{
- { ElevRadius{ 0.0f}, AzimRadius{ 0.0f} },
- { ElevRadius{ 0.0f}, AzimRadius{ PI} },
- { ElevRadius{ 0.0f}, AzimRadius{ -PI/2.0f} },
- { ElevRadius{ 0.0f}, AzimRadius{ PI/2.0f} },
- { ElevRadius{ PI/2.0f}, AzimRadius{ 0.0f} },
- { ElevRadius{ -PI/2.0f}, AzimRadius{ 0.0f} },
- { ElevRadius{ PI/4.0f}, AzimRadius{ -PI/2.0f} },
- { ElevRadius{ -PI/4.0f}, AzimRadius{ -PI/2.0f} },
- { ElevRadius{ PI/4.0f}, AzimRadius{ PI/2.0f} },
- { ElevRadius{ -PI/4.0f}, AzimRadius{ PI/2.0f} },
- { ElevRadius{ PI/4.0f}, AzimRadius{ 0.0f} },
- { ElevRadius{ -PI/4.0f}, AzimRadius{ 0.0f} },
- { ElevRadius{ PI/4.0f}, AzimRadius{ PI} },
- { ElevRadius{ -PI/4.0f}, AzimRadius{ PI} },
- { ElevRadius{ 0.0f}, AzimRadius{ -PI/4.0f} },
- { ElevRadius{ 0.0f}, AzimRadius{ PI/4.0f} },
- { ElevRadius{ 0.0f}, AzimRadius{-PI*3.0f/4.0f} },
- { ElevRadius{ 0.0f}, AzimRadius{ PI*3.0f/4.0f} },
- { ElevRadius{ CornerElev}, AzimRadius{ -PI/4.0f} },
- { ElevRadius{-CornerElev}, AzimRadius{ -PI/4.0f} },
- { ElevRadius{ CornerElev}, AzimRadius{ PI/4.0f} },
- { ElevRadius{-CornerElev}, AzimRadius{ PI/4.0f} },
- { ElevRadius{ CornerElev}, AzimRadius{-PI*3.0f/4.0f} },
- { ElevRadius{-CornerElev}, AzimRadius{-PI*3.0f/4.0f} },
- { ElevRadius{ CornerElev}, AzimRadius{ PI*3.0f/4.0f} },
- { ElevRadius{-CornerElev}, AzimRadius{ PI*3.0f/4.0f} },
+ { ElevRadius{ 0.0f}, AzimRadius{ 0.0f} },
+ { ElevRadius{ 0.0f}, AzimRadius{ PI} },
+ { ElevRadius{ 0.0f}, AzimRadius{ -PI_2} },
+ { ElevRadius{ 0.0f}, AzimRadius{ PI_2} },
+ { ElevRadius{ PI_2}, AzimRadius{ 0.0f} },
+ { ElevRadius{ -PI_2}, AzimRadius{ 0.0f} },
+ { ElevRadius{ PI_4}, AzimRadius{ -PI_2} },
+ { ElevRadius{ -PI_4}, AzimRadius{ -PI_2} },
+ { ElevRadius{ PI_4}, AzimRadius{ PI_2} },
+ { ElevRadius{ -PI_4}, AzimRadius{ PI_2} },
+ { ElevRadius{ PI_4}, AzimRadius{ 0.0f} },
+ { ElevRadius{ -PI_4}, AzimRadius{ 0.0f} },
+ { ElevRadius{ PI_4}, AzimRadius{ PI} },
+ { ElevRadius{ -PI_4}, AzimRadius{ PI} },
+ { ElevRadius{ 0.0f}, AzimRadius{ -PI_4} },
+ { ElevRadius{ 0.0f}, AzimRadius{ PI_4} },
+ { ElevRadius{ 0.0f}, AzimRadius{-PI3_4} },
+ { ElevRadius{ 0.0f}, AzimRadius{ PI3_4} },
+ { ElevRadius{ CornerElev}, AzimRadius{ -PI_4} },
+ { ElevRadius{-CornerElev}, AzimRadius{ -PI_4} },
+ { ElevRadius{ CornerElev}, AzimRadius{ PI_4} },
+ { ElevRadius{-CornerElev}, AzimRadius{ PI_4} },
+ { ElevRadius{ CornerElev}, AzimRadius{-PI3_4} },
+ { ElevRadius{-CornerElev}, AzimRadius{-PI3_4} },
+ { ElevRadius{ CornerElev}, AzimRadius{ PI3_4} },
+ { ElevRadius{-CornerElev}, AzimRadius{ PI3_4} },
};
static const float AmbiMatrix[][MAX_AMBI_CHANNELS]{
{ 3.846153846e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.661733875e-02f, 0.000000000e+00f, 0.000000000e+00f, -4.969039950e-02f, 0.000000000e+00f, 8.606629658e-02f },