From 37aed5715b69428f86b169377f9597e563fff7df Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Thu, 9 Jun 2016 12:07:57 -0700 Subject: OSC: add phase control --- libs/surfaces/osc/osc.cc | 31 +++++++++++++++++++++++++++++++ libs/surfaces/osc/osc.h | 4 ++++ libs/surfaces/osc/osc_select_observer.cc | 12 +++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 12ba1f552a..68bea263f2 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -46,6 +46,7 @@ #include "ardour/plugin_insert.h" #include "ardour/presentation_info.h" #include "ardour/send.h" +#include "ardour/phase_control.h" #include "osc_select_observer.h" #include "osc.h" @@ -526,6 +527,8 @@ OSC::register_callbacks() REGISTER_CALLBACK (serv, "/select/pan_stereo_position", "f", sel_pan_position); REGISTER_CALLBACK (serv, "/select/pan_stereo_width", "f", sel_pan_width); + REGISTER_CALLBACK (serv, "/select/phase", "i", sel_phase); + /* 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); REGISTER_CALLBACK (serv, "/strip/solo", "ii", route_solo); @@ -535,6 +538,7 @@ OSC::register_callbacks() REGISTER_CALLBACK (serv, "/strip/monitor_disk", "ii", route_monitor_disk); REGISTER_CALLBACK (serv, "/strip/select", "ii", strip_select); REGISTER_CALLBACK (serv, "/strip/gui_select", "ii", strip_gui_select); + REGISTER_CALLBACK (serv, "/strip/phase", "ii", strip_phase); REGISTER_CALLBACK (serv, "/strip/gain", "if", route_set_gain_dB); REGISTER_CALLBACK (serv, "/strip/fader", "if", route_set_gain_fader); REGISTER_CALLBACK (serv, "/strip/trimabs", "if", route_set_trim_abs); @@ -1677,6 +1681,33 @@ OSC::sel_monitor_disk (uint32_t yn, lo_message msg) } } + +int +OSC::strip_phase (int ssid, int yn, lo_message msg) +{ + if (!session) return -1; + int rid = get_rid (ssid, lo_message_get_source (msg)); + + boost::shared_ptr s = session->get_remote_nth_stripable (rid, PresentationInfo::Route); + + if (s) { + s->phase_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup); + } + + return 0; +} + +int +OSC::sel_phase (uint32_t yn, lo_message msg) +{ + OSCSurface *sur = get_surface(lo_message_get_source (msg)); + if (sur->surface_sel) { + return strip_phase(sur->surface_sel, yn, msg); + } else { + return route_send_fail ("phase", 0, 0, lo_message_get_source (msg)); + } +} + int OSC::strip_select (int ssid, int yn, lo_message msg) { diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 2818226143..5b021bcda7 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -333,6 +333,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI PATH_CALLBACK1_MSG(sel_solo,i); PATH_CALLBACK1_MSG(sel_monitor_input,i); PATH_CALLBACK1_MSG(sel_monitor_disk,i); + PATH_CALLBACK1_MSG(sel_phase,i); PATH_CALLBACK1_MSG(sel_gain,f); PATH_CALLBACK1_MSG(sel_fader,f); PATH_CALLBACK1_MSG(sel_trim,f); @@ -396,6 +397,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI PATH_CALLBACK2_MSG(route_recsafe,i,i); PATH_CALLBACK2_MSG(route_monitor_input,i,i); PATH_CALLBACK2_MSG(route_monitor_disk,i,i); + PATH_CALLBACK2_MSG(strip_phase,i,i); PATH_CALLBACK2_MSG(strip_select,i,i); PATH_CALLBACK2_MSG(strip_gui_select,i,i); PATH_CALLBACK2_MSG(route_set_gain_abs,i,f); @@ -417,6 +419,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI int route_recsafe (int ssid, int yn, lo_message msg); int route_monitor_input (int rid, int yn, lo_message msg); int route_monitor_disk (int rid, int yn, lo_message msg); + int strip_phase (int rid, int yn, lo_message msg); int strip_select (int rid, int yn, lo_message msg); int _strip_select (int rid, lo_address addr); int strip_gui_select (int rid, int yn, lo_message msg); @@ -456,6 +459,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI int sel_solo (uint32_t state, lo_message msg); int sel_monitor_input (uint32_t state, lo_message msg); int sel_monitor_disk (uint32_t state, lo_message msg); + int sel_phase (uint32_t state, lo_message msg); int sel_gain (float state, lo_message msg); int sel_fader (float state, lo_message msg); int sel_trim (float val, lo_message msg); diff --git a/libs/surfaces/osc/osc_select_observer.cc b/libs/surfaces/osc/osc_select_observer.cc index 0b57bda728..9ba55e4834 100644 --- a/libs/surfaces/osc/osc_select_observer.cc +++ b/libs/surfaces/osc/osc_select_observer.cc @@ -24,6 +24,7 @@ #include "ardour/monitor_control.h" #include "ardour/dB.h" #include "ardour/meter.h" +#include "ardour/phase_control.h" #include "osc.h" #include "osc_select_observer.h" @@ -65,11 +66,19 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr s, lo_address rec_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_change_message, this, X_("/select/recenable"), _strip->rec_enable_control()), OSC::instance()); send_change_message ("/select/recenable", _strip->rec_enable_control()); } + boost::shared_ptr recsafe_controllable = _strip->rec_safe_control (); - if (rec_controllable) { + if (recsafe_controllable) { recsafe_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_change_message, this, X_("/select/record_safe"), _strip->rec_safe_control()), OSC::instance()); send_change_message ("/select/record_safe", _strip->rec_safe_control()); } + + boost::shared_ptr phase_controllable = _strip->phase_control (); + if (phase_controllable) { + phase_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_change_message, this, X_("/select/phase"), _strip->phase_control()), OSC::instance()); + send_change_message ("/select/phase", _strip->phase_control()); + } + } if (feedback[1]) { // level controls @@ -125,6 +134,7 @@ OSCSelectObserver::~OSCSelectObserver () clear_strip ("/select/record_safe", 0); clear_strip ("/select/monitor_input", 0); clear_strip ("/select/monitor_disk", 0); + clear_strip ("/select/phase", 0); } if (feedback[1]) { // level controls if (gainmode) { -- cgit v1.2.3