diff options
-rw-r--r-- | alc/alu.cpp | 10 | ||||
-rw-r--r-- | alc/effects/convolution.cpp | 2 | ||||
-rw-r--r-- | core/buffer_storage.h | 6 | ||||
-rw-r--r-- | core/voice.cpp | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index 693288df..93e18c94 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -777,11 +777,9 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con } voice->mFlags &= ~(VoiceHasHrtf | VoiceHasNfc); - if(voice->mFmtChannels == FmtBFormat2D || voice->mFmtChannels == FmtBFormat3D - || voice->mFmtChannels == FmtUHJ2 || voice->mFmtChannels == FmtUHJ3 - || voice->mFmtChannels == FmtUHJ4 || voice->mFmtChannels == FmtSuperStereo) + if(IsAmbisonic(voice->mFmtChannels)) { - /* Special handling for B-Format sources. */ + /* Special handling for B-Format and UHJ sources. */ if(Device->AvgSpeakerDist > 0.0f && voice->mFmtChannels != FmtUHJ2 && voice->mFmtChannels != FmtSuperStereo) @@ -883,9 +881,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con /* Convert the rotation matrix for input ordering and scaling, and * whether input is 2D or 3D. */ - const uint8_t *index_map{ - (voice->mFmtChannels == FmtBFormat2D || voice->mFmtChannels == FmtUHJ2 - || voice->mFmtChannels == FmtUHJ3 || voice->mFmtChannels == FmtSuperStereo) ? + const uint8_t *index_map{Is2DAmbisonic(voice->mFmtChannels) ? GetAmbi2DLayout(voice->mAmbiLayout).data() : GetAmbiLayout(voice->mAmbiLayout).data()}; diff --git a/alc/effects/convolution.cpp b/alc/effects/convolution.cpp index a1d49be4..5724badb 100644 --- a/alc/effects/convolution.cpp +++ b/alc/effects/convolution.cpp @@ -410,7 +410,7 @@ void ConvolutionState::update(const ContextBase *context, const EffectSlot *slot (*mChans)[0].Target[lidx] = gain; (*mChans)[1].Target[ridx] = gain; } - else if(mChannels == FmtBFormat3D || mChannels == FmtBFormat2D) + else if(IsBFormat(mChannels)) { DeviceBase *device{context->mDevice}; if(device->mAmbiOrder > mAmbiOrder) diff --git a/core/buffer_storage.h b/core/buffer_storage.h index 091882f9..cde7704e 100644 --- a/core/buffer_storage.h +++ b/core/buffer_storage.h @@ -66,6 +66,12 @@ constexpr bool IsUHJ(FmtChannels chans) noexcept constexpr bool IsAmbisonic(FmtChannels chans) noexcept { return IsBFormat(chans) || IsUHJ(chans); } +constexpr bool Is2DAmbisonic(FmtChannels chans) noexcept +{ + return chans == FmtBFormat2D || chans == FmtUHJ2 || chans == FmtUHJ3 + || chans == FmtSuperStereo; +} + using CallbackType = int(*)(void*, void*, int); diff --git a/core/voice.cpp b/core/voice.cpp index f7a5940a..44ba897a 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -839,9 +839,7 @@ void Voice::prepare(DeviceBase *device) */ if(mAmbiOrder && device->mAmbiOrder > mAmbiOrder) { - const uint8_t *OrderFromChan{(mFmtChannels == FmtBFormat2D - || mFmtChannels == FmtUHJ2 || mFmtChannels == FmtUHJ3 - || mFmtChannels == FmtSuperStereo) ? + const uint8_t *OrderFromChan{Is2DAmbisonic(mFmtChannels) ? AmbiIndex::OrderFrom2DChannel().data() : AmbiIndex::OrderFromChannel().data()}; const auto scales = AmbiScale::GetHFOrderScales(mAmbiOrder, device->mAmbiOrder); |