Ensure a couple calls are constexpr
This commit is contained in:
parent
01f717ae59
commit
b0e12ccf71
@ -197,6 +197,7 @@ constexpr std::array<ALfloat,NUM_LINES> EARLY_LINE_LENGTHS{{
|
|||||||
constexpr std::array<ALfloat,NUM_LINES> LATE_ALLPASS_LENGTHS{{
|
constexpr std::array<ALfloat,NUM_LINES> LATE_ALLPASS_LENGTHS{{
|
||||||
1.6182800e-4f, 2.0389060e-4f, 2.8159360e-4f, 3.2365600e-4f
|
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
|
/* The late lines are used to approximate the decaying cycle of recursive
|
||||||
* late reflections.
|
* late reflections.
|
||||||
@ -216,6 +217,7 @@ constexpr std::array<ALfloat,NUM_LINES> LATE_ALLPASS_LENGTHS{{
|
|||||||
constexpr std::array<ALfloat,NUM_LINES> LATE_LINE_LENGTHS{{
|
constexpr std::array<ALfloat,NUM_LINES> LATE_LINE_LENGTHS{{
|
||||||
1.9419362e-3f, 2.4466860e-3f, 3.3791220e-3f, 3.8838720e-3f
|
1.9419362e-3f, 2.4466860e-3f, 3.3791220e-3f, 3.8838720e-3f
|
||||||
}};
|
}};
|
||||||
|
constexpr auto LATE_LINE_LENGTHS_size = LATE_LINE_LENGTHS.size();
|
||||||
|
|
||||||
|
|
||||||
struct DelayLineI {
|
struct DelayLineI {
|
||||||
@ -512,7 +514,7 @@ bool ReverbState::allocLines(const ALfloat frequency)
|
|||||||
*/
|
*/
|
||||||
ALfloat length{AL_EAXREVERB_MAX_REFLECTIONS_DELAY + EARLY_TAP_LENGTHS.back()*multiplier +
|
ALfloat length{AL_EAXREVERB_MAX_REFLECTIONS_DELAY + EARLY_TAP_LENGTHS.back()*multiplier +
|
||||||
AL_EAXREVERB_MAX_LATE_REVERB_DELAY +
|
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);
|
totalSamples += CalcLineLength(length, totalSamples, frequency, BUFFERSIZE, &mDelay);
|
||||||
|
|
||||||
/* The early vector all-pass line. */
|
/* The early vector all-pass line. */
|
||||||
@ -750,7 +752,7 @@ void LateReverb::updateLines(const ALfloat density, const ALfloat diffusion,
|
|||||||
|
|
||||||
const ALfloat late_allpass_avg{
|
const ALfloat late_allpass_avg{
|
||||||
std::accumulate(LATE_ALLPASS_LENGTHS.begin(), LATE_ALLPASS_LENGTHS.end(), 0.0f) /
|
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
|
/* 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
|
* 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)};
|
const ALfloat multiplier{CalcDelayLengthMult(density)};
|
||||||
ALfloat length{std::accumulate(LATE_LINE_LENGTHS.begin(), LATE_LINE_LENGTHS.end(), 0.0f) /
|
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;
|
length += late_allpass_avg * multiplier;
|
||||||
/* The density gain calculation uses an average decay time weighted by
|
/* The density gain calculation uses an average decay time weighted by
|
||||||
* approximate bandwidth. This attempts to compensate for losses of energy
|
* 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);
|
mEarlyDelayCoeff[i][1] = CalcDecayCoeff(length, decayTime);
|
||||||
|
|
||||||
length = lateDelay + (LATE_LINE_LENGTHS[i] - LATE_LINE_LENGTHS.front()) /
|
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);
|
mLateDelayTap[i][1] = mLateFeedTap + float2int(length * frequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user