13
0

* Set Discrete mode as default until Linear mode works properly

git-svn-id: svn://localhost/ardour2/branches/3.0@4455 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Baier 2009-01-28 09:49:42 +00:00
parent d9416a3a6a
commit b04ead74ff
2 changed files with 12 additions and 5 deletions

View File

@ -664,7 +664,12 @@ SMFSource::load_model(bool lock, bool force_reload)
Evoral::ControlSet::Controls controls = _model->controls(); Evoral::ControlSet::Controls controls = _model->controls();
for (Evoral::ControlSet::Controls::iterator c = controls.begin(); c != controls.end(); ++c) { for (Evoral::ControlSet::Controls::iterator c = controls.begin(); c != controls.end(); ++c) {
(*c).second->list()->set_interpolation( (*c).second->list()->set_interpolation(
// to be enabled when ControlList::rt_safe_earliest_event_linear_unlocked works properly
#if 0
EventTypeMap::instance().interpolation_of((*c).first)); EventTypeMap::instance().interpolation_of((*c).first));
#else
Evoral::ControlList::Discrete);
#endif
} }
_model->end_write(false); _model->end_write(false);

View File

@ -1001,6 +1001,8 @@ ControlList::rt_safe_earliest_event_discrete_unlocked (double start, double end,
/** Get the earliest time the line crosses an integer (Linear interpolation). /** Get the earliest time the line crosses an integer (Linear interpolation).
* *
* In other words: send out multiple events to interpolate the line
* defined by its control points
* If an event is found, \a x and \a y are set to its coordinates. * If an event is found, \a x and \a y are set to its coordinates.
* *
* \param inclusive Include events with timestamp exactly equal to \a start * \param inclusive Include events with timestamp exactly equal to \a start
@ -1009,7 +1011,7 @@ ControlList::rt_safe_earliest_event_discrete_unlocked (double start, double end,
bool bool
ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, double& x, double& y, bool inclusive) const ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, double& x, double& y, bool inclusive) const
{ {
//cerr << "earliest_event(" << start << ", " << end << ", " << x << ", " << y << ", " << inclusive << endl; cerr << "earliest_event(start: " << start << ", end: " << end << ", x: " << x << ", y: " << y << ", inclusive: " << inclusive << ")" << endl;
const_iterator length_check_iter = _events.begin(); const_iterator length_check_iter = _events.begin();
if (_events.empty()) // 0 events if (_events.empty()) // 0 events
@ -1052,12 +1054,12 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d
* (Optimize for immediate call this cycle within range) */ * (Optimize for immediate call this cycle within range) */
_search_cache.left = x; _search_cache.left = x;
//++_search_cache.range.first; //++_search_cache.range.first;
assert(inclusive ? x >= start : x > start); assert(x >= start);
return true; return true;
} }
if (fabs(first->value - next->value) <= 1) { if (fabs(first->value - next->value) <= 1) {
if (next->when <= end && (!inclusive || next->when > start)) { if (next->when <= end && (next->when > start)) {
x = next->when; x = next->when;
y = next->value; y = next->value;
/* Move left of cache to this point /* Move left of cache to this point
@ -1094,9 +1096,9 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d
x = first->when + (y - first->value) / (double)slope; x = first->when + (y - first->value) / (double)slope;
} }
/*cerr << first->value << " @ " << first->when << " ... " cerr << first->value << " @ " << first->when << " ... "
<< next->value << " @ " << next->when << next->value << " @ " << next->when
<< " = " << y << " @ " << x << endl;*/ << " = " << y << " @ " << x << endl;
assert( (y >= first->value && y <= next->value) assert( (y >= first->value && y <= next->value)
|| (y <= first->value && y >= next->value) ); || (y <= first->value && y >= next->value) );