Skip to content

Commit

Permalink
Avoid using auto for lambda parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Feb 6, 2023
1 parent ff530e9 commit 0de7ea4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion alc/alu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const size_t Sam
auto delay_start = std::swap_ranges(inout, inout_end, distbuf);
std::rotate(distbuf, delay_start, distbuf + base);
}
std::transform(inout, inout_end, inout, [gain](auto a){ return a * gain; });
std::transform(inout, inout_end, inout, [gain](float s) { return s * gain; });
}
}

Expand Down
2 changes: 1 addition & 1 deletion alc/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ bool ALCcontext::deinit()
* given context.
*/
std::copy_if(oldarray->begin(), oldarray->end(), newarray->begin(),
[this](auto a){ return a != this; });
[this](ContextBase *ctx) { return ctx != this; });

/* Store the new context array in the device. Wait for any current mix
* to finish before deleting the old array.
Expand Down
2 changes: 1 addition & 1 deletion common/alcomplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void complex_hilbert(const al::span<std::complex<double>> buffer)

*bufiter *= inverse_size; ++bufiter;
bufiter = std::transform(bufiter, halfiter, bufiter,
[scale=inverse_size*2.0](auto a){ return a * scale; });
[scale=inverse_size*2.0](std::complex<double> d){ return d * scale; });
*bufiter *= inverse_size; ++bufiter;

std::fill(bufiter, buffer.end(), std::complex<double>{});
Expand Down
10 changes: 5 additions & 5 deletions core/mastering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ void ShiftSlidingHold(SlidingHold *Hold, const uint n)
if(exp_last-exp_begin < 0)
{
std::transform(exp_begin, std::end(Hold->mExpiries), exp_begin,
[n](auto a){ return a - n; });
[n](uint e){ return e - n; });
exp_begin = std::begin(Hold->mExpiries);
}
std::transform(exp_begin, exp_last+1, exp_begin, [n](auto a){ return a - n; });
std::transform(exp_begin, exp_last+1, exp_begin, [n](uint e){ return e - n; });
}


Expand Down Expand Up @@ -155,7 +155,7 @@ void PeakDetector(Compressor *Comp, const uint SamplesToDo)
/* Clamp the minimum amplitude to near-zero and convert to logarithm. */
auto side_begin = std::begin(Comp->mSideChain) + Comp->mLookAhead;
std::transform(side_begin, side_begin+SamplesToDo, side_begin,
[](auto s) { return std::log(maxf(0.000001f, s)); });
[](float s) { return std::log(maxf(0.000001f, s)); });
}

/* An optional hold can be used to extend the peak detector so it can more
Expand Down Expand Up @@ -404,7 +404,7 @@ void Compressor::process(const uint SamplesToDo, FloatBufferLine *OutBuffer)
{
float *buffer{al::assume_aligned<16>(input.data())};
std::transform(buffer, buffer+SamplesToDo, buffer,
[preGain](auto a){ return a * preGain; });
[preGain](float s) { return s * preGain; });
};
std::for_each(OutBuffer, OutBuffer+numChans, apply_gain);
}
Expand All @@ -430,7 +430,7 @@ void Compressor::process(const uint SamplesToDo, FloatBufferLine *OutBuffer)
float *buffer{al::assume_aligned<16>(input.data())};
const float *gains{al::assume_aligned<16>(&sideChain[0])};
std::transform(gains, gains+SamplesToDo, buffer, buffer,
[](auto a, auto b){ return a * b; });
[](float g, float s) { return g * s; });
};
std::for_each(OutBuffer, OutBuffer+numChans, apply_comp);

Expand Down
2 changes: 1 addition & 1 deletion utils/makemhr/makemhr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ static void NormalizeHrirs(HrirDataT *hData)

/* Now scale all IRs by the given factor. */
auto proc_channel = [irSize,factor](double *ir)
{ std::transform(ir, ir+irSize, ir, [factor](auto s){ return s * factor; }); };
{ std::transform(ir, ir+irSize, ir, [factor](double s){ return s * factor; }); };
auto proc_azi = [channels,proc_channel](HrirAzT &azi)
{ std::for_each(azi.mIrs, azi.mIrs+channels, proc_channel); };
auto proc_elev = [proc_azi](HrirEvT &elev)
Expand Down

0 comments on commit 0de7ea4

Please sign in to comment.