mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-13 10:06:33 +01:00
(1) do not write sequential same-value automation data into a ControlList (2) thin AutomationList data when reloading from disk (similar code as Ben's from ardour 2.X, but without user-adjustable thinning density at present). Should fix #4583 and maybe others caused by NaN's occuring from zero-slope lines
git-svn-id: svn://localhost/ardour2/branches/3.0@11078 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
773d20f330
commit
5f88b44245
5 changed files with 68 additions and 3 deletions
|
|
@ -366,6 +366,8 @@ AutomationList::deserialize_events (const XMLNode& node)
|
||||||
fast_simple_add (x, y);
|
fast_simple_add (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thin ();
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
clear ();
|
clear ();
|
||||||
error << _("automation list: cannot load coordinates from XML, all points ignored") << endmsg;
|
error << _("automation list: cannot load coordinates from XML, all points ignored") << endmsg;
|
||||||
|
|
@ -427,6 +429,8 @@ AutomationList::set_state (const XMLNode& node, int version)
|
||||||
fast_simple_add (x, y);
|
fast_simple_add (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thin ();
|
||||||
|
|
||||||
thaw ();
|
thaw ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -504,6 +504,7 @@ Route::process_output_buffers (BufferSet& bufs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* should we NOT run plugins here if the route is inactive?
|
/* should we NOT run plugins here if the route is inactive?
|
||||||
do we catch route != active somewhere higher?
|
do we catch route != active somewhere higher?
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,8 @@ public:
|
||||||
bool move_ranges (std::list< RangeMove<double> > const &);
|
bool move_ranges (std::list< RangeMove<double> > const &);
|
||||||
void modify (iterator, double, double);
|
void modify (iterator, double, double);
|
||||||
|
|
||||||
|
void thin ();
|
||||||
|
|
||||||
boost::shared_ptr<ControlList> cut (double, double);
|
boost::shared_ptr<ControlList> cut (double, double);
|
||||||
boost::shared_ptr<ControlList> copy (double, double);
|
boost::shared_ptr<ControlList> copy (double, double);
|
||||||
void clear (double, double);
|
void clear (double, double);
|
||||||
|
|
|
||||||
|
|
@ -390,8 +390,68 @@ ControlList::rt_add (double when, double value)
|
||||||
/* we don't worry about adding events out of time order as we will
|
/* we don't worry about adding events out of time order as we will
|
||||||
sort them in merge_nascent.
|
sort them in merge_nascent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
EventList& el (nascent.back()->events);
|
||||||
|
|
||||||
|
if (el.size() > 1 && (when >= el.back()->when) && (value == el.back()->value)) {
|
||||||
|
/* same value, later timestamp, effective slope is
|
||||||
|
* zero, so just move the last point in nascent to our
|
||||||
|
* new time position. this avoids storing an unlimited
|
||||||
|
* number of points to represent a flat line.
|
||||||
|
*/
|
||||||
|
el.back()->when = when;
|
||||||
|
} else {
|
||||||
nascent.back()->events.push_back (new ControlEvent (when, value));
|
nascent.back()->events.push_back (new ControlEvent (when, value));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ControlList::thin ()
|
||||||
|
{
|
||||||
|
Glib::Mutex::Lock lm (_lock);
|
||||||
|
|
||||||
|
ControlEvent* prevprev;
|
||||||
|
ControlEvent* cur;
|
||||||
|
ControlEvent* prev;
|
||||||
|
iterator pprev;
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
|
for (iterator i = _events.begin(); i != _events.end(); ++i) {
|
||||||
|
|
||||||
|
cur = *i;
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
if (counter > 2) {
|
||||||
|
|
||||||
|
double area = fabs (0.5 *
|
||||||
|
(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) {
|
||||||
|
iterator tmp = pprev;
|
||||||
|
|
||||||
|
/* pprev will change to current
|
||||||
|
i is incremented to the next event
|
||||||
|
*/
|
||||||
|
|
||||||
|
pprev = i;
|
||||||
|
_events.erase (tmp);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prevprev = prev;
|
||||||
|
prev = cur;
|
||||||
|
pprev = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,6 @@ Curve::solve ()
|
||||||
} else {
|
} else {
|
||||||
fpi = 2 / (slope_before + slope_after);
|
fpi = 2 / (slope_before + slope_after);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compute second derivative for either side of control point `i' */
|
/* compute second derivative for either side of control point `i' */
|
||||||
|
|
@ -297,7 +296,6 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
|
||||||
for (i = 1; i < veclen; ++i) {
|
for (i = 1; i < veclen; ++i) {
|
||||||
vec[i] = vec[i-1] + yfrac;
|
vec[i] = vec[i-1] + yfrac;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue