aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alc/panning.cpp110
1 files changed, 56 insertions, 54 deletions
diff --git a/alc/panning.cpp b/alc/panning.cpp
index 1288197d..56b8cc77 100644
--- a/alc/panning.cpp
+++ b/alc/panning.cpp
@@ -522,66 +522,68 @@ void InitCustomPanning(ALCdevice *device, bool hqdec, const AmbDecConf *conf,
void InitHrtfPanning(ALCdevice *device)
{
+ constexpr float PI{al::MathDefs<float>::Pi()};
+ const float CornerElev{static_cast<float>(std::atan2(1.0, std::sqrt(2.0)))};
static const AngularPoint AmbiPoints[]{
- { Deg2Rad( 0.000000f), Deg2Rad( 0.000000f) },
- { Deg2Rad( 0.000000f), Deg2Rad( 180.000000f) },
- { Deg2Rad( 0.000000f), Deg2Rad( -90.000000f) },
- { Deg2Rad( 0.000000f), Deg2Rad( 90.000000f) },
- { Deg2Rad( 90.000000f), Deg2Rad( 0.000000f) },
- { Deg2Rad(-90.000000f), Deg2Rad( 0.000000f) },
- { Deg2Rad( 45.000000f), Deg2Rad( -90.000000f) },
- { Deg2Rad(-45.000000f), Deg2Rad( -90.000000f) },
- { Deg2Rad( 45.000000f), Deg2Rad( 90.000000f) },
- { Deg2Rad(-45.000000f), Deg2Rad( 90.000000f) },
- { Deg2Rad( 45.000000f), Deg2Rad( 0.000000f) },
- { Deg2Rad(-45.000000f), Deg2Rad( 0.000000f) },
- { Deg2Rad( 45.000000f), Deg2Rad( 180.000000f) },
- { Deg2Rad(-45.000000f), Deg2Rad( 180.000000f) },
- { Deg2Rad( 0.000000f), Deg2Rad( -45.000000f) },
- { Deg2Rad( 0.000000f), Deg2Rad( 45.000000f) },
- { Deg2Rad( 0.000000f), Deg2Rad(-135.000000f) },
- { Deg2Rad( 0.000000f), Deg2Rad( 135.000000f) },
- { Deg2Rad( 35.264390f), Deg2Rad( -45.000000f) },
- { Deg2Rad(-35.264390f), Deg2Rad( -45.000000f) },
- { Deg2Rad( 35.264390f), Deg2Rad( 45.000000f) },
- { Deg2Rad(-35.264390f), Deg2Rad( 45.000000f) },
- { Deg2Rad( 35.264390f), Deg2Rad(-135.000000f) },
- { Deg2Rad(-35.264390f), Deg2Rad(-135.000000f) },
- { Deg2Rad( 35.264390f), Deg2Rad( 135.000000f) },
- { Deg2Rad(-35.264390f), Deg2Rad( 135.000000f) },
+ { 0.0f, 0.0f },
+ { 0.0f, PI },
+ { 0.0f, -PI/2.0f },
+ { 0.0f, PI/2.0f },
+ { PI/2.0f, 0.0f },
+ { -PI/2.0f, 0.0f },
+ { PI/4.0f, -PI/2.0f },
+ { -PI/4.0f, -PI/2.0f },
+ { PI/4.0f, PI/2.0f },
+ { -PI/4.0f, PI/2.0f },
+ { PI/4.0f, 0.0f },
+ { -PI/4.0f, 0.0f },
+ { PI/4.0f, PI },
+ { -PI/4.0f, PI },
+ { 0.0f, -PI/4.0f },
+ { 0.0f, PI/4.0f },
+ { 0.0f, -PI*3.0f/4.0f },
+ { 0.0f, PI*3.0f/4.0f },
+ { CornerElev, -PI/4.0f },
+ { -CornerElev, -PI/4.0f },
+ { CornerElev, PI/4.0f },
+ { -CornerElev, PI/4.0f },
+ { CornerElev, -PI*3.0f/4.0f },
+ { -CornerElev, -PI*3.0f/4.0f },
+ { CornerElev, PI*3.0f/4.0f },
+ { -CornerElev, PI*3.0f/4.0f },
};
static const float AmbiMatrix[][MAX_AMBI_CHANNELS]{
- { 3.84615387e-02f, 0.00000000e+00f, 0.00000000e+00f, 6.66173389e-02f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 8.60662966e-02f },
- { 3.84615387e-02f, 0.00000000e+00f, 0.00000000e+00f, -6.66173389e-02f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 8.60662966e-02f },
- { 3.84615387e-02f, 6.66173389e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, -8.60662966e-02f },
- { 3.84615387e-02f, -6.66173389e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, -8.60662966e-02f },
- { 3.84615379e-02f, 0.00000000e+00f, 6.66173384e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 9.93807988e-02f, 0.00000000e+00f, 0.00000000e+00f },
- { 3.84615379e-02f, 0.00000000e+00f, -6.66173384e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 9.93807988e-02f, 0.00000000e+00f, 0.00000000e+00f },
- { 3.84615383e-02f, 4.71055721e-02f, 4.71055717e-02f, 0.00000000e+00f, 0.00000000e+00f, 6.83467647e-02f, 2.48451995e-02f, 0.00000000e+00f, -4.30331483e-02f },
- { 3.84615383e-02f, 4.71055721e-02f, -4.71055717e-02f, 0.00000000e+00f, 0.00000000e+00f, -6.83467647e-02f, 2.48451995e-02f, 0.00000000e+00f, -4.30331483e-02f },
- { 3.84615383e-02f, -4.71055721e-02f, 4.71055717e-02f, 0.00000000e+00f, 0.00000000e+00f, -6.83467647e-02f, 2.48451995e-02f, 0.00000000e+00f, -4.30331483e-02f },
- { 3.84615383e-02f, -4.71055721e-02f, -4.71055717e-02f, 0.00000000e+00f, 0.00000000e+00f, 6.83467647e-02f, 2.48451995e-02f, 0.00000000e+00f, -4.30331483e-02f },
- { 3.84615383e-02f, 0.00000000e+00f, 4.71055717e-02f, 4.71055721e-02f, 0.00000000e+00f, 0.00000000e+00f, 2.48451995e-02f, 6.83467647e-02f, 4.30331483e-02f },
- { 3.84615383e-02f, 0.00000000e+00f, -4.71055717e-02f, 4.71055721e-02f, 0.00000000e+00f, 0.00000000e+00f, 2.48451995e-02f, -6.83467647e-02f, 4.30331483e-02f },
- { 3.84615383e-02f, 0.00000000e+00f, 4.71055717e-02f, -4.71055721e-02f, 0.00000000e+00f, 0.00000000e+00f, 2.48451995e-02f, -6.83467647e-02f, 4.30331483e-02f },
- { 3.84615383e-02f, 0.00000000e+00f, -4.71055717e-02f, -4.71055721e-02f, 0.00000000e+00f, 0.00000000e+00f, 2.48451995e-02f, 6.83467647e-02f, 4.30331483e-02f },
- { 3.84615387e-02f, 4.71055721e-02f, 0.00000000e+00f, 4.71055721e-02f, 6.83467654e-02f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 0.00000000e+00f },
- { 3.84615387e-02f, -4.71055721e-02f, 0.00000000e+00f, 4.71055721e-02f, -6.83467654e-02f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 0.00000000e+00f },
- { 3.84615387e-02f, 4.71055721e-02f, 0.00000000e+00f, -4.71055721e-02f, -6.83467654e-02f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 0.00000000e+00f },
- { 3.84615387e-02f, -4.71055721e-02f, 0.00000000e+00f, -4.71055721e-02f, 6.83467654e-02f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 0.00000000e+00f },
- { 3.84615385e-02f, 3.84615384e-02f, 3.84615386e-02f, 3.84615384e-02f, 4.55645099e-02f, 4.55645100e-02f, 0.00000000e+00f, 4.55645100e-02f, 0.00000000e+00f },
- { 3.84615385e-02f, 3.84615384e-02f, -3.84615386e-02f, 3.84615384e-02f, 4.55645099e-02f, -4.55645100e-02f, 0.00000000e+00f, -4.55645100e-02f, 0.00000000e+00f },
- { 3.84615385e-02f, -3.84615384e-02f, 3.84615386e-02f, 3.84615384e-02f, -4.55645099e-02f, -4.55645100e-02f, 0.00000000e+00f, 4.55645100e-02f, 0.00000000e+00f },
- { 3.84615385e-02f, -3.84615384e-02f, -3.84615386e-02f, 3.84615384e-02f, -4.55645099e-02f, 4.55645100e-02f, 0.00000000e+00f, -4.55645100e-02f, 0.00000000e+00f },
- { 3.84615385e-02f, 3.84615384e-02f, 3.84615386e-02f, -3.84615384e-02f, -4.55645099e-02f, 4.55645100e-02f, 0.00000000e+00f, -4.55645100e-02f, 0.00000000e+00f },
- { 3.84615385e-02f, 3.84615384e-02f, -3.84615386e-02f, -3.84615384e-02f, -4.55645099e-02f, -4.55645100e-02f, 0.00000000e+00f, 4.55645100e-02f, 0.00000000e+00f },
- { 3.84615385e-02f, -3.84615384e-02f, 3.84615386e-02f, -3.84615384e-02f, 4.55645099e-02f, -4.55645100e-02f, 0.00000000e+00f, -4.55645100e-02f, 0.00000000e+00f },
- { 3.84615385e-02f, -3.84615384e-02f, -3.84615386e-02f, -3.84615384e-02f, 4.55645099e-02f, 4.55645100e-02f, 0.00000000e+00f, 4.55645100e-02f, 0.00000000e+00f },
+ { 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 },
+ { 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 },
+ { 3.846153846e-02f, 6.661733875e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -4.969039950e-02f, 0.000000000e+00f, -8.606629658e-02f },
+ { 3.846153846e-02f, -6.661733875e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, -4.969039950e-02f, 0.000000000e+00f, -8.606629658e-02f },
+ { 3.846153846e-02f, 0.000000000e+00f, 6.661733875e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 9.938079900e-02f, 0.000000000e+00f, 0.000000000e+00f },
+ { 3.846153846e-02f, 0.000000000e+00f, -6.661733875e-02f, 0.000000000e+00f, 0.000000000e+00f, 0.000000000e+00f, 9.938079900e-02f, 0.000000000e+00f, 0.000000000e+00f },
+ { 3.846153846e-02f, 4.710557198e-02f, 4.710557198e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.834676493e-02f, 2.484519975e-02f, 0.000000000e+00f, -4.303314829e-02f },
+ { 3.846153846e-02f, 4.710557198e-02f, -4.710557198e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.834676493e-02f, 2.484519975e-02f, 0.000000000e+00f, -4.303314829e-02f },
+ { 3.846153846e-02f, -4.710557198e-02f, 4.710557198e-02f, 0.000000000e+00f, 0.000000000e+00f, -6.834676493e-02f, 2.484519975e-02f, 0.000000000e+00f, -4.303314829e-02f },
+ { 3.846153846e-02f, -4.710557198e-02f, -4.710557198e-02f, 0.000000000e+00f, 0.000000000e+00f, 6.834676493e-02f, 2.484519975e-02f, 0.000000000e+00f, -4.303314829e-02f },
+ { 3.846153846e-02f, 0.000000000e+00f, 4.710557198e-02f, 4.710557198e-02f, 0.000000000e+00f, 0.000000000e+00f, 2.484519975e-02f, 6.834676493e-02f, 4.303314829e-02f },
+ { 3.846153846e-02f, 0.000000000e+00f, -4.710557198e-02f, 4.710557198e-02f, 0.000000000e+00f, 0.000000000e+00f, 2.484519975e-02f, -6.834676493e-02f, 4.303314829e-02f },
+ { 3.846153846e-02f, 0.000000000e+00f, 4.710557198e-02f, -4.710557198e-02f, 0.000000000e+00f, 0.000000000e+00f, 2.484519975e-02f, -6.834676493e-02f, 4.303314829e-02f },
+ { 3.846153846e-02f, 0.000000000e+00f, -4.710557198e-02f, -4.710557198e-02f, 0.000000000e+00f, 0.000000000e+00f, 2.484519975e-02f, 6.834676493e-02f, 4.303314829e-02f },
+ { 3.846153846e-02f, 4.710557198e-02f, 0.000000000e+00f, 4.710557198e-02f, 6.834676493e-02f, 0.000000000e+00f, -4.969039950e-02f, 0.000000000e+00f, 0.000000000e+00f },
+ { 3.846153846e-02f, -4.710557198e-02f, 0.000000000e+00f, 4.710557198e-02f, -6.834676493e-02f, 0.000000000e+00f, -4.969039950e-02f, 0.000000000e+00f, 0.000000000e+00f },
+ { 3.846153846e-02f, 4.710557198e-02f, 0.000000000e+00f, -4.710557198e-02f, -6.834676493e-02f, 0.000000000e+00f, -4.969039950e-02f, 0.000000000e+00f, 0.000000000e+00f },
+ { 3.846153846e-02f, -4.710557198e-02f, 0.000000000e+00f, -4.710557198e-02f, 6.834676493e-02f, 0.000000000e+00f, -4.969039950e-02f, 0.000000000e+00f, 0.000000000e+00f },
+ { 3.846153846e-02f, 3.846153846e-02f, 3.846153846e-02f, 3.846153846e-02f, 4.556450996e-02f, 4.556450996e-02f, 0.000000000e+00f, 4.556450996e-02f, 0.000000000e+00f },
+ { 3.846153846e-02f, 3.846153846e-02f, -3.846153846e-02f, 3.846153846e-02f, 4.556450996e-02f, -4.556450996e-02f, 0.000000000e+00f, -4.556450996e-02f, 0.000000000e+00f },
+ { 3.846153846e-02f, -3.846153846e-02f, 3.846153846e-02f, 3.846153846e-02f, -4.556450996e-02f, -4.556450996e-02f, 0.000000000e+00f, 4.556450996e-02f, 0.000000000e+00f },
+ { 3.846153846e-02f, -3.846153846e-02f, -3.846153846e-02f, 3.846153846e-02f, -4.556450996e-02f, 4.556450996e-02f, 0.000000000e+00f, -4.556450996e-02f, 0.000000000e+00f },
+ { 3.846153846e-02f, 3.846153846e-02f, 3.846153846e-02f, -3.846153846e-02f, -4.556450996e-02f, 4.556450996e-02f, 0.000000000e+00f, -4.556450996e-02f, 0.000000000e+00f },
+ { 3.846153846e-02f, 3.846153846e-02f, -3.846153846e-02f, -3.846153846e-02f, -4.556450996e-02f, -4.556450996e-02f, 0.000000000e+00f, 4.556450996e-02f, 0.000000000e+00f },
+ { 3.846153846e-02f, -3.846153846e-02f, 3.846153846e-02f, -3.846153846e-02f, 4.556450996e-02f, -4.556450996e-02f, 0.000000000e+00f, -4.556450996e-02f, 0.000000000e+00f },
+ { 3.846153846e-02f, -3.846153846e-02f, -3.846153846e-02f, -3.846153846e-02f, 4.556450996e-02f, 4.556450996e-02f, 0.000000000e+00f, 4.556450996e-02f, 0.000000000e+00f },
};
static const float AmbiOrderHFGain1O[MAX_AMBI_ORDER+1]{
- 3.60555128e+00f, 2.08166600e+00f
+ 3.605551275e+00f, 2.081665999e+00f
}, AmbiOrderHFGain2O[MAX_AMBI_ORDER+1]{
- 2.68741925e+00f, 2.08166600e+00f, 1.07496770e+00f
+ 2.687419249e+00f, 2.081665999e+00f, 1.074967700e+00f
};
static const ALuint ChansPerOrder[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 };
const float *AmbiOrderHFGain{AmbiOrderHFGain1O};