AutomationControl::set_value (double value)
{
bool to_list = _list && ((AutomationList*)_list.get())->automation_write();
+ bool erase_since_last = _session.transport_rolling();
if (to_list && parameter().toggled()) {
// store the previous value just before this so any
// interpolation works right
- bool erase_since_last = _session.transport_rolling();
_list->add (get_double(), _session.transport_frame()-1, erase_since_last);
}
- Control::set_double (value, to_list, _session.transport_frame());
+ Control::set_double (value, _session.transport_frame(), to_list, erase_since_last);
Changed(); /* EMIT SIGNAL */
}
new_write_pass = true;
did_write_during_pass = false;
insert_position = when;
+
+ /* leave the insert iterator invalid, so that we will do the lookup
+ of where it should be in a "lazy" way - deferring it until
+ we actually add the first point (which may never happen).
+ */
- ControlEvent cp (when, 0.0);
- insert_iterator = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
-
- if ((*insert_iterator)->when != when) {
- /* doesn't point at a control point at precisely this time,
- so reset it to the end and we'll find where to insert
- if/when a new control event is added.
- */
- unlocked_invalidate_insert_iterator ();
- }
+ unlocked_invalidate_insert_iterator ();
}
void
if (new_write_pass) {
- DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 new write pass, insert pos = %2, iter @ end ? %3\n",
- this, insert_position, (insert_iterator == _events.end())));
+ DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 new write pass, insert pos = %2\n", this, insert_position));
/* The first addition of a new control event during a
* write pass.
* corresponding the value there.
*/
- if (insert_iterator == _events.end()) {
- /* the insert_iterator is not set, figure out where
- * it needs to be.
- */
-
- ControlEvent cp (insert_position, 0.0);
- insert_iterator = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
- DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 looked up insert iterator for new write pass\n", this));
- }
+ /* the insert_iterator is not set, figure out where
+ * it needs to be.
+ */
+
+ ControlEvent cp (insert_position, 0.0);
+ insert_iterator = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
+ DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 looked up insert iterator for new write pass\n", this));
double eval_value = unlocked_eval (insert_position);
if (insert_iterator == _events.end()) {
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert iterator at end, adding eval-value there %2\n", this, eval_value));
-
_events.push_back (new ControlEvent (insert_position, eval_value));
/* leave insert iterator at the end */
} else {
- DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 find based on lower bound, erase = %2\n", this, erase_since_last_add));
-
- /* the new point is somewhere within the list,
- * so figure out where to insert
- */
-
- ControlEvent cp (when, 0.0);
- insert_iterator = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
+ DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 erase %2 from existing iterator (@end ? %3\n",
+ this, erase_since_last_add,
+ (insert_iterator == _events.end())));
while (insert_iterator != _events.end()) {
if ((*insert_iterator)->when < when) {
MIDI::controller_range(min, max, normal);
// Make a ramp like /\ from min to max and back to min
- c->set_double(min, true, 0);
- c->set_double(max, true, delay);
- c->set_double(min, true, 2*delay);
+ c->set_double(min, 0, true);
+ c->set_double(max, delay, true);
+ c->set_double(min, 2*delay, true);
CCTestSink<Time> sink(cc_type);