#include "ardour/dB.h"
#include "ardour/filesystem_paths.h"
#include "ardour/panner.h"
+#include "ardour/plugin.h"
#include "osc.h"
#include "osc_controllable.h"
REGISTER_CALLBACK (serv, "/ardour/routes/recenable", "ii", route_recenable);
REGISTER_CALLBACK (serv, "/ardour/routes/gainabs", "if", route_set_gain_abs);
REGISTER_CALLBACK (serv, "/ardour/routes/gaindB", "if", route_set_gain_dB);
+ REGISTER_CALLBACK (serv, "/ardour/routes/pan_stereo_position", "if", route_set_pan_stereo_position);
+ 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);
#if 0
}
+int
+OSC::route_plugin_parameter (int rid,int piid,int par, float val)
+{
+ if (!session) {
+ return -1;
+ }
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (!r) {
+ return -1;
+ }
+
+ boost::shared_ptr<Processor> redi=r->nth_processor (piid);
+
+ if (!redi) {
+ return -1;
+ }
+
+ boost::shared_ptr<PluginInsert> pi;
+
+ if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(redi))) {
+ return -1;
+ }
+
+ boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
+ bool ok=false;
+
+ uint32_t controlid = pip->nth_parameter (par,ok);
+
+ if (!ok) {
+ return -1;
+ }
+
+ Plugin::ParameterDescriptor pd;
+ pi->plugin()->get_parameter_descriptor (controlid,pd);
+
+ if (val >= pd.lower && val < pd.upper) {
+
+ boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter(PluginAutomation, 0, controlid));;
+ cerr << "parameter:" << redi->describe_parameter(controlid) << " val:" << val << "\n";
+ c->set_value (val);
+ }
+
+ return 0;
+}
+
+int
+OSC::route_plugin_parameter_print (int rid,int piid,int par)
+{
+ if (!session) {
+ return -1;
+ }
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (!r) {
+ return -1;
+ }
+
+ boost::shared_ptr<Processor> redi=r->nth_processor (piid);
+
+ if (!redi) {
+ return -1;
+ }
+
+ boost::shared_ptr<PluginInsert> pi;
+
+ if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(redi))) {
+ return -1;
+ }
+ boost::shared_ptr<ARDOUR::Plugin> pip=pi->plugin();
+ bool ok=false;
+
+ uint32_t controlid = pip->nth_parameter (par,ok);
+
+ if (!ok) {
+ return -1;
+ }
+
+ Plugin::ParameterDescriptor pd;
+
+ if (pi->plugin()->get_parameter_descriptor (controlid, pd) == 0) {
+ boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter(PluginAutomation, 0, controlid));
+
+ cerr << "parameter: " << redi->describe_parameter(controlid) << "\n";
+ cerr << "current value: " << c->get_value ();
+ cerr << "lower value: " << pd.lower << "\n";
+ cerr << "upper value: " << pd.upper << "\n";
+ }
+
+ return 0;
+}
+
XMLNode&
OSC::get_state ()
{
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); \
+ } \
+ int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
+ if (argc > 1) { \
+ name (argv[0]->arg1type, argv[1]->arg2type,argv[2]->arg3type); \
+ } \
+ return 0; \
+ }
+
+#define PATH_CALLBACK4(name,arg1type,arg2type,arg3type,arg4type) \
+ 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) { \
+ if (argc > 1) { \
+ name (argv[0]->arg1type, argv[1]->arg2type,argv[2]->arg3type,argv[3]->arg4type); \
+ } \
+ return 0; \
+ }
+
PATH_CALLBACK2(locate,i,i);
PATH_CALLBACK2(route_mute,i,i);
PATH_CALLBACK2(route_solo,i,i);
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_CALLBACK4(route_plugin_parameter,i,i,i,f);
+ PATH_CALLBACK3(route_plugin_parameter_print,i,i,i);
int route_mute (int rid, int yn);
int route_solo (int rid, int yn);
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_plugin_parameter (int rid, int piid,int par, float val);
+ int route_plugin_parameter_print (int rid, int piid,int par);
void listen_to_route (boost::shared_ptr<ARDOUR::Route>, lo_address);
void end_listen (boost::shared_ptr<ARDOUR::Route>, lo_address);