diff options
author | Len Ovens <len@ovenwerks.net> | 2018-09-18 15:38:16 -0700 |
---|---|---|
committer | Len Ovens <len@ovenwerks.net> | 2018-09-18 15:39:14 -0700 |
commit | 7390b88c2bb29b1b34624f441adec1e71c74bad8 (patch) | |
tree | 3b6658b0d00daecf345369eeb2708a7f6f44ce68 /libs/surfaces/osc | |
parent | 32986539552bde1b1b66ff30bb070e4bb0fb087f (diff) |
OSC: Allow personal monitor to change output connection
Diffstat (limited to 'libs/surfaces/osc')
-rw-r--r-- | libs/surfaces/osc/osc.cc | 37 | ||||
-rw-r--r-- | libs/surfaces/osc/osc.h | 1 |
2 files changed, 38 insertions, 0 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 689f2a67bf..c80b72ca19 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -6360,6 +6360,16 @@ OSC::cue_parse (const char *path, const char* types, lo_arg **argv, int argc, lo } } } + else if (!strncmp (path, X_("/cue/connect_aux"), 16)) { + // Create new Aux bus + string dest = ""; + if (argc == 1 && types[0] == 's') { + dest = &argv[0]->s; + ret = cue_connect_aux (dest, msg); + } else { + PBD::warning << "OSC: connect_aux has wrong number or type of parameters." << endmsg; + } + } else if (!strncmp (path, X_("/cue/connect"), 12)) { // Connect to default Aux bus if ((!argc) || argv[0]->f || argv[0]->i) { @@ -6501,12 +6511,39 @@ OSC::cue_new_aux (string name, string dest, lo_message msg) aux->presentation_info().set_hidden (true); cue_set ((uint32_t) -1, msg); + session->set_dirty(); return 0; } return -1; } int +OSC::cue_connect_aux (std::string dest, lo_message msg) +{ + OSCSurface *sur = get_surface(get_address (msg), true); + int ret = 1; + if (sur->cue) { + boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (get_strip (sur->aux, get_address(msg))); + if (rt) { + if (dest.size()) { + rt->output()->disconnect (this); + if (atoi( dest.c_str())) { + dest = string_compose ("system:playback_%1", dest); + } + PortSet& ports = rt->output()->ports (); + rt->output ()->connect (*(ports.begin()), dest, this); + session->set_dirty(); + ret = 0; + } + } + } + if (ret) { + PBD::warning << "OSC: cannot connect, no Aux bus chosen." << endmsg; + } + return ret; +} + +int OSC::cue_next (lo_message msg) { OSCSurface *s = get_surface(get_address (msg), true); diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 41d0531617..821543b685 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -344,6 +344,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest> 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_connect_aux (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); |