diff options
author | Chris Robinson <[email protected]> | 2020-08-28 06:47:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-08-28 06:47:21 -0700 |
commit | ecfb0d4f5b6408c6def696e73babc42ce61470f7 (patch) | |
tree | d83781634e501eab3a75ca9c929e6edd55521450 | |
parent | 7266cd8b6c3a1f515d1bdb4c91e49e6994f72951 (diff) |
Limit convolution processing to the output ambisonic order
-rw-r--r-- | alc/effects/convolution.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/alc/effects/convolution.cpp b/alc/effects/convolution.cpp index 2700cb6e..68becf49 100644 --- a/alc/effects/convolution.cpp +++ b/alc/effects/convolution.cpp @@ -275,7 +275,9 @@ void ConvolutionState::update(const ALCcontext *context, const ALeffectslot *slo mFilter = static_cast<ConvolutionFilter*>(slot->Params.mEffectBuffer); if(!mFilter) return; - mNumChannels = mFilter ? ChannelsFromFmt(mFilter->mChannels, mFilter->mAmbiOrder) : 0u; + ALCdevice *device{context->mDevice.get()}; + const ALuint min_order{minu(mFilter->mAmbiOrder, device->mAmbiOrder)}; + mNumChannels = mFilter ? ChannelsFromFmt(mFilter->mChannels, min_order) : 0u; mMix = &ConvolutionState::NormalMix; /* The iFFT'd response is scaled up by the number of bins, so apply the @@ -285,7 +287,6 @@ void ConvolutionState::update(const ALCcontext *context, const ALeffectslot *slo const float gain{slot->Params.Gain * (1.0f/m)}; if(mFilter->mChannels == FmtBFormat3D || mFilter->mChannels == FmtBFormat2D) { - ALCdevice *device{context->mDevice.get()}; if(device->mAmbiOrder > mFilter->mAmbiOrder) { mMix = &ConvolutionState::UpsampleMix; |