Automation -use editor_add in gui, record straight lines with fewer points.
- don't keep setting/unsetting write pass when transport frame remains the same (think larger jack buffer sizes) - insert guards are now 64 frames after when. - refactor previous approach.
This commit is contained in:
parent
7cb9dbb8af
commit
15819f0896
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue