From 4905422a47c8068951bacb53b55884cf0dec5602 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Thu, 9 Jun 2016 11:11:48 -0700 Subject: OSC: Added pan width to selected --- libs/surfaces/osc/osc.cc | 14 +++++++++++++- libs/surfaces/osc/osc.h | 2 ++ libs/surfaces/osc/osc_select_observer.cc | 8 ++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index ff5c093758..12ba1f552a 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -524,6 +524,7 @@ OSC::register_callbacks() REGISTER_CALLBACK (serv, "/select/fader", "f", sel_fader); REGISTER_CALLBACK (serv, "/select/trimdB", "f", sel_trim); REGISTER_CALLBACK (serv, "/select/pan_stereo_position", "f", sel_pan_position); + REGISTER_CALLBACK (serv, "/select/pan_stereo_width", "f", sel_pan_width); /* These commands require the route index in addition to the arg; TouchOSC (et al) can't use these */ REGISTER_CALLBACK (serv, "/strip/mute", "ii", route_mute); @@ -1881,7 +1882,18 @@ OSC::sel_pan_position (float val, lo_message msg) if (sur->surface_sel) { return route_set_pan_stereo_position (sur->surface_sel, val, msg); } else { - return route_send_fail ("pan_stereo_position", 0, 0, lo_message_get_source (msg)); + return route_send_fail ("pan_stereo_position", 0, 0.5, lo_message_get_source (msg)); + } +} + +int +OSC::sel_pan_width (float val, lo_message msg) +{ + OSCSurface *sur = get_surface(lo_message_get_source (msg)); + if (sur->surface_sel) { + return route_set_pan_stereo_width (sur->surface_sel, val, msg); + } else { + return route_send_fail ("pan_stereo_width", 0, 1, lo_message_get_source (msg)); } } diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 55a0a09aed..2818226143 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -337,6 +337,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI PATH_CALLBACK1_MSG(sel_fader,f); PATH_CALLBACK1_MSG(sel_trim,f); PATH_CALLBACK1_MSG(sel_pan_position,f); + PATH_CALLBACK1_MSG(sel_pan_width,f); #define PATH_CALLBACK2(name,arg1type,arg2type) \ static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \ @@ -459,6 +460,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI int sel_fader (float state, lo_message msg); int sel_trim (float val, lo_message msg); int sel_pan_position (float val, lo_message msg); + int sel_pan_width (float val, lo_message msg); void listen_to_route (boost::shared_ptr, lo_address); void end_listen (boost::shared_ptr, lo_address); diff --git a/libs/surfaces/osc/osc_select_observer.cc b/libs/surfaces/osc/osc_select_observer.cc index c6cbaaecbd..0b57bda728 100644 --- a/libs/surfaces/osc/osc_select_observer.cc +++ b/libs/surfaces/osc/osc_select_observer.cc @@ -92,6 +92,13 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr s, lo_address pan_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_change_message, this, X_("/select/pan_stereo_position"), _strip->pan_azimuth_control()), OSC::instance()); send_change_message ("/select/pan_stereo_position", _strip->pan_azimuth_control()); } + + boost::shared_ptr width_controllable = boost::dynamic_pointer_cast(_strip->pan_width_control()); + if (width_controllable) { + width_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_change_message, this, X_("/select/pan_stereo_width"), _strip->pan_width_control()), OSC::instance()); + send_change_message ("/select/pan_stereo_width", _strip->pan_width_control()); + } + // detecting processor changes requires cast to route boost::shared_ptr r = boost::dynamic_pointer_cast(_strip); r->processors_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_restart, this, -1), OSC::instance()); @@ -127,6 +134,7 @@ OSCSelectObserver::~OSCSelectObserver () } clear_strip ("/select/trimdB", 0); clear_strip ("/select/pan_stereo_position", 0.5); + clear_strip ("/select/pan_stereo_width", 1); } if (feedback[9]) { clear_strip ("/select/signal", 0); -- cgit v1.2.3