Revision: 4505
          http://pd-gem.svn.sourceforge.net/pd-gem/?rev=4505&view=rev
Author:   zmoelnig
Date:     2011-08-28 12:48:29 +0000 (Sun, 28 Aug 2011)
Log Message:
-----------
start paramnumber at 1

to match the inlet: 0 is geminlet, 1 is 1st parameter,..

Modified Paths:
--------------
    trunk/Gem/src/Pixes/pix_frei0r.cpp

Modified: trunk/Gem/src/Pixes/pix_frei0r.cpp
===================================================================
--- trunk/Gem/src/Pixes/pix_frei0r.cpp  2011-08-28 12:48:03 UTC (rev 4504)
+++ trunk/Gem/src/Pixes/pix_frei0r.cpp  2011-08-28 12:48:29 UTC (rev 4505)
@@ -115,13 +115,17 @@
     m_parameterTypes.clear();
     m_parameter.clear();
 
+    // dummy parameter (so we start at 1)
+    m_parameterNames.push_back("");
+    m_parameterTypes.push_back(0);
+
     for(i=0; i<numparameters; i++) {
       f0r_param_info_t pinfo;
       f0r_get_param_info(&pinfo, i);
       m_parameterNames.push_back(pinfo.name);
       m_parameterTypes.push_back(pinfo.type);
 
-      ::post("parm%02d[%s]: %s", i, pinfo.name, pinfo.explanation);
+      ::post("parm%02d[%s]: %s", i+1, pinfo.name, pinfo.explanation);
     }
 
     return true;
@@ -305,7 +309,7 @@
   char tempVt[5];
 
   unsigned int i;
-  for(i=0; i<numparams; i++) {
+  for(i=1; i<numparams; i++) {
     snprintf(tempVt, 5, "#%d", i);
     tempVt[4]=0;
     unsigned int parmType=0;
@@ -415,13 +419,16 @@
 
 
 void pix_frei0r :: parmMess(int key, int argc, t_atom *argv){
+  unsigned int realkey=0;
   if(!m_plugin) {
     error("no plugin present! forgetting parameter....");
     return;
   }
-  if(key<0) {
-    error("negative parameterIDs not allowed");
+  if(key<=0) {
+    error("parameterIDs must be >0");
     return;
+  } else {
+    realkey=key-1;
   }
   if(static_cast<unsigned int>(key)>=m_plugin->m_parameterNames.size()) {
     error("parameterID out of bounds");
@@ -434,21 +441,20 @@
   double x, y;
 
   const char*name=m_plugin->m_parameterNames[key].c_str();
-
   switch(type) {
   case(F0R_PARAM_BOOL):
     if(argc!=1) {
       error("param#%02d('%s') is of type BOOL: need exactly 1 argument", key, 
name);
       return;
     }
-    m_plugin->set(key, (atom_getfloat(argv)>0.5));
+    m_plugin->set(realkey, (atom_getfloat(argv)>0.5));
     break;
   case(F0R_PARAM_DOUBLE):
     if(argc!=1) {
       error("param#%02d('%s') is of type DOUBLE: need exactly 1 argument", 
key, name);
       return;
     }
-    m_plugin->set(key, static_cast<double>(atom_getfloat(argv)));
+    m_plugin->set(realkey, static_cast<double>(atom_getfloat(argv)));
     break;
   case(F0R_PARAM_COLOR):
     if(argc!=3) {
@@ -458,7 +464,7 @@
     r=atom_getfloat(argv+0);
     g=atom_getfloat(argv+1);
     b=atom_getfloat(argv+2);
-    m_plugin->set(key, r, g, b);
+    m_plugin->set(realkey, r, g, b);
     break;
   case(F0R_PARAM_POSITION):
     if(argc!=2) {
@@ -467,14 +473,14 @@
     }
     x=atom_getfloat(argv+0);
     y=atom_getfloat(argv+1);
-    m_plugin->set(key, x, y);
+    m_plugin->set(realkey, x, y);
     break;
   case(F0R_PARAM_STRING):
     if(argc!=1) {
       error("param#%02d('%s') is of type STRING: need exactly 1 argument", 
key, name);
       return;
     }
-    m_plugin->set(key, std::string(atom_getsymbol(argv)->s_name));
+    m_plugin->set(realkey, std::string(atom_getsymbol(argv)->s_name));
     break;
   default:
     error("param#%02d('%s') is of UNKNOWN type", key, name);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
pd-gem-CVS mailing list
pd-gem-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pd-gem-cvs

Reply via email to