diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-06-06 11:14:31 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-06-06 11:14:31 -0400 |
commit | addb33bc630721e623f90b6f3e920eedcdc40742 (patch) | |
tree | 6e222b7d2ed7b9268ed1cf2c8f4889f96dcf9a20 /libs | |
parent | 8bfaa2d3d9e7712a238651c487c761e70b20f6ab (diff) |
implement OSC /ardour/route/send/gainabs and /ardour/route/send/gainDB
Diffstat (limited to 'libs')
-rw-r--r-- | libs/pbd/controllable_descriptor.cc | 3 | ||||
-rw-r--r-- | libs/surfaces/osc/osc.cc | 66 | ||||
-rw-r--r-- | libs/surfaces/osc/osc.h | 4 |
3 files changed, 70 insertions, 3 deletions
diff --git a/libs/pbd/controllable_descriptor.cc b/libs/pbd/controllable_descriptor.cc index 392b917ec8..9c930e4dbd 100644 --- a/libs/pbd/controllable_descriptor.cc +++ b/libs/pbd/controllable_descriptor.cc @@ -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; } diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 357b82d4d2..ef07ca17fb 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -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); @@ -892,6 +892,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) { if (!session) { diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index c09792ec64..5c3422799b 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -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); |