diff options
author | Chris Robinson <[email protected]> | 2019-02-19 22:55:43 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-02-19 22:55:43 -0800 |
commit | 77ba61ecb3973dab4fff5fdc8bc237a6f4cd0056 (patch) | |
tree | 1f9a9d223b25c3418fce2185b5729203190a05e2 | |
parent | 87902fa3b21b5bba22a9d8cddabb9ce3e1303c94 (diff) |
Partially handle non-periphonic reverb input
-rw-r--r-- | Alc/effects/reverb.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp index 11e3e56c..764fd376 100644 --- a/Alc/effects/reverb.cpp +++ b/Alc/effects/reverb.cpp @@ -297,6 +297,9 @@ struct ReverbState final : public EffectState { ALfloat LFReference{AL_EAXREVERB_DEFAULT_LFREFERENCE}; } mParams; + ALsizei mNumInputs{0}; /* 3 or 4 */ + ALfloat mInputConv[NUM_LINES][4/*NumInputs*/]; + /* Master effect filters */ struct { BiquadFilter Lp; @@ -467,6 +470,28 @@ ALboolean ReverbState::deviceUpdate(const ALCdevice *Device) EARLY_TAP_LENGTHS[NUM_LINES-1]*multiplier) * frequency); + mNumInputs = 4; + if(mNumInputs == 3) + { + for(ALsizei i{0};i < NUM_LINES;++i) + { + mInputConv[i][0] = B2A[i][0]; + mInputConv[i][1] = B2A[i][1]; + mInputConv[i][2] = B2A[i][3]; + mInputConv[i][3] = 0.0f; + } + } + else + { + for(ALsizei i{0};i < NUM_LINES;++i) + { + mInputConv[i][0] = B2A[i][0]; + mInputConv[i][1] = B2A[i][1]; + mInputConv[i][2] = B2A[i][2]; + mInputConv[i][3] = B2A[i][3]; + } + } + /* Clear filters and gain coefficients since the delay lines were all just * cleared (if not reallocated). */ @@ -1321,9 +1346,7 @@ void ReverbState::process(ALsizei SamplesToDo, const ALfloat (*RESTRICT SamplesI for(ALsizei c{0};c < NUM_LINES;c++) { std::fill(std::begin(afmt[c]), std::end(afmt[c]), 0.0f); - MixRowSamples(afmt[c], B2A[c].data(), - SamplesIn, MAX_EFFECT_CHANNELS, base, todo - ); + MixRowSamples(afmt[c], mInputConv[c], SamplesIn, mNumInputs, base, todo); } /* Process the samples for reverb. */ |