Do not require a curve for the concave case (test helper)

This commit is contained in:
Jean Pierre Cimalando 2020-08-17 16:01:58 +02:00
parent f5d61fe183
commit 06d111cbd4
2 changed files with 7 additions and 3 deletions

View file

@ -1518,7 +1518,13 @@ float sfz::Region::velocityCurve(float velocity) const noexcept
{ {
ASSERT(velocity >= 0.0f && velocity <= 1.0f); ASSERT(velocity >= 0.0f && velocity <= 1.0f);
float gain = std::fabs(ampVeltrack) * (1.0f - velCurve->evalNormalized(velocity)); float gain;
if (velCurve)
gain = velCurve->evalNormalized(velocity);
else
gain = velocity * velocity;
gain = std::fabs(ampVeltrack) * (1.0f - gain);
gain = (ampVeltrack < 0) ? gain : (1.0f - gain); gain = (ampVeltrack < 0) ? gain : (1.0f - gain);
return gain; return gain;

View file

@ -569,8 +569,6 @@ void sfz::Synth::finalizeSfzLoad()
if (!region->velocityPoints.empty()) if (!region->velocityPoints.empty())
region->velCurve = Curve::buildFromVelcurvePoints( region->velCurve = Curve::buildFromVelcurvePoints(
region->velocityPoints, Curve::Interpolator::Linear); region->velocityPoints, Curve::Interpolator::Linear);
else
region->velCurve = resources.curves.getCurve(4);
region->registerPitchWheel(0); region->registerPitchWheel(0);
region->registerAftertouch(0); region->registerAftertouch(0);