summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-03-20 21:38:26 +0100
committerRobin Gareus <robin@gareus.org>2015-03-20 21:38:26 +0100
commit9f842f3247e11501929820a91f12d48fd3c19e61 (patch)
treefd1d4fa728f2e483cddc9013fa54d45b29d3fe58 /libs
parent410cf8e79db74bc85b3a39c35f63897715923070 (diff)
NOOP, whitespace
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/osc/osc.cc421
1 files changed, 210 insertions, 211 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc
index 8d5cbc9347..d31446e297 100644
--- a/libs/surfaces/osc/osc.cc
+++ b/libs/surfaces/osc/osc.cc
@@ -1,20 +1,20 @@
/*
* Copyright (C) 2006 Paul Davis
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
+ *
*/
#include <iostream>
@@ -124,7 +124,7 @@ OSC::set_active (bool yn)
return -1;
}
}
-
+
}
return ControlProtocol::set_active (yn);
@@ -136,7 +136,7 @@ OSC::get_active () const
return _osc_server != 0;
}
-int
+int
OSC::set_feedback (bool yn)
{
_send_route_changes = yn;
@@ -158,19 +158,19 @@ OSC::start ()
/* already started */
return 0;
}
-
+
for (int j=0; j < 20; ++j) {
snprintf(tmpstr, sizeof(tmpstr), "%d", _port);
-
+
//if ((_osc_server = lo_server_new_with_proto (tmpstr, LO_TCP, error_callback))) {
// break;
//}
-
+
if ((_osc_server = lo_server_new (tmpstr, error_callback))) {
break;
}
-#ifdef DEBUG
+#ifdef DEBUG
cerr << "can't get osc at port: " << _port << endl;
#endif
_port++;
@@ -180,48 +180,48 @@ OSC::start ()
if (!_osc_server) {
return 1;
}
-
+
#ifdef ARDOUR_OSC_UNIX_SERVER
-
+
// APPEARS sluggish for now
-
+
// attempt to create unix socket server too
-
+
snprintf(tmpstr, sizeof(tmpstr), "/tmp/sooperlooper_XXXXXX");
int fd = mkstemp(tmpstr);
-
+
if (fd >= 0 ) {
::g_unlink (tmpstr);
close (fd);
-
+
_osc_unix_server = lo_server_new (tmpstr, error_callback);
-
+
if (_osc_unix_server) {
_osc_unix_socket_path = tmpstr;
}
}
#endif
-
+
PBD::info << "OSC @ " << get_server_url () << endmsg;
std::string url_file;
if (find_file (ardour_config_search_path(), "osc_url", url_file)) {
-
+
_osc_url_file = url_file;
ofstream urlfile;
urlfile.open(_osc_url_file.c_str(), ios::trunc);
-
+
if (urlfile) {
urlfile << get_server_url () << endl;
urlfile.close();
- } else {
+ } else {
cerr << "Couldn't write '" << _osc_url_file << "'" <<endl;
}
}
-
+
register_callbacks();
-
+
// lo_server_thread_add_method(_sthread, NULL, NULL, OSC::_dummy_handler, this);
/* startup the event loop thread */
@@ -292,11 +292,11 @@ OSC::stop ()
lo_server_free (_osc_unix_server);
_osc_unix_server = 0;
}
-
+
if (!_osc_unix_socket_path.empty()) {
::g_unlink (_osc_unix_socket_path.c_str());
}
-
+
if (!_osc_url_file.empty() ) {
::g_unlink (_osc_url_file.c_str() );
}
@@ -305,7 +305,7 @@ OSC::stop ()
for (RouteObservers::iterator x = route_observers.begin(); x != route_observers.end();) {
OSCRouteObserver* rc;
-
+
if ((rc = dynamic_cast<OSCRouteObserver*>(*x)) != 0) {
delete *x;
x = route_observers.erase (x);
@@ -313,7 +313,7 @@ OSC::stop ()
++x;
}
}
-
+
return 0;
}
@@ -325,7 +325,7 @@ OSC::register_callbacks()
srvs[0] = _osc_server;
srvs[1] = _osc_unix_server;
-
+
for (size_t i = 0; i < 2; ++i) {
if (!srvs[i]) {
@@ -333,13 +333,13 @@ OSC::register_callbacks()
}
serv = srvs[i];
-
+
/* this is a special catchall handler */
-
+
lo_server_add_method (serv, 0, 0, _catchall, this);
-
+
#define REGISTER_CALLBACK(serv,path,types, function) lo_server_add_method (serv, path, types, OSC::_ ## function, this)
-
+
REGISTER_CALLBACK (serv, "/routes/list", "", routes_list);
REGISTER_CALLBACK (serv, "/ardour/add_marker", "", add_marker);
REGISTER_CALLBACK (serv, "/ardour/access_action", "s", access_action);
@@ -352,7 +352,7 @@ OSC::register_callbacks()
REGISTER_CALLBACK (serv, "/ardour/transport_play", "", transport_play);
REGISTER_CALLBACK (serv, "/ardour/transport_frame", "", transport_frame);
REGISTER_CALLBACK (serv, "/ardour/set_transport_speed", "f", set_transport_speed);
- REGISTER_CALLBACK (serv, "/ardour/locate", "ii", locate);
+ REGISTER_CALLBACK (serv, "/ardour/locate", "ii", locate);
REGISTER_CALLBACK (serv, "/ardour/save_state", "", save_state);
REGISTER_CALLBACK (serv, "/ardour/prev_marker", "", prev_marker);
REGISTER_CALLBACK (serv, "/ardour/next_marker", "", next_marker);
@@ -413,7 +413,7 @@ OSC::get_server_url()
url = urlstr;
free (urlstr);
}
-
+
return url;
}
@@ -428,7 +428,7 @@ OSC::get_unix_server_url()
url = urlstr;
free (urlstr);
}
-
+
return url;
}
@@ -436,15 +436,15 @@ void
OSC::listen_to_route (boost::shared_ptr<Route> route, lo_address addr)
{
/* avoid duplicate listens */
-
+
for (RouteObservers::iterator x = route_observers.begin(); x != route_observers.end(); ++x) {
-
+
OSCRouteObserver* ro;
if ((ro = dynamic_cast<OSCRouteObserver*>(*x)) != 0) {
int res = strcmp(lo_address_get_hostname(ro->address()), lo_address_get_hostname(addr));
-
+
if (ro->route() == route && res == 0) {
return;
}
@@ -469,9 +469,9 @@ OSC::drop_route (boost::weak_ptr<Route> wr)
for (RouteObservers::iterator x = route_observers.begin(); x != route_observers.end();) {
OSCRouteObserver* rc;
-
+
if ((rc = dynamic_cast<OSCRouteObserver*>(*x)) != 0) {
-
+
if (rc->route() == r) {
delete *x;
x = route_observers.erase (x);
@@ -488,14 +488,14 @@ void
OSC::end_listen (boost::shared_ptr<Route> r, lo_address addr)
{
RouteObservers::iterator x;
-
+
// Remove the route observers
for (x = route_observers.begin(); x != route_observers.end();) {
OSCRouteObserver* ro;
-
+
if ((ro = dynamic_cast<OSCRouteObserver*>(*x)) != 0) {
-
+
int res = strcmp(lo_address_get_hostname(ro->address()), lo_address_get_hostname(addr));
if (ro->route() == r && res == 0) {
@@ -516,13 +516,13 @@ void
OSC::current_value_query (const char* path, size_t len, lo_arg **argv, int argc, lo_message msg)
{
char* subpath;
-
+
subpath = (char*) malloc (len-15+1);
memcpy (subpath, path, len-15);
subpath[len-15] = '\0';
-
+
send_current_value (subpath, argv, argc, msg);
-
+
free (subpath);
}
@@ -538,7 +538,7 @@ OSC::send_current_value (const char* path, lo_arg** argv, int argc, lo_message m
int id;
lo_message_add_string (reply, path);
-
+
if (argc == 0) {
lo_message_add_string (reply, "bad syntax");
} else {
@@ -550,7 +550,7 @@ OSC::send_current_value (const char* path, lo_arg** argv, int argc, lo_message m
} else {
if (strcmp (path, "/routes/state") == 0) {
-
+
if (boost::dynamic_pointer_cast<AudioTrack>(r)) {
lo_message_add_string (reply, "AT");
} else if (boost::dynamic_pointer_cast<MidiTrack>(r)) {
@@ -558,19 +558,19 @@ OSC::send_current_value (const char* path, lo_arg** argv, int argc, lo_message m
} else {
lo_message_add_string (reply, "B");
}
-
+
lo_message_add_string (reply, r->name().c_str());
lo_message_add_int32 (reply, r->n_inputs().n_audio());
lo_message_add_int32 (reply, r->n_outputs().n_audio());
lo_message_add_int32 (reply, r->muted());
lo_message_add_int32 (reply, r->soloed());
-
+
} else if (strcmp (path, "/routes/mute") == 0) {
-
+
lo_message_add_int32 (reply, (float) r->muted());
-
+
} else if (strcmp (path, "/routes/solo") == 0) {
-
+
lo_message_add_int32 (reply, r->soloed());
}
}
@@ -579,20 +579,20 @@ OSC::send_current_value (const char* path, lo_arg** argv, int argc, lo_message m
lo_send_message (lo_message_get_source (msg), "#reply", reply);
lo_message_free (reply);
}
-
+
int
-OSC::_catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data)
+OSC::_catchall (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data)
{
return ((OSC*)user_data)->catchall (path, types, argv, argc, data);
}
int
-OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc, lo_message msg)
+OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc, lo_message msg)
{
size_t len;
int ret = 1; /* unhandled */
- //cerr << "Received a message, path = " << path << " types = \""
+ //cerr << "Received a message, path = " << path << " types = \""
// << (types ? types : "NULL") << '"' << endl;
/* 15 for /#current_value plus 2 for /<path> */
@@ -604,7 +604,7 @@ OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc,
ret = 0;
} else if (strcmp (path, "/routes/listen") == 0) {
-
+
cerr << "set up listener\n";
lo_message reply = lo_message_new ();
@@ -615,12 +615,12 @@ OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc,
for (int n = 0; n < argc; ++n) {
boost::shared_ptr<Route> r = session->route_by_remote_id (argv[n]->i);
-
+
if (!r) {
lo_message_add_string (reply, "not found");
cerr << "no such route\n";
break;
- } else {
+ } else {
cerr << "add listener\n";
listen_to_route (r, lo_message_get_source (msg));
lo_message_add_int32 (reply, argv[n]->i);
@@ -630,7 +630,7 @@ OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc,
lo_send_message (lo_message_get_source (msg), "#reply", reply);
lo_message_free (reply);
-
+
ret = 0;
} else if (strcmp (path, "/routes/ignore") == 0) {
@@ -638,14 +638,14 @@ OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc,
for (int n = 0; n < argc; ++n) {
boost::shared_ptr<Route> r = session->route_by_remote_id (argv[n]->i);
-
+
if (r) {
end_listen (r, lo_message_get_source (msg));
}
}
-
- ret = 0;
- }
+
+ ret = 0;
+ }
return ret;
}
@@ -653,7 +653,7 @@ OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc,
void
OSC::update_clock ()
{
-
+
}
// "Application Hook" Handlers //
@@ -675,9 +675,9 @@ OSC::session_exported (std::string path, std::string name)
/* path callbacks */
-int
-OSC::current_value (const char */*path*/, const char */*types*/, lo_arg **/*argv*/, int /*argc*/, void */*data*/, void* /*user_data*/)
-{
+int
+OSC::current_value (const char */*path*/, const char */*types*/, lo_arg **/*argv*/, int /*argc*/, void */*data*/, void* /*user_data*/)
+{
#if 0
const char* returl;
@@ -690,7 +690,7 @@ OSC::current_value (const char */*path*/, const char */*types*/, lo_arg **/*argv
const char *retpath = argv[2]->s;
-
+
if (strcmp (argv[0]->s, "transport_frame") == 0) {
if (session) {
@@ -698,31 +698,31 @@ OSC::current_value (const char */*path*/, const char */*types*/, lo_arg **/*argv
}
} else if (strcmp (argv[0]->s, "transport_speed") == 0) {
-
+
if (session) {
lo_send (addr, retpath, "i", session->transport_frame());
}
-
+
} else if (strcmp (argv[0]->s, "transport_locked") == 0) {
-
+
if (session) {
lo_send (addr, retpath, "i", session->transport_frame());
}
-
+
} else if (strcmp (argv[0]->s, "punch_in") == 0) {
-
+
if (session) {
lo_send (addr, retpath, "i", session->transport_frame());
}
-
+
} else if (strcmp (argv[0]->s, "punch_out") == 0) {
if (session) {
lo_send (addr, retpath, "i", session->transport_frame());
}
-
+
} else if (strcmp (argv[0]->s, "rec_enable") == 0) {
-
+
if (session) {
lo_send (addr, retpath, "i", session->transport_frame());
}
@@ -741,11 +741,11 @@ OSC::routes_list (lo_message msg)
for (int n = 0; n < (int) session->nroutes(); ++n) {
boost::shared_ptr<Route> r = session->route_by_remote_id (n);
-
+
if (r) {
lo_message reply = lo_message_new ();
-
+
if (boost::dynamic_pointer_cast<AudioTrack>(r)) {
lo_message_add_string (reply, "AT");
} else if (boost::dynamic_pointer_cast<MidiTrack>(r)) {
@@ -753,17 +753,17 @@ OSC::routes_list (lo_message msg)
} else {
lo_message_add_string (reply, "B");
}
-
+
lo_message_add_string (reply, r->name().c_str());
lo_message_add_int32 (reply, r->n_inputs().n_audio());
lo_message_add_int32 (reply, r->n_outputs().n_audio());
lo_message_add_int32 (reply, r->muted());
lo_message_add_int32 (reply, r->soloed());
lo_message_add_int32 (reply, r->remote_control_id());
-
- if (boost::dynamic_pointer_cast<AudioTrack>(r)
- || boost::dynamic_pointer_cast<MidiTrack>(r)) {
-
+
+ if (boost::dynamic_pointer_cast<AudioTrack>(r)
+ || boost::dynamic_pointer_cast<MidiTrack>(r)) {
+
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(r);
lo_message_add_int32 (reply, t->record_enabled());
}
@@ -775,30 +775,30 @@ OSC::routes_list (lo_message msg)
lo_message_free (reply);
}
}
-
+
// Send end of listing message
lo_message reply = lo_message_new ();
lo_message_add_string (reply, "end_route_list");
lo_message_add_int64 (reply, session->frame_rate());
lo_message_add_int64 (reply, session->current_end_frame());
-
+
lo_send_message (lo_message_get_source (msg), "#reply", reply);
-
+
lo_message_free (reply);
}
void
OSC::transport_frame (lo_message msg)
{
- framepos_t pos = session->transport_frame ();
-
- lo_message reply = lo_message_new ();
- lo_message_add_int64 (reply, pos);
-
- lo_send_message (lo_message_get_source (msg), "/ardour/transport_frame", reply);
-
- lo_message_free (reply);
+ framepos_t pos = session->transport_frame ();
+
+ lo_message reply = lo_message_new ();
+ lo_message_add_int64 (reply, pos);
+
+ lo_send_message (lo_message_get_source (msg), "/ardour/transport_frame", reply);
+
+ lo_message_free (reply);
}
int
@@ -811,7 +811,7 @@ OSC::route_mute (int rid, int yn)
if (r) {
r->set_mute (yn, this);
}
-
+
return 0;
}
@@ -825,7 +825,7 @@ OSC::route_solo (int rid, int yn)
if (r) {
r->set_solo (yn, this);
}
-
+
return 0;
}
@@ -839,7 +839,7 @@ OSC::route_recenable (int rid, int yn)
if (r) {
r->set_record_enabled (yn, this);
}
-
+
return 0;
}
@@ -867,7 +867,7 @@ OSC::route_set_gain_dB (int rid, float dB)
if (r) {
r->set_gain (dB_to_coefficient (dB), this);
}
-
+
return 0;
}
@@ -879,12 +879,12 @@ OSC::route_set_pan_stereo_position (int rid, float pos)
boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
if (r) {
- boost::shared_ptr<Panner> panner = r->panner();
- if (panner) {
- panner->set_position (pos);
- }
+ boost::shared_ptr<Panner> panner = r->panner();
+ if (panner) {
+ panner->set_position (pos);
+ }
}
-
+
return 0;
}
@@ -897,12 +897,12 @@ OSC::route_set_pan_stereo_width (int rid, float pos)
boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
if (r) {
- boost::shared_ptr<Panner> panner = r->panner();
- if (panner) {
- panner->set_width (pos);
- }
+ boost::shared_ptr<Panner> panner = r->panner();
+ if (panner) {
+ panner->set_width (pos);
+ }
}
-
+
return 0;
}
@@ -910,15 +910,15 @@ 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;
- }
+ if (!session) {
+ return -1;
+ }
- boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
- if (!r) {
- return -1;
- }
+ if (!r) {
+ return -1;
+ }
/* revert to zero-based counting */
@@ -927,11 +927,11 @@ OSC::route_set_send_gain_abs (int rid, int sid, float val)
}
boost::shared_ptr<Processor> p = r->nth_send (sid);
-
+
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);
}
@@ -942,15 +942,15 @@ OSC::route_set_send_gain_abs (int rid, int sid, float val)
int
OSC::route_set_send_gain_dB (int rid, int sid, float val)
{
- if (!session) {
- return -1;
- }
+ if (!session) {
+ return -1;
+ }
- boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
- if (!r) {
- return -1;
- }
+ if (!r) {
+ return -1;
+ }
/* revert to zero-based counting */
@@ -959,11 +959,11 @@ OSC::route_set_send_gain_dB (int rid, int sid, float val)
}
boost::shared_ptr<Processor> p = r->nth_send (sid);
-
+
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);
}
@@ -974,112 +974,111 @@ OSC::route_set_send_gain_dB (int rid, int sid, float val)
int
OSC::route_plugin_parameter (int rid, int piid, int par, float val)
{
- if (!session) {
- return -1;
- }
+ if (!session)
+ return -1;
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid)
- boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+ if (!r) {
+ PBD::error << "OSC: Invalid Remote Control ID '" << rid << "'" << endmsg;
+ return -1;
+ }
- if (!r) {
- PBD::error << "OSC: Invalid Remote Control ID '" << rid << "'" << endmsg;
- return -1;
- }
+ boost::shared_ptr<Processor> redi=r->nth_plugin (piid);
- boost::shared_ptr<Processor> redi=r->nth_plugin (piid);
-
- if (!redi) {
+ if (!redi) {
PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << rid << "'" << endmsg;
- return -1;
- }
+ return -1;
+ }
- boost::shared_ptr<PluginInsert> pi;
-
- if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(redi))) {
+ boost::shared_ptr<PluginInsert> pi;
+
+ if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(redi))) {
PBD::error << "OSC: given processor # " << piid << " on RID '" << rid << "' is not a Plugin." << endmsg;
- 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;
+ }
+
+ boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
+ bool ok=false;
+
+ uint32_t controlid = pip->nth_parameter (par,ok);
+
+ if (!ok) {
PBD::error << "OSC: Cannot find parameter # " << par << " for plugin # " << piid << " on RID '" << rid << "'" << endmsg;
- return -1;
- }
+ return -1;
+ }
if (!pip->parameter_is_input(par)) {
PBD::error << "OSC: Parameter # " << par << " for plugin # " << piid << " on RID '" << rid << "' is not a control input" << endmsg;
return -1;
}
- ParameterDescriptor pd;
- pi->plugin()->get_parameter_descriptor (controlid,pd);
+ ParameterDescriptor pd;
+ pi->plugin()->get_parameter_descriptor (controlid,pd);
+
+ if (val >= pd.lower && val < pd.upper) {
- 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);
- } else {
+ 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);
+ } else {
PBD::warning << "OSC: Parameter # " << par << " for plugin # " << piid << " on RID '" << rid << "' is out of range" << endmsg;
PBD::info << "OSC: Valid range min=" << pd.lower << " max=" << pd.upper << endmsg;
}
- return 0;
+ 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;
- }
-
- 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;
+ 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;
+ }
+
+ 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 ()
+XMLNode&
+OSC::get_state ()
{
XMLNode& node (ControlProtocol::get_state());
@@ -1087,7 +1086,7 @@ OSC::get_state ()
return node;
}
-int
+int
OSC::set_state (const XMLNode& node, int /*version*/)
{
const XMLProperty* prop = node.property (X_("feedback"));
@@ -1101,6 +1100,6 @@ OSC::set_state (const XMLNode& node, int /*version*/)
} else {
/* leave it alone */
}
-
+
return 0;
}