Don't add origin value to MIDI controller regions on initial insert.
authorDavid Robillard <d@drobilla.net>
Sun, 16 Nov 2014 07:09:33 +0000 (02:09 -0500)
committerDavid Robillard <d@drobilla.net>
Mon, 17 Nov 2014 03:35:45 +0000 (22:35 -0500)
This should probably hijack the same modifier as the guard points and work the
same on all automation tracks, but I did it this way to not change behaviour of
track automation where a default is much more reasonable.

gtk2_ardour/automation_region_view.cc
libs/evoral/evoral/ControlList.hpp
libs/evoral/src/ControlList.cpp

index 2726cf04559aed87b2d15465df8e5d973e7ccd1f..59bc1f62502209c3ad046f8d26916da3994e89b5 100644 (file)
@@ -176,7 +176,7 @@ AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double
        view->session()->begin_reversible_command (_("add automation event"));
        XMLNode& before = _line->the_list()->get_state();
 
-       _line->the_list()->add (when_d, y, with_guard_points);
+       _line->the_list()->add (when_d, y, with_guard_points, false);
 
        XMLNode& after = _line->the_list()->get_state();
 
index daa4aa93a6bf2f38946dfaede0459731aa5df875..3c4b192159ca164109227b7948249c2a5d6277f4 100644 (file)
@@ -121,7 +121,7 @@ public:
 
        virtual bool clamp_value (double& /*when*/, double& /*value*/) const { return true; }
 
-       virtual void add (double when, double value, bool with_guards=true);
+       virtual void add (double when, double value, bool with_guards=true, bool with_default=true);
        virtual void editor_add (double when, double value);
        
        void fast_simple_add (double when, double value);
index 67172617136944001ba6bfa2f7be759b97741e05..bc8626c535b41d3fc8ac927d547ba2f64c585a6e 100644 (file)
@@ -477,7 +477,7 @@ ControlList::editor_add (double when, double value)
 }
 
 void
-ControlList::add (double when, double value, bool with_guards)
+ControlList::add (double when, double value, bool with_guards, bool with_default)
 {
        /* this is for making changes from some kind of user interface or
           control surface (GUI, MIDI, OSC etc)
@@ -494,7 +494,7 @@ ControlList::add (double when, double value, bool with_guards)
                ControlEvent cp (when, 0.0f);
                iterator insertion_point;
 
-               if (_events.empty()) {
+               if (_events.empty() && with_default) {
                        
                        /* as long as the point we're adding is not at zero,
                         * add an "anchor" point there.