mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
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
2 changed files with 27 additions and 8 deletions
|
|
@ -246,6 +246,9 @@ public:
|
||||||
/** Emitted when our interpolation style changes */
|
/** Emitted when our interpolation style changes */
|
||||||
PBD::Signal1<void, InterpolationStyle> InterpolationChanged;
|
PBD::Signal1<void, InterpolationStyle> InterpolationChanged;
|
||||||
|
|
||||||
|
static void set_thinning_factor (double d);
|
||||||
|
static double thinning_factor() { return _thinning_factor; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Called by unlocked_eval() to handle cases of 3 or more control points. */
|
/** Called by unlocked_eval() to handle cases of 3 or more control points. */
|
||||||
|
|
@ -288,6 +291,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::list<NascentInfo*> nascent;
|
std::list<NascentInfo*> nascent;
|
||||||
|
static double _thinning_factor;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Evoral
|
} // namespace Evoral
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,21 @@ inline bool event_time_less_than (ControlEvent* a, ControlEvent* b)
|
||||||
return a->when < b->when;
|
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)
|
ControlList::ControlList (const Parameter& id)
|
||||||
: _parameter(id)
|
: _parameter(id)
|
||||||
|
|
@ -420,17 +435,11 @@ ControlList::thin ()
|
||||||
|
|
||||||
if (counter > 2) {
|
if (counter > 2) {
|
||||||
|
|
||||||
double area = fabs (0.5 *
|
double area = fabs ((prevprev->when * (prev->value - cur->value)) +
|
||||||
(prevprev->when * (prev->value - cur->value)) +
|
|
||||||
(prev->when * (cur->value - prevprev->value)) +
|
(prev->when * (cur->value - prevprev->value)) +
|
||||||
(cur->when * (prevprev->value - prev->value)));
|
(cur->when * (prevprev->value - prev->value)));
|
||||||
|
|
||||||
/* the number 10.0 is an arbitrary value that needs to
|
if (area < _thinning_factor) {
|
||||||
* be controlled by some user-controllable
|
|
||||||
* configuration utility.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (area < 10.0) {
|
|
||||||
iterator tmp = pprev;
|
iterator tmp = pprev;
|
||||||
|
|
||||||
/* pprev will change to current
|
/* pprev will change to current
|
||||||
|
|
@ -1540,5 +1549,11 @@ ControlList::set_interpolation (InterpolationStyle s)
|
||||||
InterpolationChanged (s); /* EMIT SIGNAL */
|
InterpolationChanged (s); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ControlList::set_thinning_factor (double v)
|
||||||
|
{
|
||||||
|
_thinning_factor = v;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Evoral
|
} // namespace Evoral
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue