diff options
author | Chris Robinson <[email protected]> | 2019-11-09 12:51:51 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-11-09 13:04:44 -0800 |
commit | 74cbba511d6b71634d07d44a822c826400fe967d (patch) | |
tree | c36d947d53dbdfdb96a977681cd173d97876592a | |
parent | 89938b95cf581e8c279b187d51048dd7c1bcd069 (diff) |
Limit HRTF ambisonic decoding to second-order
The generated third-order matrix has incorrect first-order coefficients,
indicating a wonky decoder. The generated second-order matrix looks more
stable.
-rw-r--r-- | alc/panning.cpp | 61 | ||||
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 12 |
2 files changed, 35 insertions, 38 deletions
diff --git a/alc/panning.cpp b/alc/panning.cpp index 832fc202..1288197d 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -551,39 +551,37 @@ void InitHrtfPanning(ALCdevice *device) { Deg2Rad(-35.264390f), Deg2Rad( 135.000000f) }, }; static const float AmbiMatrix[][MAX_AMBI_CHANNELS]{ - { 3.84615387e-02f, 0.00000000e+00f, 0.00000000e+00f, 8.33950391e-02f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 8.60662966e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -7.49473409e-02f, 0.00000000e+00f, 9.67566016e-02f }, - { 3.84615387e-02f, 0.00000000e+00f, 0.00000000e+00f, -8.33950391e-02f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 8.60662966e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 7.49473409e-02f, 0.00000000e+00f, -9.67566016e-02f }, - { 3.84615387e-02f, 8.33950391e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, -8.60662966e-02f, -9.67566016e-02f, 0.00000000e+00f, -7.49473409e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, - { 3.84615387e-02f, -8.33950391e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, -8.60662966e-02f, 9.67566016e-02f, 0.00000000e+00f, 7.49473409e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, - { 3.84615379e-02f, 0.00000000e+00f, 8.33950384e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 9.93807988e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 1.22388497e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, - { 3.84615379e-02f, 0.00000000e+00f, -8.33950384e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 9.93807988e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.22388497e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, - { 3.84615383e-02f, 4.53609209e-02f, 4.53609209e-02f, 0.00000000e+00f, 0.00000000e+00f, 6.83467647e-02f, 2.48451995e-02f, 0.00000000e+00f, -4.30331483e-02f, -3.21963528e-02f, 0.00000000e+00f, 6.23479680e-02f, -1.27267260e-02f, 0.00000000e+00f, -6.90065559e-02f, 0.00000000e+00f }, - { 3.84615383e-02f, 4.53609209e-02f, -4.53609209e-02f, 0.00000000e+00f, 0.00000000e+00f, -6.83467647e-02f, 2.48451995e-02f, 0.00000000e+00f, -4.30331483e-02f, -3.21963528e-02f, 0.00000000e+00f, 6.23479680e-02f, 1.27267260e-02f, 0.00000000e+00f, 6.90065559e-02f, 0.00000000e+00f }, - { 3.84615383e-02f, -4.53609209e-02f, 4.53609209e-02f, 0.00000000e+00f, 0.00000000e+00f, -6.83467647e-02f, 2.48451995e-02f, 0.00000000e+00f, -4.30331483e-02f, 3.21963528e-02f, 0.00000000e+00f, -6.23479680e-02f, -1.27267260e-02f, 0.00000000e+00f, -6.90065559e-02f, 0.00000000e+00f }, - { 3.84615383e-02f, -4.53609209e-02f, -4.53609209e-02f, 0.00000000e+00f, 0.00000000e+00f, 6.83467647e-02f, 2.48451995e-02f, 0.00000000e+00f, -4.30331483e-02f, 3.21963528e-02f, 0.00000000e+00f, -6.23479680e-02f, 1.27267260e-02f, 0.00000000e+00f, 6.90065559e-02f, 0.00000000e+00f }, - { 3.84615383e-02f, 0.00000000e+00f, 4.53609209e-02f, 4.53609209e-02f, 0.00000000e+00f, 0.00000000e+00f, 2.48451995e-02f, 6.83467647e-02f, 4.30331483e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.27267260e-02f, 6.23479680e-02f, 6.90065559e-02f, 3.21963528e-02f }, - { 3.84615383e-02f, 0.00000000e+00f, -4.53609209e-02f, 4.53609209e-02f, 0.00000000e+00f, 0.00000000e+00f, 2.48451995e-02f, -6.83467647e-02f, 4.30331483e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 1.27267260e-02f, 6.23479680e-02f, -6.90065559e-02f, 3.21963528e-02f }, - { 3.84615383e-02f, 0.00000000e+00f, 4.53609209e-02f, -4.53609209e-02f, 0.00000000e+00f, 0.00000000e+00f, 2.48451995e-02f, -6.83467647e-02f, 4.30331483e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.27267260e-02f, -6.23479680e-02f, 6.90065559e-02f, -3.21963528e-02f }, - { 3.84615383e-02f, 0.00000000e+00f, -4.53609209e-02f, -4.53609209e-02f, 0.00000000e+00f, 0.00000000e+00f, 2.48451995e-02f, 6.83467647e-02f, 4.30331483e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 1.27267260e-02f, -6.23479680e-02f, -6.90065559e-02f, -3.21963528e-02f }, - { 3.84615387e-02f, 4.53609217e-02f, 0.00000000e+00f, 4.53609217e-02f, 6.83467654e-02f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 0.00000000e+00f, 5.23190735e-02f, 0.00000000e+00f, -4.67609766e-02f, 0.00000000e+00f, -4.67609766e-02f, 0.00000000e+00f, -5.23190735e-02f }, - { 3.84615387e-02f, -4.53609217e-02f, 0.00000000e+00f, 4.53609217e-02f, -6.83467654e-02f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 0.00000000e+00f, -5.23190735e-02f, 0.00000000e+00f, 4.67609766e-02f, 0.00000000e+00f, -4.67609766e-02f, 0.00000000e+00f, -5.23190735e-02f }, - { 3.84615387e-02f, 4.53609217e-02f, 0.00000000e+00f, -4.53609217e-02f, -6.83467654e-02f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 0.00000000e+00f, 5.23190735e-02f, 0.00000000e+00f, -4.67609766e-02f, 0.00000000e+00f, 4.67609766e-02f, 0.00000000e+00f, 5.23190735e-02f }, - { 3.84615387e-02f, -4.53609217e-02f, 0.00000000e+00f, -4.53609217e-02f, 6.83467654e-02f, 0.00000000e+00f, -4.96903997e-02f, 0.00000000e+00f, 0.00000000e+00f, -5.23190735e-02f, 0.00000000e+00f, 4.67609766e-02f, 0.00000000e+00f, 4.67609766e-02f, 0.00000000e+00f, 5.23190735e-02f }, - { 3.84615385e-02f, 3.33333332e-02f, 3.33333335e-02f, 3.33333332e-02f, 4.55645099e-02f, 4.55645100e-02f, 0.00000000e+00f, 4.55645100e-02f, 0.00000000e+00f, 2.95742381e-02f, 6.33865691e-02f, 2.29081068e-02f, -3.74087810e-02f, 2.29081068e-02f, 0.00000000e+00f, -2.95742381e-02f }, - { 3.84615385e-02f, 3.33333332e-02f, -3.33333335e-02f, 3.33333332e-02f, 4.55645099e-02f, -4.55645100e-02f, 0.00000000e+00f, -4.55645100e-02f, 0.00000000e+00f, 2.95742381e-02f, -6.33865691e-02f, 2.29081068e-02f, 3.74087810e-02f, 2.29081068e-02f, 0.00000000e+00f, -2.95742381e-02f }, - { 3.84615385e-02f, -3.33333332e-02f, 3.33333335e-02f, 3.33333332e-02f, -4.55645099e-02f, -4.55645100e-02f, 0.00000000e+00f, 4.55645100e-02f, 0.00000000e+00f, -2.95742381e-02f, -6.33865691e-02f, -2.29081068e-02f, -3.74087810e-02f, 2.29081068e-02f, 0.00000000e+00f, -2.95742381e-02f }, - { 3.84615385e-02f, -3.33333332e-02f, -3.33333335e-02f, 3.33333332e-02f, -4.55645099e-02f, 4.55645100e-02f, 0.00000000e+00f, -4.55645100e-02f, 0.00000000e+00f, -2.95742381e-02f, 6.33865691e-02f, -2.29081068e-02f, 3.74087810e-02f, 2.29081068e-02f, 0.00000000e+00f, -2.95742381e-02f }, - { 3.84615385e-02f, 3.33333332e-02f, 3.33333335e-02f, -3.33333332e-02f, -4.55645099e-02f, 4.55645100e-02f, 0.00000000e+00f, -4.55645100e-02f, 0.00000000e+00f, 2.95742381e-02f, -6.33865691e-02f, 2.29081068e-02f, -3.74087810e-02f, -2.29081068e-02f, 0.00000000e+00f, 2.95742381e-02f }, - { 3.84615385e-02f, 3.33333332e-02f, -3.33333335e-02f, -3.33333332e-02f, -4.55645099e-02f, -4.55645100e-02f, 0.00000000e+00f, 4.55645100e-02f, 0.00000000e+00f, 2.95742381e-02f, 6.33865691e-02f, 2.29081068e-02f, 3.74087810e-02f, -2.29081068e-02f, 0.00000000e+00f, 2.95742381e-02f }, - { 3.84615385e-02f, -3.33333332e-02f, 3.33333335e-02f, -3.33333332e-02f, 4.55645099e-02f, -4.55645100e-02f, 0.00000000e+00f, -4.55645100e-02f, 0.00000000e+00f, -2.95742381e-02f, 6.33865691e-02f, -2.29081068e-02f, -3.74087810e-02f, -2.29081068e-02f, 0.00000000e+00f, 2.95742381e-02f }, - { 3.84615385e-02f, -3.33333332e-02f, -3.33333335e-02f, -3.33333332e-02f, 4.55645099e-02f, 4.55645100e-02f, 0.00000000e+00f, 4.55645100e-02f, 0.00000000e+00f, -2.95742381e-02f, -6.33865691e-02f, -2.29081068e-02f, 3.74087810e-02f, -2.29081068e-02f, 0.00000000e+00f, 2.95742381e-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, 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 }, }; static const float AmbiOrderHFGain1O[MAX_AMBI_ORDER+1]{ 3.60555128e+00f, 2.08166600e+00f }, AmbiOrderHFGain2O[MAX_AMBI_ORDER+1]{ 2.68741925e+00f, 2.08166600e+00f, 1.07496770e+00f - }, AmbiOrderHFGain3O[MAX_AMBI_ORDER+1]{ - 2.12652604e+00f, 1.83122879e+00f, 1.30214339e+00f, 6.48052398e-01f }; static const ALuint ChansPerOrder[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 }; const float *AmbiOrderHFGain{AmbiOrderHFGain1O}; @@ -606,11 +604,10 @@ void InitHrtfPanning(ALCdevice *device) { "full", HrtfRender, 1 }, { "ambi1", NormalRender, 1 }, { "ambi2", NormalRender, 2 }, - { "ambi3", NormalRender, 3 }, }; const char *mode{modeopt->c_str()}; - if(al::strcasecmp(mode, "basic") == 0) + if(al::strcasecmp(mode, "basic") == 0 || al::strcasecmp(mode, "ambi3") == 0) { ERR("HRTF mode \"%s\" deprecated, substituting \"%s\"\n", mode, "ambi2"); mode = "ambi2"; @@ -635,9 +632,7 @@ void InitHrtfPanning(ALCdevice *device) (device->mRenderMode == HrtfRender) ? "+ Full " : "", device->HrtfName.c_str()); - if(ambi_order >= 3) - AmbiOrderHFGain = AmbiOrderHFGain3O; - else if(ambi_order == 2) + if(ambi_order >= 2) AmbiOrderHFGain = AmbiOrderHFGain2O; else if(ambi_order == 1) AmbiOrderHFGain = AmbiOrderHFGain1O; diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index f4f5fd45..7b1d8a91 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -129,7 +129,6 @@ static const struct NameValuePair { }, hrtfModeList[] = { { "1st Order Ambisonic", "ambi1" }, { "2nd Order Ambisonic", "ambi2" }, - { "3rd Order Ambisonic", "ambi3" }, { "Default (Full)", "" }, { "Full", "full" }, @@ -742,10 +741,13 @@ void MainWindow::loadConfig(const QString &fname) ui->enableNeonCheckBox->setChecked(!disabledCpuExts.contains("neon", Qt::CaseInsensitive)); QString hrtfmode{settings.value("hrtf-mode").toString().trimmed()}; - ui->hrtfmodeSlider->setValue(3); - ui->hrtfmodeLabel->setText(hrtfModeList[3].name); - /* The "basic" mode name is no longer supported. Use "ambi2" instead. */ - if(hrtfmode == "basic") hrtfmode = "ambi2"; + ui->hrtfmodeSlider->setValue(2); + ui->hrtfmodeLabel->setText(hrtfModeList[2].name); + /* The "basic" mode name is no longer supported, and "ambi3" is temporarily + * disabled. Use "ambi2" instead. + */ + if(hrtfmode == "basic" || hrtfmode == "ambi3") + hrtfmode = "ambi2"; for(int i = 0;hrtfModeList[i].name[0];i++) { if(hrtfmode == hrtfModeList[i].value) |