summaryrefslogtreecommitdiff
path: root/gtk2_ardour/processor_box.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-07-15 20:50:26 +0200
committerRobin Gareus <robin@gareus.org>2017-07-16 16:58:00 +0200
commit5aecfc5acb41f6d05804a88b99eec159e96a66c9 (patch)
treefbe3b294fc30297e479d4c776e5fc74cb033dd34 /gtk2_ardour/processor_box.cc
parent69ecb0db70996a5c1092efe712d195ffcff5e8b1 (diff)
Remove Timers to watch Controllable values
Depend on Changed() signals alone, which are usually much less frequent than rapid-timer events. As side-effect we now need to make the widgets insensitive when playing automation. Previously the user could not change the value because the Timer periodically reset it.
Diffstat (limited to 'gtk2_ardour/processor_box.cc')
-rw-r--r--gtk2_ardour/processor_box.cc39
1 files changed, 26 insertions, 13 deletions
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index eb5fa585c2..876165e5d3 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -823,8 +823,11 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
_button.signal_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked));
_button.signal_led_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked_event));
- // dup. currently timers are used :(
- //c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
+ c->Changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_changed, this), gui_context ());
+ if (c->alist ()) {
+ c->alist()->automation_state_changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_automation_state_changed, this), gui_context());
+ control_automation_state_changed ();
+ }
} else {
@@ -848,14 +851,13 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
_slider.set_default_value (normal);
_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &Control::slider_adjusted));
- // dup. currently timers are used :(
- //c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
+ c->Changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_changed, this), gui_context ());
+ if (c->alist ()) {
+ c->alist()->automation_state_changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_automation_state_changed, this), gui_context());
+ control_automation_state_changed ();
+ }
}
- // yuck, do we really need to do this?
- // according to c404374 this is only needed for send automation
- timer_connection = Timers::rapid_connect (sigc::mem_fun (*this, &Control::control_changed));
-
control_changed ();
set_tooltip ();
@@ -865,7 +867,6 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
ProcessorEntry::Control::~Control ()
{
- timer_connection.disconnect ();
}
void
@@ -924,6 +925,21 @@ ProcessorEntry::Control::button_clicked_event (GdkEventButton *ev)
}
void
+ProcessorEntry::Control::control_automation_state_changed ()
+{
+ boost::shared_ptr<AutomationControl> c = _control.lock ();
+ if (!c) {
+ return;
+ }
+ bool x = c->alist()->automation_state() & Play;
+ if (c->toggled ()) {
+ _button.set_sensitive (!x);
+ } else {
+ _slider.set_sensitive (!x);
+ }
+}
+
+void
ProcessorEntry::Control::control_changed ()
{
boost::shared_ptr<AutomationControl> c = _control.lock ();
@@ -934,12 +950,9 @@ ProcessorEntry::Control::control_changed ()
_ignore_ui_adjustment = true;
if (c->toggled ()) {
-
_button.set_active (c->get_value() > 0.5);
-
} else {
- // as long as rapid timers are used, only update the tooltip
- // if the value has changed.
+ // Note: the _slider watches the controllable by itself
const double nval = c->internal_to_interface (c->get_value ());
if (_adjustment.get_value() != nval) {
_adjustment.set_value (nval);