13
0

OSC: Make plugin and plugin parameter numbering 1 based to match everything else.

This commit is contained in:
Len Ovens 2016-11-26 09:18:36 -08:00
parent 842c33fba8
commit c7f8471d52

View File

@ -2822,7 +2822,7 @@ OSC::route_plugin_list(int ssid, lo_message msg) {
PBD::error << "OSC: given processor # " << piid << " on RID '" << ssid << "' is not a Plugin." << endmsg; PBD::error << "OSC: given processor # " << piid << " on RID '" << ssid << "' is not a Plugin." << endmsg;
continue; continue;
} }
lo_message_add_int32(reply, piid); lo_message_add_int32(reply, piid + 1);
boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin(); boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
lo_message_add_string(reply, pip->name()); lo_message_add_string(reply, pip->name());
@ -2848,7 +2848,7 @@ OSC::route_plugin_descriptor(int ssid, int piid, lo_message msg) {
return -1; return -1;
} }
boost::shared_ptr<Processor> redi = r->nth_plugin(piid); boost::shared_ptr<Processor> redi = r->nth_plugin(piid - 1);
if (!redi) { if (!redi) {
PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg; PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg;
@ -2878,7 +2878,7 @@ OSC::route_plugin_descriptor(int ssid, int piid, lo_message msg) {
if( pip->parameter_is_input(controlid) || pip->parameter_is_control(controlid) ) { if( pip->parameter_is_input(controlid) || pip->parameter_is_control(controlid) ) {
boost::shared_ptr<AutomationControl> c = pi->automation_control(Evoral::Parameter(PluginAutomation, 0, controlid)); boost::shared_ptr<AutomationControl> c = pi->automation_control(Evoral::Parameter(PluginAutomation, 0, controlid));
lo_message_add_int32(reply, ppi); lo_message_add_int32(reply, ppi + 1);
ParameterDescriptor pd; ParameterDescriptor pd;
pi->plugin()->get_parameter_descriptor(controlid, pd); pi->plugin()->get_parameter_descriptor(controlid, pd);
lo_message_add_string(reply, pd.label.c_str()); lo_message_add_string(reply, pd.label.c_str());
@ -2937,7 +2937,7 @@ OSC::route_plugin_reset(int ssid, int piid, lo_message msg) {
return -1; return -1;
} }
boost::shared_ptr<Processor> redi = r->nth_plugin(piid); boost::shared_ptr<Processor> redi = r->nth_plugin(piid - 1);
if (!redi) { if (!redi) {
PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg; PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg;
@ -2970,7 +2970,7 @@ OSC::route_plugin_parameter (int ssid, int piid, int par, float val, lo_message
return -1; return -1;
} }
boost::shared_ptr<Processor> redi=r->nth_plugin (piid); boost::shared_ptr<Processor> redi=r->nth_plugin (piid - 1);
if (!redi) { if (!redi) {
PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg; PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg;
@ -2987,7 +2987,7 @@ OSC::route_plugin_parameter (int ssid, int piid, int par, float val, lo_message
boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin(); boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
bool ok=false; bool ok=false;
uint32_t controlid = pip->nth_parameter (par,ok); uint32_t controlid = pip->nth_parameter (par - 1,ok);
if (!ok) { if (!ok) {
PBD::error << "OSC: Cannot find parameter # " << par << " for plugin # " << piid << " on RID '" << ssid << "'" << endmsg; PBD::error << "OSC: Cannot find parameter # " << par << " for plugin # " << piid << " on RID '" << ssid << "'" << endmsg;
@ -3030,7 +3030,7 @@ OSC::route_plugin_parameter_print (int ssid, int piid, int par, lo_message msg)
return -1; return -1;
} }
boost::shared_ptr<Processor> redi=r->nth_processor (piid); boost::shared_ptr<Processor> redi=r->nth_plugin (piid - 1);
if (!redi) { if (!redi) {
return -1; return -1;
@ -3045,7 +3045,7 @@ OSC::route_plugin_parameter_print (int ssid, int piid, int par, lo_message msg)
boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin(); boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
bool ok=false; bool ok=false;
uint32_t controlid = pip->nth_parameter (par,ok); uint32_t controlid = pip->nth_parameter (par - 1,ok);
if (!ok) { if (!ok) {
return -1; return -1;
@ -3056,8 +3056,12 @@ OSC::route_plugin_parameter_print (int ssid, int piid, int par, lo_message msg)
if (pi->plugin()->get_parameter_descriptor (controlid, pd) == 0) { if (pi->plugin()->get_parameter_descriptor (controlid, pd) == 0) {
boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter(PluginAutomation, 0, controlid)); boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter(PluginAutomation, 0, controlid));
cerr << "parameter: " << redi->describe_parameter(controlid) << "\n"; cerr << "parameter: " << pd.label << "\n";
cerr << "current value: " << c->get_value (); if (c) {
cerr << "current value: " << c->get_value () << "\n";
} else {
cerr << "current value not available, control does not exist\n";
}
cerr << "lower value: " << pd.lower << "\n"; cerr << "lower value: " << pd.lower << "\n";
cerr << "upper value: " << pd.upper << "\n"; cerr << "upper value: " << pd.upper << "\n";
} }
@ -3079,7 +3083,7 @@ OSC::route_plugin_activate (int ssid, int piid, lo_message msg)
return -1; return -1;
} }
boost::shared_ptr<Processor> redi=r->nth_plugin (piid); boost::shared_ptr<Processor> redi=r->nth_plugin (piid - 1);
if (!redi) { if (!redi) {
PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg; PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg;
@ -3113,7 +3117,7 @@ OSC::route_plugin_deactivate (int ssid, int piid, lo_message msg)
return -1; return -1;
} }
boost::shared_ptr<Processor> redi=r->nth_plugin (piid); boost::shared_ptr<Processor> redi=r->nth_plugin (piid - 1);
if (!redi) { if (!redi) {
PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg; PBD::error << "OSC: cannot find plugin # " << piid << " for RID '" << ssid << "'" << endmsg;