summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/automation_controller.cc2
-rw-r--r--gtk2_ardour/automation_region_view.cc2
-rw-r--r--gtk2_ardour/automation_time_axis.cc4
-rw-r--r--gtk2_ardour/editor_drag.cc8
-rw-r--r--libs/ardour/automation_watch.cc2
-rw-r--r--libs/evoral/evoral/ControlList.hpp2
-rw-r--r--libs/evoral/src/ControlList.cpp53
7 files changed, 46 insertions, 27 deletions
diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc
index f57f2a737a..44c03159a4 100644
--- a/gtk2_ardour/automation_controller.cc
+++ b/gtk2_ardour/automation_controller.cc
@@ -204,7 +204,7 @@ AutomationController::toggled ()
_controllable->set_automation_state(Write);
}
if (_controllable->list()) {
- _controllable->list()->set_in_write_pass(true, false, _controllable->session().audible_frame());
+ _controllable->list()->set_in_write_pass(true, true, _controllable->session().audible_frame());
}
}
const bool was_active = _controllable->get_value() >= 0.5;
diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc
index 7e330949de..b418d096f2 100644
--- a/gtk2_ardour/automation_region_view.cc
+++ b/gtk2_ardour/automation_region_view.cc
@@ -190,7 +190,7 @@ AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double
view->editor().begin_reversible_command (_("add automation event"));
XMLNode& before = _line->the_list()->get_state();
- _line->the_list()->add (when_d, y, with_guard_points, false);
+ _line->the_list()->editor_add (when_d, y, with_guard_points);
XMLNode& after = _line->the_list()->get_state();
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 6d3a506cfa..d5276e0cc5 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -644,10 +644,10 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when,
_editor.begin_reversible_command (_("add automation event"));
XMLNode& before = list->get_state();
- list->add (when, y, with_guard_points);
+ list->editor_add (when, y, with_guard_points);
XMLNode& after = list->get_state();
- _session->add_command (new MementoCommand<ARDOUR::AutomationList> (*list, &before, &after));
+ _session->add_command (new MementoCommand<ARDOUR::AutomationList> (*list.get (), &before, &after));
_editor.commit_reversible_command ();
_session->set_dirty ();
}
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index b079972a1b..229b1ae1a0 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -5521,8 +5521,8 @@ AutomationRangeDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
double const p = j->line->time_converter().from (i->start - j->line->time_converter().origin_b ());
double const q = j->line->time_converter().from (a - j->line->time_converter().origin_b ());
- the_list->editor_add (p, value (the_list, p));
- the_list->editor_add (q, value (the_list, q));
+ the_list->editor_add (p, value (the_list, p), false);
+ the_list->editor_add (q, value (the_list, q), false);
}
/* same thing for the end */
@@ -5547,8 +5547,8 @@ AutomationRangeDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
double const p = j->line->time_converter().from (b - j->line->time_converter().origin_b ());
double const q = j->line->time_converter().from (i->end - j->line->time_converter().origin_b ());
- the_list->editor_add (p, value (the_list, p));
- the_list->editor_add (q, value (the_list, q));
+ the_list->editor_add (p, value (the_list, p), false);
+ the_list->editor_add (q, value (the_list, q), false);
}
}
diff --git a/libs/ardour/automation_watch.cc b/libs/ardour/automation_watch.cc
index 4e833fceb5..3714f17502 100644
--- a/libs/ardour/automation_watch.cc
+++ b/libs/ardour/automation_watch.cc
@@ -128,7 +128,7 @@ AutomationWatch::timer ()
(*aw)->list()->add (time, (*aw)->user_double(), true);
}
}
- } else { //transport stopped or reversed. stop the automation pass and start a new one (for bonus points, someday store the previous pass in an undo record)
+ } else if (time != _last_time) { //transport stopped or reversed. stop the automation pass and start a new one (for bonus points, someday store the previous pass in an undo record)
for (AutomationWatches::iterator aw = automation_watches.begin(); aw != automation_watches.end(); ++aw) {
DEBUG_TRACE (DEBUG::Automation, string_compose ("%1: transport in rewind, speed %2, in write pass ? %3 writing ? %4\n",
(*aw)->name(), _session->transport_speed(), _session->transport_rolling(),
diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp
index d2be604e5e..82868cd24c 100644
--- a/libs/evoral/evoral/ControlList.hpp
+++ b/libs/evoral/evoral/ControlList.hpp
@@ -125,7 +125,7 @@ public:
void shift (double before, double distance);
virtual void add (double when, double value, bool with_guards=true, bool with_initial=true);
- virtual void editor_add (double when, double value);
+ virtual void editor_add (double when, double value, bool with_guard);
void fast_simple_add (double when, double value);
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index 2f1d8f4243..d592be3491 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -452,7 +452,7 @@ ControlList::in_write_pass () const
}
void
-ControlList::editor_add (double when, double value)
+ControlList::editor_add (double when, double value, bool with_guard)
{
/* this is for making changes from a graphical line editor
*/
@@ -464,8 +464,8 @@ ControlList::editor_add (double when, double value)
*/
if (when >= 1) {
- _events.insert (_events.end(), new ControlEvent (0, _default_value));
- DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added default value %2 at zero\n", this, _default_value));
+ _events.insert (_events.end(), new ControlEvent (0, value));
+ DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added value %2 at zero\n", this, value));
}
}
@@ -473,6 +473,9 @@ ControlList::editor_add (double when, double value)
iterator i = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
DEBUG_TRACE (DEBUG::ControlList, string_compose ("editor_add: actually add when= %1 value= %2\n", when, value));
_events.insert (i, new ControlEvent (when, value));
+ if (with_guard) {
+ add_guard_point (when);
+ }
mark_dirty ();
@@ -491,9 +494,9 @@ ControlList::maybe_add_insert_guard (double when)
new control point so that our insert will happen correctly. */
most_recent_insert_iterator = _events.insert (
most_recent_insert_iterator,
- new ControlEvent (when + 1, (*most_recent_insert_iterator)->value));
+ new ControlEvent (when + 64, (*most_recent_insert_iterator)->value));
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added insert guard point @ %2 = %3\n",
- this, when+1,
+ this, when + 64,
(*most_recent_insert_iterator)->value));
}
}
@@ -632,15 +635,6 @@ ControlList::add (double when, double value, bool with_guards, bool with_initial
* before it if needed then reset the value of the point.
*/
- if ((when > 0) && most_recent_insert_iterator != _events.begin ()) {
- --most_recent_insert_iterator;
- double last_when = (*most_recent_insert_iterator)->when;
- ++most_recent_insert_iterator;
- if (when - last_when > 64) {
- add_guard_point (when - 64);
- }
- }
-
(*most_recent_insert_iterator)->value = value;
/* if we modified the final value, then its as
@@ -658,10 +652,35 @@ ControlList::add (double when, double value, bool with_guards, bool with_initial
} else {
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert new point at %2 at iterator at %3\n", this, when, (*most_recent_insert_iterator)->when));
-
- const bool done = maybe_insert_straight_line (when, value);
+ bool done = false;
+ /* check for possible straight line here until maybe_insert_straight_line () handles the insert iterator properly*/
+ if (most_recent_insert_iterator != _events.begin ()) {
+ bool have_point2 = false;
+ --most_recent_insert_iterator;
+ const bool have_point1 = (*most_recent_insert_iterator)->value == value;
+
+ if (most_recent_insert_iterator != _events.begin ()) {
+ --most_recent_insert_iterator;
+ have_point2 = (*most_recent_insert_iterator)->value == value;
+ ++most_recent_insert_iterator;
+ }
+
+ if (have_point1 && have_point2) {
+ (*most_recent_insert_iterator)->when = when;
+ done = true;
+ } else {
+ ++most_recent_insert_iterator;
+ }
+ }
+ //done = maybe_insert_straight_line (when, value) || done;
+ /* if the transport is stopped, add guard points (?) */
+ if (!done && !_in_write_pass && when > 64) {
+ add_guard_point (when - 64);
+ maybe_add_insert_guard (when);
+ }
+
if (with_guards) {
- maybe_add_insert_guard(when);
+ maybe_add_insert_guard (when);
}
if (!done) {