13
0

implement OSC /ardour/route/send/gainabs and /ardour/route/send/gainDB

This commit is contained in:
Paul Davis 2013-06-06 11:14:31 -04:00
parent 8bfaa2d3d9
commit addb33bc63
3 changed files with 70 additions and 3 deletions

View File

@ -104,10 +104,11 @@ ControllableDescriptor::set (const std::string& str)
}
} else if (path[1] == "send") {
if (path.size() == 3 && rest.size() == 2) {
if (path.size() == 3 && rest.size() == 3) {
if (path[2] == "gain") {
_subtype = SendGain;
_target.push_back (atoi (rest[1]));
_target.push_back (atoi (rest[2]));
} else {
return -1;
}

View File

@ -356,8 +356,8 @@ OSC::register_callbacks()
REGISTER_CALLBACK (serv, "/ardour/routes/pan_stereo_width", "if", route_set_pan_stereo_width);
REGISTER_CALLBACK (serv, "/ardour/routes/plugin/parameter", "iiif", route_plugin_parameter);
REGISTER_CALLBACK (serv, "/ardour/routes/plugin/parameter/print", "iii", route_plugin_parameter_print);
REGISTER_CALLBACK (serv, "/ardour/routes/send/gainabs", "iif", route_set_send_gain_abs);
REGISTER_CALLBACK (serv, "/ardour/routes/send/gaindB", "iif", route_set_send_gain_dB);
/* still not-really-standardized query interface */
//REGISTER_CALLBACK (serv, "/ardour/*/#current_value", "", current_value);
@ -891,6 +891,68 @@ OSC::route_set_pan_stereo_width (int rid, float pos)
}
int
OSC::route_set_send_gain_abs (int rid, int sid, float val)
{
if (!session) {
return -1;
}
boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
if (!r) {
return -1;
}
/* revert to zero-based counting */
if (sid > 0) {
--sid;
}
boost::shared_ptr<Processor> p = r->nth_send (send);
if (p) {
boost::shared_ptr<Send> s = boost::dynamic_pointer_cast<Send>(p);
boost::shared_ptr<Amp> a = s->amp();
if (a) {
a->set_gain (val, this);
}
}
}
int
OSC::route_set_send_gain_dB (int rid, int sid, float val)
{
if (!session) {
return -1;
}
boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
if (!r) {
return -1;
}
/* revert to zero-based counting */
if (sid > 0) {
--sid;
}
boost::shared_ptr<Processor> p = r->nth_send (send);
if (p) {
boost::shared_ptr<Send> s = boost::dynamic_pointer_cast<Send>(p);
boost::shared_ptr<Amp> a = s->amp();
if (a) {
a->set_gain (dB_to_coefficient (val), this);
}
}
}
int
OSC::route_plugin_parameter (int rid, int piid, int par, float val)
{

View File

@ -214,6 +214,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
PATH_CALLBACK2(route_set_gain_dB,i,f);
PATH_CALLBACK2(route_set_pan_stereo_position,i,f);
PATH_CALLBACK2(route_set_pan_stereo_width,i,f);
PATH_CALLBACK3(route_set_send_gain_abs,i,i,f);
PATH_CALLBACK3(route_set_send_gain_dB,i,i,f);
PATH_CALLBACK4(route_plugin_parameter,i,i,i,f);
PATH_CALLBACK3(route_plugin_parameter_print,i,i,i);
@ -224,6 +226,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
int route_set_gain_dB (int rid, float dB);
int route_set_pan_stereo_position (int rid, float left_right_fraction);
int route_set_pan_stereo_width (int rid, float percent);
int route_set_send_gain_abs (int rid, int sid, float val);
int route_set_send_gain_dB (int rid, int sid, float val);
int route_plugin_parameter (int rid, int piid,int par, float val);
int route_plugin_parameter_print (int rid, int piid,int par);