OSC: Add /group/list so surface can get a list of groups
[ardour.git] / libs / surfaces / osc / osc_select_observer.cc
index 542bb402ed4ae581ca470f51613a8f05707512aa..fd9552273894c2638733584fd97a00bdec6ce0d3 100644 (file)
@@ -31,6 +31,7 @@
 #include "ardour/solo_isolate_control.h"
 #include "ardour/solo_safe_control.h"
 #include "ardour/route.h"
+#include "ardour/route_group.h"
 #include "ardour/send.h"
 #include "ardour/plugin.h"
 #include "ardour/plugin_insert.h"
@@ -133,6 +134,13 @@ OSCSelectObserver::refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip
        _strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::name_changed, this, boost::lambda::_1), OSC::instance());
        name_changed (ARDOUR::Properties::name);
 
+       boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (_strip);
+       rt->route_group_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::group_name, this), OSC::instance());
+       group_name ();
+
+       _strip->presentation_info().PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::pi_changed, this, _1), OSC::instance());
+       _osc.float_message ("/select/hide", _strip->is_hidden (), addr);
+
        _strip->mute_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/mute"), _strip->mute_control()), OSC::instance());
        change_message ("/select/mute", _strip->mute_control());
 
@@ -268,6 +276,7 @@ OSCSelectObserver::clear_observer ()
        // all strip buttons should be off and faders 0 and etc.
        _osc.float_message ("/select/expand", 0, addr);
        _osc.text_message ("/select/name", " ", addr);
+       _osc.text_message ("/select/group/name", " ", addr);
        _osc.text_message ("/select/comment", " ", addr);
        _osc.float_message ("/select/mute", 0, addr);
        _osc.float_message ("/select/solo", 0, addr);
@@ -639,6 +648,25 @@ OSCSelectObserver::name_changed (const PBD::PropertyChange& what_changed)
        }
 }
 
+void
+OSCSelectObserver::group_name ()
+{
+       boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (_strip);
+
+       RouteGroup *rg = rt->route_group();
+       if (rg) {
+               _osc.text_message ("/select/group/name", rg->name(), addr);
+       } else {
+               _osc.text_message ("/select/group/name", " ", addr);
+       }
+}
+
+void
+OSCSelectObserver::pi_changed (PBD::PropertyChange const& what_changed)
+{
+       _osc.float_message ("/select/hide", _strip->is_hidden (), addr);
+}
+
 void
 OSCSelectObserver::change_message (string path, boost::shared_ptr<Controllable> controllable)
 {