OSC: Added pan width to selected
authorLen Ovens <len@ovenwerks.net>
Thu, 9 Jun 2016 18:11:48 +0000 (11:11 -0700)
committerLen Ovens <len@ovenwerks.net>
Thu, 9 Jun 2016 18:11:48 +0000 (11:11 -0700)
libs/surfaces/osc/osc.cc
libs/surfaces/osc/osc.h
libs/surfaces/osc/osc_select_observer.cc

index ff5c093758be5819ce81703f8336b188cf709147..12ba1f552a88b7c193708636fbd2f14b70160894 100644 (file)
@@ -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));
        }
 }
 
index 55a0a09aedeb1feee931dd0d88d59805160699f0..2818226143e84d290afebd4116dc062165cb92de 100644 (file)
@@ -337,6 +337,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
        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<OSCUIRequest>
        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<ARDOUR::Stripable>, lo_address);
        void end_listen (boost::shared_ptr<ARDOUR::Stripable>, lo_address);
index c6cbaaecbdd2c86bb62f8424bf0be2ce8df4639c..0b57bda728e3f15b53a45ace4c820186bdba6e23 100644 (file)
@@ -92,6 +92,13 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> 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<Controllable> width_controllable = boost::dynamic_pointer_cast<Controllable>(_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<Route> r = boost::dynamic_pointer_cast<Route>(_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);