From 16886bd2598f4547805f6f54e1155296abc3b05b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 17 Aug 2019 23:00:46 -0700 Subject: Avoid an out parameter for VectorPartialScatter --- alc/effects/reverb.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index e69da59d..c3ce26c9 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -1021,13 +1021,15 @@ void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, co * Where D is a diagonal matrix (of x), and S is a triangular matrix (of y) * whose combination of signs are being iterated. */ -inline void VectorPartialScatter(std::array &RESTRICT out, - const std::array &RESTRICT in, const ALfloat xCoeff, const ALfloat yCoeff) +inline auto VectorPartialScatter(const std::array &RESTRICT in, + const ALfloat xCoeff, const ALfloat yCoeff) -> std::array { + std::array out; out[0] = xCoeff*in[0] + yCoeff*( in[1] + -in[2] + in[3]); out[1] = xCoeff*in[1] + yCoeff*(-in[0] + in[2] + in[3]); out[2] = xCoeff*in[2] + yCoeff*( in[0] + -in[1] + in[3]); out[3] = xCoeff*in[3] + yCoeff*(-in[0] + -in[1] + -in[2] ); + return out; } /* Utilizes the above, but reverses the input channels. */ @@ -1048,7 +1050,7 @@ void VectorScatterRevDelayIn(const DelayLineI delay, ALint offset, const ALfloat f[NUM_LINES-1-j] = in[j][base+i]; ++i; - VectorPartialScatter(delay.Line[offset++], f, xCoeff, yCoeff); + delay.Line[offset++] = VectorPartialScatter(f, xCoeff, yCoeff); } while(--td); } } @@ -1097,7 +1099,7 @@ void VecAllpass::processUnfaded(const al::span sample } ++i; - VectorPartialScatter(delay.Line[offset++], f, xCoeff, yCoeff); + delay.Line[offset++] = VectorPartialScatter(f, xCoeff, yCoeff); } while(--td); } } @@ -1147,7 +1149,7 @@ void VecAllpass::processFaded(const al::span samples, } ++i; - VectorPartialScatter(delay.Line[offset++], f, xCoeff, yCoeff); + delay.Line[offset++] = VectorPartialScatter(f, xCoeff, yCoeff); } while(--td); } } -- cgit v1.2.3