len = strlen (path);
+ if (strstr (path, "/automation")) {
+ ret = set_automation (path, len, argv, argc, msg);
+
+ } else
if (len >= 17 && !strcmp (&path[len-15], "/#current_value")) {
current_value_query (path, len, argv, argc, msg);
ret = 0;
std::string action_path = path;
access_action (action_path.substr(15));
- std::cout << "access_action path = " << action_path.substr(15) << "\n";
}
ret = 0;
for (CueObservers::iterator x = cue_observers.begin(); x != cue_observers.end();) {
OSCCueObserver* co;
if ((co = dynamic_cast<OSCCueObserver*>(*x)) != 0) {
- delete co;
+ delete *x;
+ x = cue_observers.erase (x);
} else {
++x;
}
OSCSurface *s = get_surface(get_address (msg));
- string path = "/jog/mode";
+ string path = "/jog/mode/name";
switch(s->jogmode)
{
case JOG :
default:
PBD::warning << "Jog Mode: " << mode << " is not valid." << endmsg;
break;
+ lo_message reply = lo_message_new ();
+ lo_message_add_int32 (reply, s->jogmode);
+ lo_send_message (get_address(msg), "/jog/mode", reply);
+ lo_message_free (reply);
}
jog (0, msg);
}
// strip calls
+
+int
+OSC::set_automation (const char *path, size_t len, lo_arg **argv, int argc, lo_message msg)
+{
+ if (!session) return -1;
+
+ int ret = 1;
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> strp = boost::shared_ptr<Stripable>();
+ uint32_t ctr = 0;
+ uint32_t aut = 0;
+
+ //parse path first to find stripable
+ if (!strncmp (path, "/strip/", 7)) {
+ // find ssid and stripable
+ if (argc > 1) {
+ strp = get_strip (argv[0]->i, get_address (msg));
+ if (argv[1]->f) {
+ aut = (int)argv[1]->f;
+ } else {
+ aut = argv[1]->i;
+ }
+ } else {
+ uint32_t ssid = atoi (&(strrchr (path, '/' ))[1]);
+ strp = get_strip (ssid, get_address (msg));
+ if (argv[0]->f) {
+ aut = (int)argv[0]->f;
+ } else {
+ aut = argv[0]->i;
+ }
+ }
+ ctr = 7;
+ } else if (!strncmp (path, "/select/", 8)) {
+ if (sur->expand_enable && sur->expand) {
+ strp = get_strip (sur->expand, get_address (msg));
+ } else {
+ strp = ControlProtocol::first_selected_stripable();
+ }
+ if (argv[0]->f) {
+ aut = (int)argv[0]->f;
+ } else {
+ aut = argv[0]->i;
+ }
+ ctr = 8;
+ } else {
+ return ret;
+ }
+ if (strp) {
+ if ((!strncmp (&path[ctr], "fader", 5)) || (!strncmp (&path[ctr], "gain", 4))) {
+ if (strp->gain_control ()) {
+ switch (aut) {
+ case 0:
+ strp->gain_control()->set_automation_state (ARDOUR::AutoState::Off);
+ ret = 0;
+ break;
+ case 'm':
+ strp->gain_control()->set_automation_state (ARDOUR::AutoState::Off);
+ ret = 0;
+ break;
+ case 1:
+ strp->gain_control()->set_automation_state (ARDOUR::AutoState::Play);
+ ret = 0;
+ break;
+ case 'p':
+ strp->gain_control()->set_automation_state (ARDOUR::AutoState::Play);
+ ret = 0;
+ break;
+ case 2:
+ strp->gain_control()->set_automation_state (ARDOUR::AutoState::Write);
+ ret = 0;
+ break;
+ case 'w':
+ strp->gain_control()->set_automation_state (ARDOUR::AutoState::Write);
+ ret = 0;
+ break;
+ case 3:
+ strp->gain_control()->set_automation_state (ARDOUR::AutoState::Touch);
+ ret = 0;
+ break;
+ case 't':
+ strp->gain_control()->set_automation_state (ARDOUR::AutoState::Touch);
+ ret = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
int
OSC::route_mute (int ssid, int yn, lo_message msg)
{
sorted.push_back (s);
}
}
- } else
- if (types[3] && (s->presentation_info().flags() & PresentationInfo::MidiBus)) {
+ } else if (types[3] && (s->presentation_info().flags() & PresentationInfo::MidiBus)) {
sorted.push_back (s);
- } else
- if (types[4] && (s->presentation_info().flags() & PresentationInfo::VCA)) {
+ } else if (types[4] && (s->presentation_info().flags() & PresentationInfo::VCA)) {
sorted.push_back (s);
- } else
- if (types[8] && (s->presentation_info().flags() & PresentationInfo::Selected)) {
+ } else if (types[8] && (s->is_selected())) {
sorted.push_back (s);
- } else
- if (types[9] && (s->presentation_info().flags() & PresentationInfo::Hidden)) {
+ } else if (types[9] && (s->presentation_info().flags() & PresentationInfo::Hidden)) {
sorted.push_back (s);
}
}
ret = 0;
}
else if (!strncmp (path, "/cue/connect", 12)) {
- // switch to next Aux bus
- cue_set (0, msg);
+ // Connect to default Aux bus
+ if ((!argc) || argv[0]->i) {
+ cue_set (1, msg);
+ }
ret = 0;
}
else if (!strncmp (path, "/cue/next_aux", 13)) {
// switch to next Aux bus
- cue_next (msg);
+ if ((!argc) || argv[0]->i) {
+ cue_next (msg);
+ }
ret = 0;
}
else if (!strncmp (path, "/cue/previous_aux", 17)) {
// switch to previous Aux bus
- cue_previous (msg);
+ if ((!argc) || argv[0]->i) {
+ cue_previous (msg);
+ }
ret = 0;
}
else if (!strncmp (path, "/cue/send/fader/", 16) && strlen (path) > 16) {
ret = 0;
}
- if ((ret && _debugmode == Unhandled)) {
- debugmsg (_("Unhandled OSC cue message"), path, types, argv, argc);
- } else if ((!ret && _debugmode == All)) {
- debugmsg (_("OSC cue"), path, types, argv, argc);
- }
-
return ret;
}
s->feedback = 0;
s->gainmode = 1;
s->cue = true;
- s->aux = aux;
s->strips = get_sorted_stripables(s->strip_types, s->cue);
s->nstrips = s->strips.size();
+
+ if (aux < 1) {
+ aux = 1;
+ } else if (aux > s->nstrips) {
+ aux = s->nstrips;
+ }
+ s->aux = aux;
+
// get rid of any old CueObsevers for this address
- cueobserver_connections.drop_connections ();
+ //cueobserver_connections.drop_connections ();
CueObservers::iterator x;
for (x = cue_observers.begin(); x != cue_observers.end();) {
OSC::cue_next (lo_message msg)
{
OSCSurface *s = get_surface(get_address (msg));
+
+ if (!s->cue) {
+ cue_set (1, msg);
+ return 0;
+ }
if (s->aux < s->nstrips) {
cue_set (s->aux + 1, msg);
} else {
OSC::cue_previous (lo_message msg)
{
OSCSurface *s = get_surface(get_address (msg));
+ if (!s->cue) {
+ cue_set (1, msg);
+ return 0;
+ }
if (s->aux > 1) {
cue_set (s->aux - 1, msg);
}