diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2022-09-04 09:09:12 -0700 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2022-09-04 09:09:12 -0700 |
commit | 14bb4ad1b7a0126fe5dfdd2e62bea750ce12d961 (patch) | |
tree | e7b9ec6f392ffed2a71a92f7f2ab9a6a7141b679 /core/ambidefs.cpp | |
parent | f2ff2bb2f6f2f9190210b60833b4232fe5398b07 (diff) |
Allow different HF scales for 2D mixing/output
Not actually used yet, the device needs to track whether it's using 2D or 3D
mixing.
Diffstat (limited to 'core/ambidefs.cpp')
-rw-r--r-- | core/ambidefs.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/core/ambidefs.cpp b/core/ambidefs.cpp index 49b2d144..819ba9a6 100644 --- a/core/ambidefs.cpp +++ b/core/ambidefs.cpp @@ -29,6 +29,18 @@ constexpr std::array<std::array<float,MaxAmbiOrder+1>,MaxAmbiOrder+1> HFScales{{ /* 1.947005434e+00f, 1.764337084e+00f, 1.424707344e+00f, 9.755104127e-01f, 4.784482742e-01f */ }}; +/* Same as above, but using a 10-point horizontal-only speaker array. Should + * only be used when the device is mixing in 2D B-Format for horizontal-only + * output. + */ +constexpr std::array<std::array<float,MaxAmbiOrder+1>,MaxAmbiOrder+1> HFScales2D{{ + {{ 2.236067977e+00f, 1.581138830e+00f, 9.128709292e-01f, 6.050756345e-01f }}, + {{ 2.236067977e+00f, 1.581138830e+00f, 9.128709292e-01f, 6.050756345e-01f }}, + {{ 1.825741858e+00f, 1.581138830e+00f, 9.128709292e-01f, 6.050756345e-01f }}, + {{ 1.581138830e+00f, 1.460781803e+00f, 1.118033989e+00f, 6.050756345e-01f }}, + /* 1.414213562e+00f, 1.344997024e+00f, 1.144122806e+00f, 8.312538756e-01f, 4.370160244e-01f */ +}}; + constexpr std::array<std::array<float,4>,8> FirstOrderDecoder{{ {{ 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, 1.250000000e-01f, }}, @@ -385,12 +397,20 @@ const std::array<AmbiChannelFloatArray,25> AmbiScale::FourthOrder2DUp{CalcFourth std::array<float,MaxAmbiOrder+1> AmbiScale::GetHFOrderScales(const uint src_order, - const uint dev_order) noexcept + const uint dev_order, const bool horizontalOnly) noexcept { std::array<float,MaxAmbiOrder+1> res{}; - for(size_t i{0};i < MaxAmbiOrder+1;++i) - res[i] = HFScales[src_order][i] / HFScales[dev_order][i]; + if(!horizontalOnly) + { + for(size_t i{0};i < MaxAmbiOrder+1;++i) + res[i] = HFScales[src_order][i] / HFScales[dev_order][i]; + } + else + { + for(size_t i{0};i < MaxAmbiOrder+1;++i) + res[i] = HFScales2D[src_order][i] / HFScales2D[dev_order][i]; + } return res; } |