diff options
Diffstat (limited to 'Alc/effects/reverb.cpp')
-rw-r--r-- | Alc/effects/reverb.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp index 51d2d3a8..d65a642d 100644 --- a/Alc/effects/reverb.cpp +++ b/Alc/effects/reverb.cpp @@ -197,6 +197,7 @@ constexpr std::array<ALfloat,NUM_LINES> EARLY_LINE_LENGTHS{{ constexpr std::array<ALfloat,NUM_LINES> LATE_ALLPASS_LENGTHS{{ 1.6182800e-4f, 2.0389060e-4f, 2.8159360e-4f, 3.2365600e-4f }}; +constexpr auto LATE_ALLPASS_LENGTHS_size = LATE_ALLPASS_LENGTHS.size(); /* The late lines are used to approximate the decaying cycle of recursive * late reflections. @@ -216,6 +217,7 @@ constexpr std::array<ALfloat,NUM_LINES> LATE_ALLPASS_LENGTHS{{ constexpr std::array<ALfloat,NUM_LINES> LATE_LINE_LENGTHS{{ 1.9419362e-3f, 2.4466860e-3f, 3.3791220e-3f, 3.8838720e-3f }}; +constexpr auto LATE_LINE_LENGTHS_size = LATE_LINE_LENGTHS.size(); struct DelayLineI { @@ -512,7 +514,7 @@ bool ReverbState::allocLines(const ALfloat frequency) */ ALfloat length{AL_EAXREVERB_MAX_REFLECTIONS_DELAY + EARLY_TAP_LENGTHS.back()*multiplier + AL_EAXREVERB_MAX_LATE_REVERB_DELAY + - (LATE_LINE_LENGTHS.back() - LATE_LINE_LENGTHS.front())/float{LATE_LINE_LENGTHS.size()}*multiplier}; + (LATE_LINE_LENGTHS.back() - LATE_LINE_LENGTHS.front())/float{LATE_LINE_LENGTHS_size}*multiplier}; totalSamples += CalcLineLength(length, totalSamples, frequency, BUFFERSIZE, &mDelay); /* The early vector all-pass line. */ @@ -750,7 +752,7 @@ void LateReverb::updateLines(const ALfloat density, const ALfloat diffusion, const ALfloat late_allpass_avg{ std::accumulate(LATE_ALLPASS_LENGTHS.begin(), LATE_ALLPASS_LENGTHS.end(), 0.0f) / - float{LATE_ALLPASS_LENGTHS.size()}}; + float{LATE_ALLPASS_LENGTHS_size}}; /* To compensate for changes in modal density and decay time of the late * reverb signal, the input is attenuated based on the maximal energy of @@ -762,7 +764,7 @@ void LateReverb::updateLines(const ALfloat density, const ALfloat diffusion, */ const ALfloat multiplier{CalcDelayLengthMult(density)}; ALfloat length{std::accumulate(LATE_LINE_LENGTHS.begin(), LATE_LINE_LENGTHS.end(), 0.0f) / - float{LATE_LINE_LENGTHS.size()} * multiplier}; + float{LATE_LINE_LENGTHS_size} * multiplier}; length += late_allpass_avg * multiplier; /* The density gain calculation uses an average decay time weighted by * approximate bandwidth. This attempts to compensate for losses of energy @@ -832,7 +834,7 @@ void ReverbState::updateDelayLine(const ALfloat earlyDelay, const ALfloat lateDe mEarlyDelayCoeff[i][1] = CalcDecayCoeff(length, decayTime); length = lateDelay + (LATE_LINE_LENGTHS[i] - LATE_LINE_LENGTHS.front()) / - float{LATE_LINE_LENGTHS.size()} * multiplier; + float{LATE_LINE_LENGTHS_size} * multiplier; mLateDelayTap[i][1] = mLateFeedTap + float2int(length * frequency); } } |