From 030d428aec2389f65336eef28076c55914e34d00 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 14 Jan 2020 13:10:01 -0800 Subject: Clean up some formating --- alc/bformatdec.cpp | 34 ++++++++++++++++++---------------- alc/bformatdec.h | 2 +- 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'alc') diff --git a/alc/bformatdec.cpp b/alc/bformatdec.cpp index d8f59ddc..0272139d 100644 --- a/alc/bformatdec.cpp +++ b/alc/bformatdec.cpp @@ -21,24 +21,25 @@ namespace { -constexpr ALfloat Ambi3DDecoderHFScale[MAX_AMBI_ORDER+1] = { +constexpr std::array Ambi3DDecoderHFScale{{ 1.00000000e+00f, 1.00000000e+00f -}; -constexpr ALfloat Ambi3DDecoderHFScale2O[MAX_AMBI_ORDER+1] = { - 7.45355990e-01f, 1.00000000e+00f -}; -constexpr ALfloat Ambi3DDecoderHFScale3O[MAX_AMBI_ORDER+1] = { - 5.89792205e-01f, 8.79693856e-01f -}; - -inline auto GetDecoderHFScales(ALuint order) noexcept -> const ALfloat(&)[MAX_AMBI_ORDER+1] +}}; +constexpr std::array Ambi3DDecoderHFScale2O{{ + 7.45355990e-01f, 1.00000000e+00f, 1.00000000e+00f +}}; +constexpr std::array Ambi3DDecoderHFScale3O{{ + 5.89792205e-01f, 8.79693856e-01f, 1.00000000e+00f, 1.00000000e+00f +}}; + +inline auto GetDecoderHFScales(ALuint order) noexcept -> const std::array& { if(order >= 3) return Ambi3DDecoderHFScale3O; if(order == 2) return Ambi3DDecoderHFScale2O; return Ambi3DDecoderHFScale; } -inline auto GetAmbiScales(AmbDecScale scaletype) noexcept -> const std::array& +inline auto GetAmbiScales(AmbDecScale scaletype) noexcept + -> const std::array& { if(scaletype == AmbDecScale::FuMa) return AmbiScale::FromFuMa; if(scaletype == AmbDecScale::SN3D) return AmbiScale::FromSN3D; @@ -175,16 +176,17 @@ void BFormatDec::process(const al::span OutBuffer, } -std::array BFormatDec::GetHFOrderScales(const ALuint in_order, const ALuint out_order) noexcept +auto BFormatDec::GetHFOrderScales(const ALuint in_order, const ALuint out_order) noexcept + -> std::array { - std::array ret{}; + std::array ret{}; assert(out_order >= in_order); - const ALfloat (&target)[MAX_AMBI_ORDER+1] = GetDecoderHFScales(out_order); - const ALfloat (&input)[MAX_AMBI_ORDER+1] = GetDecoderHFScales(in_order); + const auto &target = GetDecoderHFScales(out_order); + const auto &input = GetDecoderHFScales(in_order); - for(ALuint i{0};i < in_order+1;++i) + for(size_t i{0};i < in_order+1;++i) ret[i] = input[i] / target[i]; return ret; diff --git a/alc/bformatdec.h b/alc/bformatdec.h index b4649108..bf48a05f 100644 --- a/alc/bformatdec.h +++ b/alc/bformatdec.h @@ -52,7 +52,7 @@ public: const size_t SamplesToDo); /* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */ - static std::array GetHFOrderScales(const ALuint in_order, + static std::array GetHFOrderScales(const ALuint in_order, const ALuint out_order) noexcept; DEF_NEWDEL(BFormatDec) -- cgit v1.2.3