From a96aa4e1fdc69da01c30ddd22176b03de39c0016 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Mon, 10 Sep 2018 09:57:19 -0700 Subject: OSC: Personal monitoring can add a new aux --- libs/surfaces/osc/osc.cc | 42 ++++++++++++++++++++++++++++++++++++++++++ libs/surfaces/osc/osc.h | 1 + 2 files changed, 43 insertions(+) diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 95905df87b..689f2a67bf 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -6368,6 +6368,21 @@ OSC::cue_parse (const char *path, const char* types, lo_arg **argv, int argc, lo ret = 0; } } + else if (!strncmp (path, X_("/cue/new_aux"), 12)) { + // Create new Aux bus + string name = ""; + string dest = ""; + if (argc == 2 && types[0] == 's' && types[1] == 's') { + name = &argv[0]->s; + dest = &argv[1]->s; + ret = cue_new_aux (name, dest, msg); + } else if (argc == 1 && types[0] == 's') { + name = &argv[0]->s; + ret = cue_new_aux (name, dest, msg); + } else { + PBD::warning << "OSC: new_aux has wrong number or type of parameters." << endmsg; + } + } else if (!strncmp (path, X_("/cue/next_aux"), 13)) { // switch to next Aux bus if ((!argc) || argv[0]->f || argv[0]->i) { @@ -6464,6 +6479,33 @@ OSC::_cue_set (uint32_t aux, lo_address addr) return ret; } +int +OSC::cue_new_aux (string name, string dest, lo_message msg) +{ + // create a new bus named name - monitor + RouteList list; + boost::shared_ptr aux; + name = string_compose ("%1 - monitor", name); + list = session->new_audio_route (1, 1, 0, 1, name, PresentationInfo::AudioBus, (uint32_t) -1); + aux = *(list.begin()); + if (aux) { + boost::shared_ptr r = boost::dynamic_pointer_cast(aux); + r->output()->disconnect (this); + if (dest.size()) { + if (atoi( dest.c_str())) { + dest = string_compose ("system:playback_%1", dest); + } + PortSet& ports = r->output()->ports (); + r->output ()->connect (*(ports.begin()), dest, this); + } + aux->presentation_info().set_hidden (true); + + cue_set ((uint32_t) -1, msg); + return 0; + } + return -1; +} + int OSC::cue_next (lo_message msg) { diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 2195afe5f1..41d0531617 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -343,6 +343,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI int cue_parse (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg); int cue_set (uint32_t aux, lo_message msg); int _cue_set (uint32_t aux, lo_address addr); + int cue_new_aux (std::string name, std::string dest, lo_message msg); int cue_next (lo_message msg); int cue_previous (lo_message msg); int cue_send_fader (uint32_t id, float position, lo_message msg); -- cgit v1.2.3