diff options
-rw-r--r-- | alc/effects/convolution.cpp | 2 | ||||
-rw-r--r-- | alc/effects/reverb.cpp | 2 | ||||
-rw-r--r-- | core/ambidefs.cpp | 37 | ||||
-rw-r--r-- | core/ambidefs.h | 12 | ||||
-rw-r--r-- | core/voice.cpp | 2 |
5 files changed, 23 insertions, 32 deletions
diff --git a/alc/effects/convolution.cpp b/alc/effects/convolution.cpp index 196238fc..c0e796fd 100644 --- a/alc/effects/convolution.cpp +++ b/alc/effects/convolution.cpp @@ -420,7 +420,7 @@ void ConvolutionState::update(const ContextBase *context, const EffectSlot *slot if(device->mAmbiOrder > mAmbiOrder) { mMix = &ConvolutionState::UpsampleMix; - const auto scales = AmbiScale::GetHFOrderScales(mAmbiOrder, device->mAmbiOrder); + const auto scales = AmbiScale::GetHFOrderScales(mAmbiOrder); (*mChans)[0].mHfScale = scales[0]; for(size_t i{1};i < mChans->size();++i) (*mChans)[i].mHfScale = scales[1]; diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 7e90f692..3ef56206 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -696,7 +696,7 @@ void ReverbState::deviceUpdate(const DeviceBase *device, const Buffer&) if(device->mAmbiOrder > 1) { mUpmixOutput = true; - mOrderScales = AmbiScale::GetHFOrderScales(1, device->mAmbiOrder); + mOrderScales = AmbiScale::GetHFOrderScales(1); } else { diff --git a/core/ambidefs.cpp b/core/ambidefs.cpp index f5f4289e..22507c8a 100644 --- a/core/ambidefs.cpp +++ b/core/ambidefs.cpp @@ -13,25 +13,6 @@ namespace { using AmbiChannelFloatArray = std::array<float,MaxAmbiChannels>; -constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale10{{ - 2.000000000e+00f, 1.154700538e+00f -}}; -constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale2O{{ - 1.972026594e+00f, 1.527525232e+00f, 7.888106377e-01f -}}; -/* TODO: Set properly when making the third-order upsampler decoder. */ -constexpr std::array<float,MaxAmbiOrder+1> Ambi3DDecoderHFScale3O{{ - 1.000000000e+00f, 1.000000000e+00f, 1.000000000e+00f, 1.000000000e+00f -}}; - -inline auto& GetDecoderHFScales(uint order) noexcept -{ - if(order >= 3) return Ambi3DDecoderHFScale3O; - if(order == 2) return Ambi3DDecoderHFScale2O; - return Ambi3DDecoderHFScale10; -} - - /* Copied from mixer.cpp. */ constexpr auto CalcAmbiCoeffs(const float y, const float z, const float x) { @@ -195,11 +176,13 @@ const std::array<AmbiChannelFloatArray,4> AmbiScale::FirstOrderUp{CalcFirstOrder const std::array<AmbiChannelFloatArray,9> AmbiScale::SecondOrderUp{CalcSecondOrderUp()}; const std::array<AmbiChannelFloatArray,16> AmbiScale::ThirdOrderUp{CalcThirdOrderUp()}; - -auto AmbiScale::GetHFOrderScales(const uint in_order, const uint out_order) noexcept - -> std::array<float,MaxAmbiOrder+1> -{ - if(unlikely(in_order >= out_order)) - return {1.0f, 1.0f, 1.0f, 1.0f}; - return GetDecoderHFScales(in_order); -} +const std::array<float,MaxAmbiOrder+1> AmbiScale::DecoderHFScale10{{ + 2.000000000e+00f, 1.154700538e+00f +}}; +const std::array<float,MaxAmbiOrder+1> AmbiScale::DecoderHFScale2O{{ + 1.972026594e+00f, 1.527525232e+00f, 7.888106377e-01f +}}; +/* TODO: Set properly when making the third-order upsampler decoder. */ +const std::array<float,MaxAmbiOrder+1> AmbiScale::DecoderHFScale3O{{ + 1.000000000e+00f, 1.000000000e+00f, 1.000000000e+00f, 1.000000000e+00f +}}; diff --git a/core/ambidefs.h b/core/ambidefs.h index 57b847bf..80383450 100644 --- a/core/ambidefs.h +++ b/core/ambidefs.h @@ -111,8 +111,16 @@ struct AmbiScale { } /* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */ - static std::array<float,MaxAmbiOrder+1> GetHFOrderScales(const uint in_order, - const uint out_order) noexcept; + static std::array<float,MaxAmbiOrder+1> GetHFOrderScales(const uint order) noexcept + { + if(order >= 3) return DecoderHFScale3O; + if(order == 2) return DecoderHFScale2O; + return DecoderHFScale10; + } + + static const std::array<float,MaxAmbiOrder+1> DecoderHFScale10; + static const std::array<float,MaxAmbiOrder+1> DecoderHFScale2O; + static const std::array<float,MaxAmbiOrder+1> DecoderHFScale3O; static const std::array<std::array<float,MaxAmbiChannels>,4> FirstOrderUp; static const std::array<std::array<float,MaxAmbiChannels>,9> SecondOrderUp; diff --git a/core/voice.cpp b/core/voice.cpp index 4030fc5b..bda4a113 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -899,7 +899,7 @@ void Voice::prepare(DeviceBase *device) { const uint8_t *OrderFromChan{Is2DAmbisonic(mFmtChannels) ? AmbiIndex::OrderFrom2DChannel().data() : AmbiIndex::OrderFromChannel().data()}; - const auto scales = AmbiScale::GetHFOrderScales(mAmbiOrder, device->mAmbiOrder); + const auto scales = AmbiScale::GetHFOrderScales(mAmbiOrder); const BandSplitter splitter{device->mXOverFreq / static_cast<float>(device->Frequency)}; for(auto &chandata : mChans) |