Rename lerp to avoid conflicts with C++20's std::lerp

master
Chris Robinson 2022-04-06 17:41:24 -07:00
parent 707f4cca27
commit 6a9fe1e2c1
11 changed files with 26 additions and 26 deletions

View File

@ -1283,10 +1283,10 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ContextBa
case DistanceModel::Inverse:
if(props->RefDistance > 0.0f)
{
float dist{lerp(props->RefDistance, ClampedDist, props->RolloffFactor)};
float dist{lerpf(props->RefDistance, ClampedDist, props->RolloffFactor)};
if(dist > 0.0f) DryGainBase *= props->RefDistance / dist;
dist = lerp(props->RefDistance, ClampedDist, props->RoomRolloffFactor);
dist = lerpf(props->RefDistance, ClampedDist, props->RoomRolloffFactor);
if(dist > 0.0f) WetGainBase *= props->RefDistance / dist;
}
break;
@ -1336,19 +1336,19 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ContextBa
if(Angle >= props->OuterAngle)
{
ConeGain = props->OuterGain;
ConeHF = lerp(1.0f, props->OuterGainHF, props->DryGainHFAuto);
ConeHF = lerpf(1.0f, props->OuterGainHF, props->DryGainHFAuto);
}
else if(Angle >= props->InnerAngle)
{
const float scale{(Angle-props->InnerAngle) / (props->OuterAngle-props->InnerAngle)};
ConeGain = lerp(1.0f, props->OuterGain, scale);
ConeHF = lerp(1.0f, props->OuterGainHF, scale * props->DryGainHFAuto);
ConeGain = lerpf(1.0f, props->OuterGain, scale);
ConeHF = lerpf(1.0f, props->OuterGainHF, scale * props->DryGainHFAuto);
}
DryGainBase *= ConeGain;
WetGainBase *= lerp(1.0f, ConeGain, props->WetGainAuto);
WetGainBase *= lerpf(1.0f, ConeGain, props->WetGainAuto);
WetConeHF = lerp(1.0f, ConeHF, props->WetGainHFAuto);
WetConeHF = lerpf(1.0f, ConeHF, props->WetGainHFAuto);
}
/* Apply gain and frequency filters */
@ -1398,7 +1398,7 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ContextBa
auto calc_attenuation = [](float distance, float refdist, float rolloff) noexcept
{
const float dist{lerp(refdist, distance, rolloff)};
const float dist{lerpf(refdist, distance, rolloff)};
if(dist > refdist) return refdist / dist;
return 1.0f;
};

View File

@ -156,7 +156,7 @@ void AutowahState::process(const size_t samplesToDo,
*/
sample = peak_gain * std::fabs(samplesIn[0][i]);
a = (sample > env_delay) ? attack_rate : release_rate;
env_delay = lerp(sample, env_delay, a);
env_delay = lerpf(sample, env_delay, a);
/* Calculate the cos and alpha components for this sample's filter. */
w0 = minf((bandwidth*env_delay + freq_min), 0.46f) * (al::numbers::pi_v<float>*2.0f);

View File

@ -902,7 +902,7 @@ void LateReverb::updateLines(const float density_mult, const float diffusion,
* filter for each of its four lines. Also include the average
* modulation delay (depth is half the max delay in samples).
*/
length += lerp(LATE_ALLPASS_LENGTHS[i], late_allpass_avg, diffusion)*density_mult +
length += lerpf(LATE_ALLPASS_LENGTHS[i], late_allpass_avg, diffusion)*density_mult +
Mod.Depth[1]/frequency;
/* Calculate the T60 damping coefficients for each line. */
@ -1517,7 +1517,7 @@ void ReverbState::lateUnfaded(const size_t offset, const size_t todo)
* samples that were acquired above, and combined with the main
* delay tap.
*/
mTempSamples[j][i] = lerp(out0, out1, frac)*midGain +
mTempSamples[j][i] = lerpf(out0, out1, frac)*midGain +
main_delay.Line[late_delay_tap++][j]*densityGain;
++i;
} while(--td);
@ -1586,8 +1586,8 @@ void ReverbState::lateFaded(const size_t offset, const size_t todo, const float
const float fade1{densityStep*fadeCount};
const float gfade0{oldMidGain + oldMidStep*fadeCount};
const float gfade1{midStep*fadeCount};
mTempSamples[j][i] = lerp(out00, out01, frac)*gfade0 +
lerp(out10, out11, frac)*gfade1 +
mTempSamples[j][i] = lerpf(out00, out01, frac)*gfade0 +
lerpf(out10, out11, frac)*gfade1 +
main_delay.Line[late_delay_tap0++][j]*fade0 +
main_delay.Line[late_delay_tap1++][j]*fade1;
++i;

View File

@ -310,7 +310,7 @@ void VmorpherState::process(const size_t samplesToDo, const al::span<const Float
alignas(16) float blended[MAX_UPDATE_SAMPLES];
for(size_t i{0u};i < td;i++)
blended[i] = lerp(mSampleBufferA[i], mSampleBufferB[i], mLfo[i]);
blended[i] = lerpf(mSampleBufferA[i], mSampleBufferB[i], mLfo[i]);
/* Now, mix the processed sound data to the output. */
MixSamples({blended, td}, samplesOut, chandata->CurrentGains, chandata->TargetGains,

View File

@ -69,7 +69,7 @@ constexpr inline size_t clampz(size_t val, size_t min, size_t max) noexcept
{ return minz(max, maxz(min, val)); }
constexpr inline float lerp(float val1, float val2, float mu) noexcept
constexpr inline float lerpf(float val1, float val2, float mu) noexcept
{ return val1 + (val2-val1)*mu; }
constexpr inline float cubic(float val1, float val2, float val3, float val4, float mu) noexcept
{

View File

@ -133,8 +133,8 @@ static void CrestDetector(Compressor *Comp, const uint SamplesToDo)
{
const float x2{clampf(x_abs * x_abs, 0.000001f, 1000000.0f)};
y2_peak = maxf(x2, lerp(x2, y2_peak, a_crest));
y2_rms = lerp(x2, y2_rms, a_crest);
y2_peak = maxf(x2, lerpf(x2, y2_peak, a_crest));
y2_rms = lerpf(x2, y2_rms, a_crest);
return y2_peak / y2_rms;
};
auto side_begin = std::begin(Comp->mSideChain) + Comp->mLookAhead;
@ -243,15 +243,15 @@ void GainCompressor(Compressor *Comp, const uint SamplesToDo)
* above to compensate for the chained operating mode.
*/
const float x_L{-slope * y_G};
y_1 = maxf(x_L, lerp(x_L, y_1, a_rel));
y_L = lerp(y_1, y_L, a_att);
y_1 = maxf(x_L, lerpf(x_L, y_1, a_rel));
y_L = lerpf(y_1, y_L, a_att);
/* Knee width and make-up gain automation make use of a smoothed
* measurement of deviation between the control signal and estimate.
* The estimate is also used to bias the measurement to hot-start its
* average.
*/
c_dev = lerp(-(y_L+c_est), c_dev, a_adp);
c_dev = lerpf(-(y_L+c_est), c_dev, a_adp);
if(autoPostGain)
{

View File

@ -26,7 +26,7 @@ constexpr uint FracPhaseDiffOne{1 << FracPhaseBitDiff};
inline float do_point(const InterpState&, const float *RESTRICT vals, const uint)
{ return vals[0]; }
inline float do_lerp(const InterpState&, const float *RESTRICT vals, const uint frac)
{ return lerp(vals[0], vals[1], static_cast<float>(frac)*(1.0f/MixerFracOne)); }
{ return lerpf(vals[0], vals[1], static_cast<float>(frac)*(1.0f/MixerFracOne)); }
inline float do_cubic(const InterpState&, const float *RESTRICT vals, const uint frac)
{ return cubic(vals[0], vals[1], vals[2], vals[3], static_cast<float>(frac)*(1.0f/MixerFracOne)); }
inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, const uint frac)

View File

@ -101,7 +101,7 @@ float *Resample_<LerpTag,NEONTag>(const InterpState*, float *RESTRICT src, uint
frac = static_cast<uint>(vgetq_lane_s32(frac4, 0));
do {
*(dst_iter++) = lerp(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));
*(dst_iter++) = lerpf(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));
frac += increment;
src += frac>>MixerFracBits;

View File

@ -78,7 +78,7 @@ float *Resample_<LerpTag,SSE2Tag>(const InterpState*, float *RESTRICT src, uint
frac = static_cast<uint>(_mm_cvtsi128_si32(frac4));
do {
*(dst_iter++) = lerp(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));
*(dst_iter++) = lerpf(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));
frac += increment;
src += frac>>MixerFracBits;

View File

@ -83,7 +83,7 @@ float *Resample_<LerpTag,SSE4Tag>(const InterpState*, float *RESTRICT src, uint
frac = static_cast<uint>(_mm_cvtsi128_si32(frac4));
do {
*(dst_iter++) = lerp(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));
*(dst_iter++) = lerpf(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));
frac += increment;
src += frac>>MixerFracBits;

View File

@ -382,7 +382,7 @@ void DoHrtfMix(const float *samples, const uint DstBufferSize, DirectParams &par
if(Counter > fademix)
{
const float a{static_cast<float>(fademix) / static_cast<float>(Counter)};
gain = lerp(parms.Hrtf.Old.Gain, TargetGain, a);
gain = lerpf(parms.Hrtf.Old.Gain, TargetGain, a);
}
MixHrtfFilter hrtfparams{
@ -409,7 +409,7 @@ void DoHrtfMix(const float *samples, const uint DstBufferSize, DirectParams &par
if(Counter > DstBufferSize)
{
const float a{static_cast<float>(todo) / static_cast<float>(Counter-fademix)};
gain = lerp(parms.Hrtf.Old.Gain, TargetGain, a);
gain = lerpf(parms.Hrtf.Old.Gain, TargetGain, a);
}
MixHrtfFilter hrtfparams{