+int
+OSC::route_get_sends(lo_message msg) {
+ if (!session) {
+ return -1;
+ }
+
+ lo_arg **argv = lo_message_get_argv(msg);
+
+ int rid = argv[0]->i;
+
+ boost::shared_ptr<Stripable> strip = get_strip(rid, get_address(msg));
+ if (!strip) {
+ return -1;
+ }
+
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (strip);
+ if (!r) {
+ return -1;
+ }
+
+ lo_message reply = lo_message_new();
+ lo_message_add_int32(reply, rid);
+
+ int i = 0;
+ for (;;) {
+ boost::shared_ptr<Processor> p = r->nth_send(i++);
+
+ if (!p) {
+ break;
+ }
+
+ boost::shared_ptr<InternalSend> isend = boost::dynamic_pointer_cast<InternalSend> (p);
+ if (isend) {
+ lo_message_add_int32(reply, get_sid(isend->target_route(), get_address(msg)));
+ lo_message_add_string(reply, isend->name().c_str());
+ lo_message_add_int32(reply, i);
+ boost::shared_ptr<Amp> a = isend->amp();
+ lo_message_add_float(reply, gain_to_slider_position(a->gain_control()->get_value()));
+ lo_message_add_int32(reply, p->active() ? 1 : 0);
+ }
+ }
+ // if used dedicated message path to identify this reply in async operation. Naming it #reply wont help the client to identify the content.
+ lo_send_message(get_address (msg), "/strip/sends", reply);
+
+ lo_message_free(reply);
+
+ return 0;
+}
+
+int
+OSC::route_get_receives(lo_message msg) {
+ if (!session) {
+ return -1;
+ }
+
+ lo_arg **argv = lo_message_get_argv(msg);
+
+ uint32_t rid = argv[0]->i;
+
+
+ boost::shared_ptr<Stripable> strip = get_strip(rid, get_address(msg));
+ if (!strip) {
+ return -1;
+ }
+
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (strip);
+ if (!r) {
+ return -1;
+ }
+
+ boost::shared_ptr<RouteList> route_list = session->get_routes();
+
+ lo_message reply = lo_message_new();
+
+ for (RouteList::iterator i = route_list->begin(); i != route_list->end(); ++i) {
+ boost::shared_ptr<Route> tr = boost::dynamic_pointer_cast<Route> (*i);
+ if (!tr) {
+ continue;
+ }
+ int j = 0;
+
+ for (;;) {
+ boost::shared_ptr<Processor> p = tr->nth_send(j++);
+
+ if (!p) {
+ break;
+ }
+
+ boost::shared_ptr<InternalSend> isend = boost::dynamic_pointer_cast<InternalSend> (p);
+ if (isend) {
+ if( isend->target_route()->id() == r->id()){
+ boost::shared_ptr<Amp> a = isend->amp();
+
+ lo_message_add_int32(reply, get_sid(tr, get_address(msg)));
+ lo_message_add_string(reply, tr->name().c_str());
+ lo_message_add_int32(reply, j);
+ lo_message_add_float(reply, gain_to_slider_position(a->gain_control()->get_value()));
+ lo_message_add_int32(reply, p->active() ? 1 : 0);
+ }
+ }
+ }
+ }
+
+ // I have used a dedicated message path to identify this reply in async operation. Naming it #reply wont help the client to identify the content.
+ lo_send_message(get_address (msg), "/strip/receives", reply);
+ lo_message_free(reply);
+ return 0;
+}
+