summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_controller.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-02-28 04:59:45 +0100
committerRobin Gareus <robin@gareus.org>2017-02-28 05:01:17 +0100
commit5c4a2025f12038ef52efaedf8e71a22d9bae8215 (patch)
tree7efcc403b062ea641d90f3e732cc79dfde84e583 /gtk2_ardour/automation_controller.cc
parent1071c0e788cb8b87d9fd034862892bd30ab26ab6 (diff)
Fix touching mute automation (mostly)
controllable->set_value() from GUI context will eventually queue a session-rt command. By the time the realtime command runs, the controllable needs to be in "touch" mode. The AutomationController "toggle" UI worked around this by directly using the underlying API (ignoring slaved-controls and ignoring groups). The RouteUI's GUI wasn't able to write mute-automation at all. This commit is a compromise: press + hold (touch) + release button. (it may need further special-casing for _desc.toggled in AutomationControl::actually_set_value(), also undoing automation-writes is currently not working correctly)
Diffstat (limited to 'gtk2_ardour/automation_controller.cc')
-rw-r--r--gtk2_ardour/automation_controller.cc43
1 files changed, 18 insertions, 25 deletions
diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc
index 056e36a778..bf2be7ab0d 100644
--- a/gtk2_ardour/automation_controller.cc
+++ b/gtk2_ardour/automation_controller.cc
@@ -87,9 +87,12 @@ AutomationController::AutomationController(boost::shared_ptr<Automatable>
} else {
but->set_name("generic button");
}
+ but->set_fallthrough_to_parent(true);
but->set_controllable(ac);
- but->signal_clicked.connect(
- sigc::mem_fun(*this, &AutomationController::toggled));
+ but->signal_button_press_event().connect(
+ sigc::mem_fun(*this, &AutomationController::button_press));
+ but->signal_button_release_event().connect(
+ sigc::mem_fun(*this, &AutomationController::button_release));
const bool active = _adjustment->get_value() >= 0.5;
if (but->get_active() != active) {
but->set_active(active);
@@ -161,6 +164,7 @@ AutomationController::display_effective_value()
_adjustment->set_value (interface_value);
_ignore_change = false;
}
+
}
void
@@ -206,33 +210,22 @@ AutomationController::end_touch ()
}
}
-void
-AutomationController::toggled ()
+bool
+AutomationController::button_press (GdkEventButton*)
{
ArdourButton* but = dynamic_cast<ArdourButton*>(_widget);
- const AutoState as = _controllable->automation_state ();
- const double where = _controllable->session ().audible_frame ();
- const bool to_list = _controllable->list () && _controllable->session().transport_rolling () && (as == Touch || as == Write);
-
if (but) {
- if (to_list) {
- if (as == Touch && _controllable->list ()->in_new_write_pass ()) {
- _controllable->alist ()->start_write_pass (where);
- }
- _controllable->list ()->set_in_write_pass (true, false, where);
- }
- /* set to opposite value.*/
- _controllable->set_double (but->get_active () ? 0.0 : 1.0, where, to_list);
-
- const bool active = _controllable->get_double (to_list, where) >= 0.5;
- if (active && !but->get_active ()) {
- _adjustment->set_value (1.0);
- but->set_active (true);
- } else if (!active && but->get_active ()) {
- _adjustment->set_value (0.0);
- but->set_active (false);
- }
+ start_touch ();
+ _controllable->set_value (but->get_active () ? 0.0 : 1.0, Controllable::UseGroup);
}
+ return false;
+}
+
+bool
+AutomationController::button_release (GdkEventButton*)
+{
+ end_touch ();
+ return false;
}
static double