summaryrefslogtreecommitdiff
path: root/libs/evoral/src/ControlList.cpp
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-04-05 11:16:04 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-04-05 11:16:04 +0000
commitbdde5da89bc9225815fe9a54e4ab39eb63574ac3 (patch)
tree86893f0498b4b183b7cf8861efb3b4f82919f91c /libs/evoral/src/ControlList.cpp
parent9036a12ffcf6e9fe9f90df8aae59c24e5e1b0787 (diff)
make automation thinning factor controllable at run time
git-svn-id: svn://localhost/ardour2/branches/3.0@11795 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/src/ControlList.cpp')
-rw-r--r--libs/evoral/src/ControlList.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index 59792f732f..7bdb500d31 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -33,6 +33,21 @@ inline bool event_time_less_than (ControlEvent* a, ControlEvent* b)
return a->when < b->when;
}
+/* this has no units but corresponds to the area of a rectangle
+ computed between three points in the list. If the area is
+ large, it indicates significant non-linearity between the
+ points.
+
+ during automation recording we thin the recorded points
+ using this value. if a point is sufficiently co-linear
+ with its neighbours (as defined by the area of the rectangle
+ formed by three of them), we will not include it in the
+ ControlList. a smaller value will exclude less points,
+ a larger value will exclude more points, so it effectively
+ measures the amount of thinning to be done.
+*/
+
+double ControlList::_thinning_factor = 20.0;
ControlList::ControlList (const Parameter& id)
: _parameter(id)
@@ -420,17 +435,11 @@ ControlList::thin ()
if (counter > 2) {
- double area = fabs (0.5 *
- (prevprev->when * (prev->value - cur->value)) +
+ double area = fabs ((prevprev->when * (prev->value - cur->value)) +
(prev->when * (cur->value - prevprev->value)) +
(cur->when * (prevprev->value - prev->value)));
- /* the number 10.0 is an arbitrary value that needs to
- * be controlled by some user-controllable
- * configuration utility.
- */
-
- if (area < 10.0) {
+ if (area < _thinning_factor) {
iterator tmp = pprev;
/* pprev will change to current
@@ -1540,5 +1549,11 @@ ControlList::set_interpolation (InterpolationStyle s)
InterpolationChanged (s); /* EMIT SIGNAL */
}
+void
+ControlList::set_thinning_factor (double v)
+{
+ _thinning_factor = v;
+}
+
} // namespace Evoral