+int
+OSC::route_plugin_activate (int ssid, int piid, lo_message msg)
+{
+ if (!session)
+ return -1;
+ boost::shared_ptr<Stripable> s = get_strip (ssid, lo_message_get_source (msg));
+
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (s);
+
+ if (!r) {
+ PBD::error << "OSC: Invalid Remote Control ID '" << ssid << "'" << endmsg;
+ return -1;
+ }
+
+ boost::shared_ptr<Processor> redi=r->nth_plugin (piid - 1);
+
+ if (!redi) {
+ PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg;
+ return -1;
+ }
+
+ boost::shared_ptr<PluginInsert> pi;
+
+ if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(redi))) {
+ PBD::error << "OSC: given processor # " << piid << " on RID '" << ssid << "' is not a Plugin." << endmsg;
+ return -1;
+ }
+
+ boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
+ pi->activate();
+
+ return 0;
+}
+
+int
+OSC::route_plugin_deactivate (int ssid, int piid, lo_message msg)
+{
+ if (!session)
+ return -1;
+ boost::shared_ptr<Stripable> s = get_strip (ssid, lo_message_get_source (msg));
+
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (s);
+
+ if (!r) {
+ PBD::error << "OSC: Invalid Remote Control ID '" << ssid << "'" << endmsg;
+ return -1;
+ }
+
+ boost::shared_ptr<Processor> redi=r->nth_plugin (piid - 1);
+
+ if (!redi) {
+ PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg;
+ return -1;
+ }
+
+ boost::shared_ptr<PluginInsert> pi;
+
+ if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(redi))) {
+ PBD::error << "OSC: given processor # " << piid << " on RID '" << ssid << "' is not a Plugin." << endmsg;
+ return -1;
+ }
+
+ boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
+ pi->deactivate();
+
+ return 0;
+}
+
+// select
+
+int
+OSC::sel_pan_elevation (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->pan_elevation_control()) {
+ s->pan_elevation_control()->set_value (s->pan_elevation_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("pan_elevation_position", 0, get_address (msg));
+}
+
+int
+OSC::sel_pan_frontback (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->pan_frontback_control()) {
+ s->pan_frontback_control()->set_value (s->pan_frontback_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("pan_frontback_position", 0.5, get_address (msg));
+}
+
+int
+OSC::sel_pan_lfe (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->pan_lfe_control()) {
+ s->pan_lfe_control()->set_value (s->pan_lfe_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("pan_lfe_control", 0, get_address (msg));
+}
+
+// compressor control
+int
+OSC::sel_comp_enable (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_enable_controllable()) {
+ s->comp_enable_controllable()->set_value (s->comp_enable_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_enable", 0, get_address (msg));
+}
+
+int
+OSC::sel_comp_threshold (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_threshold_controllable()) {
+ s->comp_threshold_controllable()->set_value (s->comp_threshold_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_threshold", 0, get_address (msg));
+}
+
+int
+OSC::sel_comp_speed (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_speed_controllable()) {
+ s->comp_speed_controllable()->set_value (s->comp_speed_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_speed", 0, get_address (msg));
+}
+
+int
+OSC::sel_comp_mode (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_mode_controllable()) {
+ s->comp_mode_controllable()->set_value (s->comp_mode_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_mode", 0, get_address (msg));
+}
+
+int
+OSC::sel_comp_makeup (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_makeup_controllable()) {
+ s->comp_makeup_controllable()->set_value (s->comp_makeup_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_makeup", 0, get_address (msg));
+}
+
+// EQ control
+
+int
+OSC::sel_eq_enable (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->eq_enable_controllable()) {
+ s->eq_enable_controllable()->set_value (s->eq_enable_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_enable", 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_hpf (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->eq_hpf_controllable()) {
+ s->eq_hpf_controllable()->set_value (s->eq_hpf_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_hpf", 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_gain (int id, float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (id > 0) {
+ --id;
+ }
+ if (s->eq_gain_controllable (id)) {
+ s->eq_gain_controllable (id)->set_value (s->eq_gain_controllable(id)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_send_fail ("eq_gain", id + 1, 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_freq (int id, float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (id > 0) {
+ --id;
+ }
+ if (s->eq_freq_controllable (id)) {
+ s->eq_freq_controllable (id)->set_value (s->eq_freq_controllable(id)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_send_fail ("eq_freq", id + 1, 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_q (int id, float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (id > 0) {
+ --id;
+ }
+ if (s->eq_q_controllable (id)) {
+ s->eq_q_controllable (id)->set_value (s->eq_q_controllable(id)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_send_fail ("eq_q", id + 1, 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_shape (int id, float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (id > 0) {
+ --id;
+ }
+ if (s->eq_shape_controllable (id)) {
+ s->eq_shape_controllable (id)->set_value (s->eq_shape_controllable(id)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_send_fail ("eq_shape", id + 1, 0, get_address (msg));
+}
+