OSC: fix issue #7444 send fader position/gain even when 0.
[ardour.git] / libs / surfaces / osc / osc_route_observer.cc
index 550fd396a08ee584adcc61c2eceeb1e172aa0470..03e257802225629344579897e0bb62f6be6e3b40 100644 (file)
@@ -42,8 +42,8 @@ OSCRouteObserver::OSCRouteObserver (boost::shared_ptr<Stripable> s, uint32_t ss,
        : _strip (s)
        ,ssid (ss)
        ,sur (su)
-       ,_last_gain (0.0)
-       ,_last_trim (0.0)
+       ,_last_gain (-1.0)
+       ,_last_trim (-1.0)
        ,_init (true)
 {
        addr = lo_address_new_from_url  (sur->remote_url.c_str());
@@ -61,11 +61,15 @@ OSCRouteObserver::OSCRouteObserver (boost::shared_ptr<Stripable> s, uint32_t ss,
                _strip->solo_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/solo"), _strip->solo_control()), OSC::instance());
                send_change_message ("/strip/solo", _strip->solo_control());
 
-               _strip->solo_isolate_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/solo_iso"), _strip->solo_isolate_control()), OSC::instance());
-               send_change_message ("/strip/solo_iso", _strip->solo_isolate_control());
+               if (_strip->solo_isolate_control()) {
+                       _strip->solo_isolate_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/solo_iso"), _strip->solo_isolate_control()), OSC::instance());
+                       send_change_message ("/strip/solo_iso", _strip->solo_isolate_control());
+               }
 
-               _strip->solo_safe_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/solo_safe"), _strip->solo_safe_control()), OSC::instance());
-               send_change_message ("/strip/solo_safe", _strip->solo_safe_control());
+               if (_strip->solo_safe_control()) {
+                       _strip->solo_safe_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCRouteObserver::send_change_message, this, X_("/strip/solo_safe"), _strip->solo_safe_control()), OSC::instance());
+                       send_change_message ("/strip/solo_safe", _strip->solo_safe_control());
+               }
 
                boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (_strip);
                if (track) {
@@ -242,6 +246,7 @@ OSCRouteObserver::tick ()
                                _last_gain = _strip->gain_control()->get_value();
                                if (gainmode) {
                                        send_gain_message ("/strip/fader", _strip->gain_control());
+                                       gain_timeout = 8;
                                } else {
                                        send_gain_message ("/strip/gain", _strip->gain_control());
                                }