diff options
author | Len Ovens <len@ovenwerks.net> | 2018-02-06 08:47:12 -0800 |
---|---|---|
committer | Len Ovens <len@ovenwerks.net> | 2018-02-16 13:10:20 -0800 |
commit | 3ac47220a0ddd24a89ff6603934ac3b7b7613fe2 (patch) | |
tree | 2cfea8de1d3c189eabf011d3c3edb9d44c78381d | |
parent | b9c9777b9a2be6fab826fd1236820bb67859d292 (diff) |
OSC: Add /group/list so surface can get a list of groups
-rw-r--r-- | libs/surfaces/osc/osc.cc | 28 | ||||
-rw-r--r-- | libs/surfaces/osc/osc.h | 4 | ||||
-rw-r--r-- | libs/surfaces/osc/osc_global_observer.cc | 18 | ||||
-rw-r--r-- | libs/surfaces/osc/osc_global_observer.h | 2 |
4 files changed, 52 insertions, 0 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 6507408f68..32cf1c311e 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -37,6 +37,7 @@ #include "ardour/amp.h" #include "ardour/session.h" #include "ardour/route.h" +#include "ardour/route_group.h" #include "ardour/audio_track.h" #include "ardour/midi_track.h" #include "ardour/vca.h" @@ -415,6 +416,8 @@ OSC::register_callbacks() REGISTER_CALLBACK (serv, "/refresh", "f", refresh_surface); REGISTER_CALLBACK (serv, "/strip/list", "", routes_list); REGISTER_CALLBACK (serv, "/strip/list", "f", routes_list); + REGISTER_CALLBACK (serv, "/group/list", "", group_list); + REGISTER_CALLBACK (serv, "/group/list", "f", group_list); REGISTER_CALLBACK (serv, "/strip/custom/mode", "f", custom_mode); REGISTER_CALLBACK (serv, "/strip/custom/clear", "f", custom_clear); REGISTER_CALLBACK (serv, "/strip/custom/clear", "", custom_clear); @@ -2964,6 +2967,31 @@ OSC::set_marker (const char* types, lo_arg **argv, int argc, lo_message msg) } int +OSC::group_list (lo_message msg) +{ + return send_group_list (get_address (msg)); +} + +int +OSC::send_group_list (lo_address addr) +{ + //std::list<RouteGroup*> const & route_groups () const { + lo_message reply; + reply = lo_message_new (); + + lo_message_add_string (reply, X_("none")); + + std::list<RouteGroup*> groups = session->route_groups (); + for (std::list<RouteGroup *>::iterator i = groups.begin(); i != groups.end(); ++i) { + RouteGroup *rg = *i; + lo_message_add_string (reply, rg->name().c_str()); + } + lo_send_message (addr, X_("/group/list"), reply); + lo_message_free (reply); + return 0; +} + +int OSC::click_level (float position) { if (!session) return -1; diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 266a72d88b..36824c78e4 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -96,6 +96,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> int int_message_with_id (std::string, uint32_t ssid, int value, bool in_line, lo_address addr); int text_message_with_id (std::string path, uint32_t ssid, std::string val, bool in_line, lo_address addr); + int send_group_list (lo_address addr); + int start (); int stop (); @@ -301,6 +303,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> int route_get_sends (lo_message msg); int route_get_receives(lo_message msg); void routes_list (lo_message msg); + int group_list (lo_message msg); void surface_list (lo_message msg); void transport_sample (lo_message msg); void transport_speed (lo_message msg); @@ -348,6 +351,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> PATH_CALLBACK_MSG(route_get_sends); PATH_CALLBACK_MSG(route_get_receives); PATH_CALLBACK_MSG(routes_list); + PATH_CALLBACK_MSG(group_list); PATH_CALLBACK_MSG(surface_list); PATH_CALLBACK_MSG(transport_sample); PATH_CALLBACK_MSG(transport_speed); diff --git a/libs/surfaces/osc/osc_global_observer.cc b/libs/surfaces/osc/osc_global_observer.cc index e68858150f..2fe9820fbf 100644 --- a/libs/surfaces/osc/osc_global_observer.cc +++ b/libs/surfaces/osc/osc_global_observer.cc @@ -127,6 +127,11 @@ OSCGlobalObserver::OSCGlobalObserver (OSC& o, Session& s, ArdourSurface::OSC::OS click_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCGlobalObserver::send_change_message, this, X_("/click/level"), click_controllable), OSC::instance()); send_change_message ("/click/level", click_controllable); + session->route_group_added.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&OSCGlobalObserver::group_changed, this, _1), OSC::instance()); + session->route_group_removed.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&OSCGlobalObserver::group_changed, this), OSC::instance()); + session->route_groups_reordered.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&OSCGlobalObserver::group_changed, this), OSC::instance()); + _osc.send_group_list (addr); + extra_check (); jog_mode (jogmode); @@ -205,6 +210,7 @@ OSCGlobalObserver::clear_observer () _osc.float_message (X_("/toggle_punch_in"), 0, addr); _osc.float_message (X_("/toggle_click"), 0, addr); _osc.float_message (X_("/click/level"), 0, addr); + _osc.text_message (X_("/group/list"), " ", addr); _osc.text_message (X_("/jog/mode/name"), " ", addr); _osc.int_message (X_("/jog/mode"), 0, addr); @@ -547,3 +553,15 @@ OSCGlobalObserver::jog_mode (uint32_t jogmode) _osc.int_message (X_("/jog/mode"), jogmode, addr); } +void +OSCGlobalObserver::group_changed (ARDOUR::RouteGroup *rg) +{ + _osc.send_group_list (addr); +} + +void +OSCGlobalObserver::group_changed () +{ + _osc.send_group_list (addr); +} + diff --git a/libs/surfaces/osc/osc_global_observer.h b/libs/surfaces/osc/osc_global_observer.h index a96926cac3..04403d0328 100644 --- a/libs/surfaces/osc/osc_global_observer.h +++ b/libs/surfaces/osc/osc_global_observer.h @@ -98,6 +98,8 @@ class OSCGlobalObserver void extra_check (void); void marks_changed (void); void mark_update (void); + void group_changed (ARDOUR::RouteGroup*); + void group_changed (void); }; #endif /* __osc_oscglobalobserver_h__ */ |