summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/automation_time_axis.cc2
-rw-r--r--libs/ardour/automation_control.cc2
-rw-r--r--libs/evoral/evoral/ControlList.hpp2
-rw-r--r--libs/evoral/src/ControlList.cpp33
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/pixfader.h1
-rw-r--r--libs/gtkmm2ext/pixfader.cc14
6 files changed, 39 insertions, 15 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 01f2ebb514..6d3a506cfa 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -449,7 +449,7 @@ AutomationTimeAxisView::clear_clicked ()
} else if (_view) {
_view->clear ();
}
-
+ set_automation_state ((AutoState) ARDOUR::Off);
_editor.commit_reversible_command ();
_session->set_dirty ();
}
diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc
index 21952038cf..da33ad12a5 100644
--- a/libs/ardour/automation_control.cc
+++ b/libs/ardour/automation_control.cc
@@ -116,6 +116,8 @@ AutomationControl::start_touch(double when)
if (!_list) return;
if (!touching()) {
if (alist()->automation_state() == Touch) {
+ /* subtle. aligns the user value with the playback */
+ set_value (get_value ());
alist()->start_touch (when);
if (!_desc.toggled) {
AutomationWatch::instance().add_automation_watch (shared_from_this());
diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp
index 7a828264bd..d2be604e5e 100644
--- a/libs/evoral/evoral/ControlList.hpp
+++ b/libs/evoral/evoral/ControlList.hpp
@@ -124,7 +124,7 @@ public:
void slide (iterator before, double distance);
void shift (double before, double distance);
- virtual void add (double when, double value, bool with_guards=true, bool with_default=true);
+ virtual void add (double when, double value, bool with_guards=true, bool with_initial=true);
virtual void editor_add (double when, double value);
void fast_simple_add (double when, double value);
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index a2f3aa4f33..2f1d8f4243 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -399,7 +399,7 @@ ControlList::add_guard_point (double when)
most_recent_insert_iterator = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
double eval_value = unlocked_eval (insert_position);
-
+
if (most_recent_insert_iterator == _events.end()) {
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert iterator at end, adding eval-value there %2\n", this, eval_value));
@@ -407,7 +407,7 @@ ControlList::add_guard_point (double when)
/* leave insert iterator at the end */
} else if ((*most_recent_insert_iterator)->when == when) {
-
+
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert iterator at existing point, setting eval-value there %2\n", this, eval_value));
/* most_recent_insert_iterator points to a control event
@@ -415,15 +415,15 @@ ControlList::add_guard_point (double when)
nothing to do.
... except ...
-
+
advance most_recent_insert_iterator so that the "real"
insert occurs in the right place, since it
points to the control event just inserted.
*/
-
+
++most_recent_insert_iterator;
} else {
-
+
/* insert a new control event at the right spot
*/
@@ -431,7 +431,7 @@ ControlList::add_guard_point (double when)
this, eval_value, (*most_recent_insert_iterator)->when));
most_recent_insert_iterator = _events.insert (most_recent_insert_iterator, new ControlEvent (when, eval_value));
-
+
/* advance most_recent_insert_iterator so that the "real"
* insert occurs in the right place, since it
* points to the control event just inserted.
@@ -546,7 +546,7 @@ ControlList::erase_from_iterator_to (iterator iter, double when)
}
void
-ControlList::add (double when, double value, bool with_guards, bool with_default)
+ControlList::add (double when, double value, bool with_guards, bool with_initial)
{
/* this is for making changes from some kind of user interface or
control surface (GUI, MIDI, OSC etc)
@@ -561,12 +561,12 @@ ControlList::add (double when, double value, bool with_guards, bool with_default
ControlEvent cp (when, 0.0f);
iterator insertion_point;
- if (_events.empty() && with_default) {
+ if (_events.empty() && with_initial) {
/* empty: add an "anchor" point if the point we're adding past time 0 */
if (when >= 1) {
- _events.insert (_events.end(), new ControlEvent (0, _default_value));
+ _events.insert (_events.end(), new ControlEvent (0, value));
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added default value %2 at zero\n", this, _default_value));
}
}
@@ -628,10 +628,19 @@ ControlList::add (double when, double value, bool with_guards, bool with_default
if ((*most_recent_insert_iterator)->value != value) {
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 reset existing point to new value %2\n", this, value));
- /* only one point allowed per time point, so just
- * reset the value here.
+ /* only one point allowed per time point, so add a guard point
+ * 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
diff --git a/libs/gtkmm2ext/gtkmm2ext/pixfader.h b/libs/gtkmm2ext/gtkmm2ext/pixfader.h
index f137a4ed65..0a316340b4 100644
--- a/libs/gtkmm2ext/gtkmm2ext/pixfader.h
+++ b/libs/gtkmm2ext/gtkmm2ext/pixfader.h
@@ -58,6 +58,7 @@ class LIBGTKMM2EXT_API PixFader : public CairoWidget
void on_size_allocate (Gtk::Allocation& alloc);
void render (cairo_t *, cairo_rectangle_t*);
+ bool on_grab_broken_event (GdkEventGrabBroken*);
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
bool on_motion_notify_event (GdkEventMotion*);
diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc
index b140d7b56b..1e814fd147 100644
--- a/libs/gtkmm2ext/pixfader.cc
+++ b/libs/gtkmm2ext/pixfader.cc
@@ -71,7 +71,7 @@ PixFader::PixFader (Gtk::Adjustment& adj, int orientation, int fader_length, int
_adjustment.signal_value_changed().connect (mem_fun (*this, &PixFader::adjustment_changed));
_adjustment.signal_changed().connect (mem_fun (*this, &PixFader::adjustment_changed));
-
+ signal_grab_broken_event ().connect (mem_fun (*this, &PixFader::on_grab_broken_event));
if (_orien == VERT) {
CairoWidget::set_size_request(_girth, _span);
} else {
@@ -366,6 +366,18 @@ PixFader::on_size_allocate (Gtk::Allocation& alloc)
}
bool
+PixFader::on_grab_broken_event (GdkEventGrabBroken* ev)
+{
+ if (_dragging) {
+ remove_modal_grab();
+ _dragging = false;
+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
+ StopGesture ();
+ }
+ return (_tweaks & NoButtonForward) ? true : false;
+}
+
+bool
PixFader::on_button_press_event (GdkEventButton* ev)
{
if (ev->type != GDK_BUTTON_PRESS) {