diff options
author | Robin Gareus <robin@gareus.org> | 2015-04-25 20:20:03 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-04-25 21:25:29 +0200 |
commit | 9d3e32be2d34643f431798b933b3f1ca56342a35 (patch) | |
tree | 5ff8ce853d41edc41497a19035592eac77ca3d5d /gtk2_ardour/ardour_knob.cc | |
parent | 52d67203a10d3223f9f283fb56803b7979a0c2bd (diff) |
ardour knob: watch automation
Diffstat (limited to 'gtk2_ardour/ardour_knob.cc')
-rw-r--r-- | gtk2_ardour/ardour_knob.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gtk2_ardour/ardour_knob.cc b/gtk2_ardour/ardour_knob.cc index bfc3c88057..cff2acd4e3 100644 --- a/gtk2_ardour/ardour_knob.cc +++ b/gtk2_ardour/ardour_knob.cc @@ -37,6 +37,7 @@ #include "ardour_knob.h" #include "ardour_ui.h" #include "global_signals.h" +#include "timers.h" #include "canvas/colors.h" #include "canvas/utils.h" @@ -66,6 +67,9 @@ ArdourKnob::ArdourKnob (Element e, Flags flags) , _tooltip (this) { ARDOUR_UI_UTILS::ColorsChanged.connect (sigc::mem_fun (*this, &ArdourKnob::color_handler)); + + // watch automation :( + Timers::rapid_connect (sigc::mem_fun (*this, &ArdourKnob::controllable_changed)); } ArdourKnob::~ArdourKnob() @@ -451,7 +455,7 @@ ArdourKnob::on_size_allocate (Allocation& alloc) void ArdourKnob::set_controllable (boost::shared_ptr<Controllable> c) { - watch_connection.disconnect (); //stop watching the old controllable + watch_connection.disconnect (); //stop watching the old controllable if (!c) return; @@ -468,10 +472,16 @@ void ArdourKnob::controllable_changed () { boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable(); + if (!c) return; - _val = c->get_interface(); //% of knob travel - _val = min( max(0.0f, _val), 1.0f); //range check + float val = c->get_interface(); + val = min( max(0.0f, val), 1.0f); // clamp + + if (val == _val) { + return; + } + _val = val; if (!_tooltip_prefix.empty()) { _tooltip.set_tip (_tooltip_prefix + c->get_user_string()); } |