13
0

OSC: Personal monitoring can add a new aux

This commit is contained in:
Len Ovens 2018-09-10 09:57:19 -07:00
parent 79f01bc889
commit a96aa4e1fd
2 changed files with 43 additions and 0 deletions

View File

@ -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<Stripable> 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<Route> r = boost::dynamic_pointer_cast<Route>(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)
{

View File

@ -343,6 +343,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
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);