Define the CoreAudio default name only when needed
[openal-soft.git] / core / ambidefs.cpp
blob2725748e608fa2fe2c7bc2790eb1328cd33f9cba
2 #include "config.h"
4 #include "ambidefs.h"
6 #include <cassert>
9 namespace {
11 constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale{{
12 1.00000000e+00f, 1.00000000e+00f
13 }};
14 constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale2O{{
15 7.45355990e-01f, 1.00000000e+00f, 1.00000000e+00f
16 }};
17 constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale3O{{
18 5.89792205e-01f, 8.79693856e-01f, 1.00000000e+00f, 1.00000000e+00f
19 }};
21 inline auto& GetDecoderHFScales(uint order) noexcept
23 if(order >= 3) return Ambi3DDecoderHFScale3O;
24 if(order == 2) return Ambi3DDecoderHFScale2O;
25 return Ambi3DDecoderHFScale;
28 } // namespace
30 auto AmbiScale::GetHFOrderScales(const uint in_order, const uint out_order) noexcept
31 -> std::array<float,MaxAmbiOrder+1>
33 std::array<float,MaxAmbiOrder+1> ret{};
35 assert(out_order >= in_order);
37 const auto &target = GetDecoderHFScales(out_order);
38 const auto &input = GetDecoderHFScales(in_order);
40 for(size_t i{0};i < in_order+1;++i)
41 ret[i] = input[i] / target[i];
43 return ret;