OSC: Patch from 7136 added cleaned and tested.
This commit is contained in:
parent
01f8ca831a
commit
98f1cb76ed
|
@ -46,6 +46,7 @@
|
|||
#include "ardour/plugin_insert.h"
|
||||
#include "ardour/presentation_info.h"
|
||||
#include "ardour/send.h"
|
||||
#include "ardour/internal_send.h"
|
||||
#include "ardour/phase_control.h"
|
||||
#include "ardour/solo_isolate_control.h"
|
||||
#include "ardour/solo_safe_control.h"
|
||||
|
@ -598,6 +599,9 @@ OSC::register_callbacks()
|
|||
REGISTER_CALLBACK (serv, "/strip/send/gain", "iif", route_set_send_gain_dB);
|
||||
REGISTER_CALLBACK (serv, "/strip/send/fader", "iif", route_set_send_fader);
|
||||
REGISTER_CALLBACK (serv, "/strip/send/enable", "iif", route_set_send_enable);
|
||||
REGISTER_CALLBACK(serv, "/strip/name", "is", route_rename);
|
||||
REGISTER_CALLBACK(serv, "/strip/sends", "i", route_get_sends);
|
||||
REGISTER_CALLBACK(serv, "/strip/receives", "i", route_get_receives);
|
||||
|
||||
/* still not-really-standardized query interface */
|
||||
//REGISTER_CALLBACK (serv, "/ardour/*/#current_value", "", current_value);
|
||||
|
@ -1789,6 +1793,115 @@ OSC::monitor_set_fader (float position)
|
|||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// strip calls
|
||||
int
|
||||
OSC::route_mute (int ssid, int yn, lo_message msg)
|
||||
|
@ -1966,6 +2079,21 @@ OSC::route_recenable (int ssid, int yn, lo_message msg)
|
|||
return route_send_fail ("recenable", ssid, 0, get_address (msg));
|
||||
}
|
||||
|
||||
int
|
||||
OSC::route_rename(int ssid, char *newname, lo_message msg) {
|
||||
if (!session) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
boost::shared_ptr<Stripable> s = get_strip(ssid, get_address(msg));
|
||||
|
||||
if (s) {
|
||||
s->set_name(std::string(newname));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
OSC::sel_recsafe (uint32_t yn, lo_message msg)
|
||||
{
|
||||
|
|
|
@ -212,6 +212,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
|||
int catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data);
|
||||
static int _catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data);
|
||||
|
||||
int route_get_sends (lo_message msg);
|
||||
int route_get_receives(lo_message msg);
|
||||
void routes_list (lo_message msg);
|
||||
void transport_frame (lo_message msg);
|
||||
void transport_speed (lo_message msg);
|
||||
|
@ -233,6 +235,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
|||
return 0; \
|
||||
}
|
||||
|
||||
PATH_CALLBACK_MSG(route_get_sends);
|
||||
PATH_CALLBACK_MSG(route_get_receives);
|
||||
PATH_CALLBACK_MSG(routes_list);
|
||||
PATH_CALLBACK_MSG(transport_frame);
|
||||
PATH_CALLBACK_MSG(transport_speed);
|
||||
|
@ -401,6 +405,18 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
|||
return 0; \
|
||||
}
|
||||
|
||||
#define PATH_CALLBACK2_MSG_s(name,arg1type,arg2type) \
|
||||
static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
|
||||
return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
|
||||
} \
|
||||
int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
|
||||
OSC_DEBUG; \
|
||||
if (argc > 1) { \
|
||||
name (argv[0]->arg1type, &argv[1]->arg2type, data); \
|
||||
} \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#define PATH_CALLBACK3(name,arg1type,arg2type,arg3type) \
|
||||
static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
|
||||
return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
|
||||
|
@ -436,6 +452,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
|||
PATH_CALLBACK4(set_surface,i,i,i,i);
|
||||
PATH_CALLBACK2(locate,i,i);
|
||||
PATH_CALLBACK2(loop_location,i,i);
|
||||
PATH_CALLBACK2_MSG_s(route_rename,i,s);
|
||||
PATH_CALLBACK2_MSG(route_mute,i,i);
|
||||
PATH_CALLBACK2_MSG(route_solo,i,i);
|
||||
PATH_CALLBACK2_MSG(route_solo_iso,i,i);
|
||||
|
@ -460,6 +477,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
|||
PATH_CALLBACK2_MSG(route_plugin_activate,i,i);
|
||||
PATH_CALLBACK2_MSG(route_plugin_deactivate,i,i);
|
||||
|
||||
int route_rename (int rid, char *s, lo_message msg);
|
||||
int route_mute (int rid, int yn, lo_message msg);
|
||||
int route_solo (int rid, int yn, lo_message msg);
|
||||
int route_solo_iso (int rid, int yn, lo_message msg);
|
||||
|
|
Loading…
Reference in New Issue
Block a user