Change the linear ramp to something more natural

This commit is contained in:
Paul Ferrand 2020-03-30 23:48:24 +02:00
parent 8ef598bb7d
commit a71b5c3bb5
2 changed files with 4 additions and 3 deletions

View file

@ -538,8 +538,8 @@ namespace _internals {
template <class T>
inline void snippetRampLinear(T*& output, T& value, T step)
{
value += step;
*output++ = value;
value += step;
}
}

View file

@ -461,7 +461,7 @@ float sfz::linearRamp<float, true>(absl::Span<float> output, float value, float
while (unaligned(out) && out < lastAligned)
_internals::snippetRampLinear<float>(out, value, step);
auto mmValue = _mm_set1_ps(value);
auto mmValue = _mm_set1_ps(value - step);
auto mmStep = _mm_set_ps(step + step + step + step, step + step + step, step + step, step);
while (out < lastAligned) {
@ -471,7 +471,8 @@ float sfz::linearRamp<float, true>(absl::Span<float> output, float value, float
out += TypeAlignment;
}
value = _mm_cvtss_f32(mmValue);
value = _mm_cvtss_f32(mmValue) + step;
while (out < output.end())
_internals::snippetRampLinear<float>(out, value, step);
return value;