OSC: make send enables work in MB
authorLen Ovens <len@ovenwerks.net>
Fri, 29 Jul 2016 00:51:12 +0000 (17:51 -0700)
committerLen Ovens <len@ovenwerks.net>
Fri, 29 Jul 2016 00:51:12 +0000 (17:51 -0700)
libs/surfaces/osc/osc_select_observer.cc
libs/surfaces/osc/osc_select_observer.h

index 99c1c2c82f883570a49624491cc4318c442a867b..300d37eaf6c2cda5233185ae054efa17d30d338c 100644 (file)
@@ -145,8 +145,8 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> s, lo_address
                }
                // Compressor
                if (_strip->comp_enable_controllable ()) {
-                       _strip->comp_enable_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/comp_enable"), _strip->comp_enable_controllable()), OSC::instance());
-                       change_message ("/select/comp_enable", _strip->comp_enable_controllable());
+                       _strip->comp_enable_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message, this, X_("/select/comp_enable"), _strip->comp_enable_controllable()), OSC::instance());
+                       enable_message ("/select/comp_enable", _strip->comp_enable_controllable());
                }
                if (_strip->comp_threshold_controllable ()) {
                        _strip->comp_threshold_controllable ()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/comp_threshold"), _strip->comp_threshold_controllable()), OSC::instance());
@@ -243,8 +243,8 @@ OSCSelectObserver::send_init()
                }
 
                if (_strip->send_enable_controllable (nsends)) {
-                       _strip->send_enable_controllable(nsends)->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message_with_id, this, X_("/select/send_enable"), nsends + 1, _strip->send_enable_controllable(nsends)), OSC::instance());
-                       change_message_with_id ("/select/send_enable", nsends + 1, _strip->send_enable_controllable(nsends));
+                       _strip->send_enable_controllable(nsends)->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message_with_id, this, X_("/select/send_enable"), nsends + 1, _strip->send_enable_controllable(nsends)), OSC::instance());
+                       enable_message_with_id ("/select/send_enable", nsends + 1, _strip->send_enable_controllable(nsends));
                        sends = true;
                } else if (sends) {
                        // not used by Ardour, just mixbus so in Ardour always true
@@ -370,6 +370,18 @@ OSCSelectObserver::change_message (string path, boost::shared_ptr<Controllable>
        lo_message_free (msg);
 }
 
+void
+OSCSelectObserver::enable_message (string path, boost::shared_ptr<Controllable> controllable)
+{
+       float val = controllable->get_value();
+       if (val) {
+               clear_strip (path, 1);
+       } else {
+               clear_strip (path, 0);
+       }
+
+}
+
 void
 OSCSelectObserver::change_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
 {
@@ -387,6 +399,17 @@ OSCSelectObserver::change_message_with_id (string path, uint32_t id, boost::shar
        lo_message_free (msg);
 }
 
+void
+OSCSelectObserver::enable_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
+{
+       float val = controllable->get_value();
+       if (val) {
+               clear_strip_with_id (path, id, 1);
+       } else {
+               clear_strip_with_id (path, id, 0);
+       }
+}
+
 void
 OSCSelectObserver::text_message (string path, std::string text)
 {
@@ -522,8 +545,8 @@ OSCSelectObserver::eq_init()
                change_message ("/select/eq_hpf", _strip->eq_hpf_controllable());
        }
        if (_strip->eq_enable_controllable ()) {
-               _strip->eq_enable_controllable ()->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_enable"), _strip->eq_enable_controllable()), OSC::instance());
-               change_message ("/select/eq_enable", _strip->eq_enable_controllable());
+               _strip->eq_enable_controllable ()->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message, this, X_("/select/eq_enable"), _strip->eq_enable_controllable()), OSC::instance());
+               enable_message ("/select/eq_enable", _strip->eq_enable_controllable());
        }
 
        uint32_t eq_bands = _strip->eq_band_cnt ();
index d751ec2b3e29cfbb9d87bff911c886326a52261b..7d4f2f00d728f36fa4e22f88a078295bf4cd917a 100644 (file)
@@ -59,8 +59,10 @@ class OSCSelectObserver
 
        void name_changed (const PBD::PropertyChange& what_changed);
        void change_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable);
+       void enable_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable);
        void comp_mode (void);
        void change_message_with_id (std::string path, uint32_t id, boost::shared_ptr<PBD::Controllable> controllable);
+       void enable_message_with_id (std::string path, uint32_t id, boost::shared_ptr<PBD::Controllable> controllable);
        void text_message (std::string path, std::string text);
        void text_with_id (std::string path, uint32_t id, std::string name);
        void monitor_status (boost::shared_ptr<PBD::Controllable> controllable);