13
0

disable spline interpolation for curves - use linear interpolation; configuration parameter pending for this, plus slightly cleaner reuse of existing ControlList methods

git-svn-id: svn://localhost/ardour2/branches/3.0@13627 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-12-09 17:24:58 +00:00
parent 93b3a72cb8
commit 24917e4c9e

View File

@ -389,10 +389,28 @@ Curve::multipoint_eval (double x)
return _list.events().back()->value;
}
ControlEvent* after = (*range.second);
range.second--;
ControlEvent* before = (*range.second);
double vdelta = after->value - before->value;
if (vdelta == 0.0) {
return before->value;
}
double tdelta = x - before->when;
double trange = after->when - before->when;
return before->value + (vdelta * (tdelta / trange));
#if 0
double x2 = x * x;
ControlEvent* ev = *range.second;
return ev->coeff[0] + (ev->coeff[1] * x) + (ev->coeff[2] * x2) + (ev->coeff[3] * x2 * x);
return = ev->coeff[0] + (ev->coeff[1] * x) + (ev->coeff[2] * x2) + (ev->coeff[3] * x2 * x);
#endif
}
/* x is a control point in the data */