make automation thinning factor controllable at run time
git-svn-id: svn://localhost/ardour2/branches/3.0@11795 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
9036a12ffc
commit
bdde5da89b
@ -246,6 +246,9 @@ public:
|
||||
/** Emitted when our interpolation style changes */
|
||||
PBD::Signal1<void, InterpolationStyle> InterpolationChanged;
|
||||
|
||||
static void set_thinning_factor (double d);
|
||||
static double thinning_factor() { return _thinning_factor; }
|
||||
|
||||
protected:
|
||||
|
||||
/** Called by unlocked_eval() to handle cases of 3 or more control points. */
|
||||
@ -288,6 +291,7 @@ protected:
|
||||
};
|
||||
|
||||
std::list<NascentInfo*> nascent;
|
||||
static double _thinning_factor;
|
||||
};
|
||||
|
||||
} // namespace Evoral
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user