auto in lambdas

This commit is contained in:
Paul Fd 2020-03-10 17:56:34 +01:00
parent f405e2c23f
commit 70743900b5
3 changed files with 3 additions and 3 deletions

View file

@ -14,7 +14,7 @@ namespace sfz {
template <class Type>
void ADSREnvelope<Type>::reset(const Region& region, const MidiState& state, int delay, uint8_t velocity, float sampleRate) noexcept
{
auto secondsToSamples = [sampleRate](auto timeInSeconds) {
auto secondsToSamples = [sampleRate](Type timeInSeconds) {
return static_cast<int>(timeInSeconds * sampleRate);
};

View file

@ -53,7 +53,7 @@ void EventEnvelope<Type>::prepareEvents(int blockLength)
if (resetEvents)
clear();
absl::c_stable_sort(events, [](const auto& lhs, const auto& rhs) {
absl::c_stable_sort(events, [](const std::pair<int, Type>& lhs, const std::pair<int, Type>& rhs) {
return lhs.first < rhs.first;
});

View file

@ -1011,7 +1011,7 @@ float sfz::Region::velocityCurve(uint8_t velocity) const noexcept
float gain { 1.0f };
if (velocityPoints.size() > 0) { // Custom velocity curve
auto after = std::find_if(velocityPoints.begin(), velocityPoints.end(), [velocity](auto& val) { return val.first >= velocity; });
auto after = std::find_if(velocityPoints.begin(), velocityPoints.end(), [velocity](const std::pair<int, float>& val) { return val.first >= velocity; });
auto before = after == velocityPoints.begin() ? velocityPoints.begin() : after - 1;
// Linear interpolation
float relativePositionInSegment {