summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-05-30 17:00:28 +0200
committerRobin Gareus <robin@gareus.org>2014-05-30 17:00:28 +0200
commitc91f847454670506b28578d7254391d3dc26345f (patch)
tree4fc3dff10be1234475099276cb924d8e4d5ced12
parent161a3258ee8a4c04f8ef341023ce4a7059d50016 (diff)
update Evoral::Curve to honor ControlList::InterpolationStyle
-rw-r--r--libs/evoral/src/Curve.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/libs/evoral/src/Curve.cpp b/libs/evoral/src/Curve.cpp
index 239339e508..20cc5d9ec3 100644
--- a/libs/evoral/src/Curve.cpp
+++ b/libs/evoral/src/Curve.cpp
@@ -402,17 +402,14 @@ Curve::multipoint_eval (double x)
double tdelta = x - before->when;
double trange = after->when - before->when;
-#if 1 // Linear Interpolation
- return before->value + (vdelta * (tdelta / trange));
-#else // cubic spline
- if (!after->coeff) {
- return before->value + (vdelta * (tdelta / trange));
+
+ if (_list.interpolation() == ControlList::Curved && after->coeff) {
+ ControlEvent* ev = after;
+ double x2 = x * x;
+ return ev->coeff[0] + (ev->coeff[1] * x) + (ev->coeff[2] * x2) + (ev->coeff[3] * x2 * x);
} else {
- ControlEvent* ev = after;
- double x2 = x * x;
- return ev->coeff[0] + (ev->coeff[1] * x) + (ev->coeff[2] * x2) + (ev->coeff[3] * x2 * x);
+ return before->value + (vdelta * (tdelta / trange));
}
-#endif
}
/* x is a control point in the data */