[Ardour-Dev] check of plugin parameter to dev osc control

sh0099 at gmx.de sh0099 at gmx.de
Fri Dec 3 04:18:30 PST 2010


i currently try to extend the osc interface to interface plugin parameter
osc command:
to set the parameter:
/ardour/route/plugin/parameter
to check the parameter for testing:
/ardour/route/plugin/parameter/print

the problem is i have to check if a parameter is existing

pi = boost::dynamic_pointer_cast<PluginInsert>(redi);
boost::shared_ptr<ARDOUR::Plugin> pip=pi->plugin();
bool ok=false;
pip->nth_parameter(par,ok);
if(ok)
   //set the parameter

but sometimes nth_parameter does not return ok==true even so the plugin has this nth parameter.
for example fons ambisonic 2.2 panner has to be controlled by parameter id 10 and 11 but nth_parameter(10) does not return ok==true;

what is there i a bug in fons plugin or do i try to test with the wrong method.

thank you already.

best
olaf

p.s.: here is the code of the two functions:

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) {
      boost::shared_ptr<Redirect> redi=r->nth_redirect (piid);
      if (redi){
        boost::shared_ptr<PluginInsert> pi;
        if ((pi = boost::dynamic_pointer_cast<PluginInsert>(redi)) != 0) {
          boost::shared_ptr<ARDOUR::Plugin> pip=pi->plugin();
          bool ok=false;
          pip->nth_parameter(par,ok);
          if(ok){
        Plugin::ParameterDescriptor pd;
        pi->plugin()->get_parameter_descriptor(par,pd);
        if(val>pd.lower&& val<pd.upper){
          cerr << "parameter:" << redi->describe_parameter(par) << " val:" << val << "\n";
          pi->set_parameter(par,val);
        }else{
          cerr << "parameter:" << redi->describe_parameter(par) << " is out of range: !(" << pd.lower << "<" << val << "<" << pd.upper <<") \n";
        }
          } else {
        cerr << "parameter id out of range:" << par << "\n";          
          }
        } else {
          cerr << "redirect is not a incert piid:" << piid << "\n";
        }
      } else {
        cerr << "redirect is not existing piid:" << piid << "\n";
      }
    } else {
      cerr << "route is not existing redi id:" << rid << "\n";
    }
    
    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) {
      boost::shared_ptr<Redirect> redi=r->nth_redirect (piid);
      if (redi){
        boost::shared_ptr<PluginInsert> pi;
        if ((pi = boost::dynamic_pointer_cast<PluginInsert>(redi)) != 0) {
          boost::shared_ptr<ARDOUR::Plugin> pip=pi->plugin();
          bool ok=false;
          pip->nth_parameter(par,ok);
          if(ok){
        cerr << "parameter:     " << redi->describe_parameter(par)  << "\n";
        cerr << "default value: " << redi->default_parameter_value(par)  << "\n";
        cerr << "current value: " << pip->get_parameter(par)  << "\n";    
        Plugin::ParameterDescriptor pd;
        pip->get_parameter_descriptor(par,pd);
        cerr << "lower value:   " << pd.lower << "\n";
        cerr << "upper value:   " << pd.upper << "\n";
          }else{
        cerr << "parameter id out of range:" << par << "\n";
          }
        } else {
          cerr << "redirect is not a incert piid:" << piid << "\n";
        }
      } else {
        cerr << "redirect is not existing piid:" << piid << "\n";
      }
    } else {
      cerr << "route is not existing redi id:" << rid << "\n";
    }
    
    return 0;
}
-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail


More information about the Ardour-Dev mailing list