summaryrefslogtreecommitdiff
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
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)
-rw-r--r--gtk2_ardour/automation_controller.cc43
-rw-r--r--gtk2_ardour/automation_controller.h3
-rw-r--r--gtk2_ardour/route_ui.cc8
3 files changed, 27 insertions, 27 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
diff --git a/gtk2_ardour/automation_controller.h b/gtk2_ardour/automation_controller.h
index 126383d517..7c0e2139d2 100644
--- a/gtk2_ardour/automation_controller.h
+++ b/gtk2_ardour/automation_controller.h
@@ -86,7 +86,8 @@ private:
void start_touch();
void end_touch();
- void toggled();
+ bool button_press(GdkEventButton*);
+ bool button_release(GdkEventButton*);
void run_note_select_dialog();
void set_ratio(double ratio);
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 0e1a047833..1802425a5a 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -492,6 +492,8 @@ RouteUI::mute_press (GdkEventButton* ev)
_mute_release->routes = rl;
}
+ boost::shared_ptr<MuteControl> mc = _route->mute_control();
+ mc->start_touch (_session->audible_frame ());
_session->set_controls (route_list_to_control_list (rl, &Stripable::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::InverseGroup);
}
@@ -506,7 +508,9 @@ RouteUI::mute_press (GdkEventButton* ev)
_mute_release->routes = rl;
}
- _route->mute_control()->set_value (!_route->muted_by_self(), Controllable::UseGroup);
+ boost::shared_ptr<MuteControl> mc = _route->mute_control();
+ mc->start_touch (_session->audible_frame ());
+ mc->set_value (!_route->muted_by_self(), Controllable::UseGroup);
}
}
}
@@ -523,6 +527,8 @@ RouteUI::mute_release (GdkEventButton* /*ev*/)
_mute_release = 0;
}
+ _route->mute_control()->stop_touch (false, _session->audible_frame ());
+
return false;
}