Ejemplo n.º 1
0
 virtual void initComponentInstance(ComponentInstance *c){
     try {
         const char *s = pTopic->get(c->component);
         diamondapparatus::subscribe(s);
     } catch(diamondapparatus::DiamondException e){
         printf("Diamond problem : %s\n",e.what());
     }
 }
Ejemplo n.º 2
0
 virtual void onParamChanged(ComponentInstance *ci,UNUSED Parameter *p){
     try {
         if(p == pTopic){
             const char *s = pTopic->get(ci->component);
             diamondapparatus::subscribe(s);
         }
     } catch(diamondapparatus::DiamondException e){
         printf("Diamond problem : %s\n",e.what());
     }
 }
Ejemplo n.º 3
0
 virtual void run(ComponentInstance *ci,int out){
     Component *c = ci->component;
     const char *s = pTopic->get(c);
     float o;
     
     try {
         diamondapparatus::Topic t = diamondapparatus::get(s);
         
         if(out<t.size()){
             o = t[out].f();
             o *= pMul[out]->get(c);
             o += pAdd[out]->get(c);
         } else
             o = 0;
     } catch(diamondapparatus::DiamondException e){
         printf("Diamond problem : %s\n",e.what());
         o=0;
     }
     tFloat->setOutput(ci,out,o);
 }
Ejemplo n.º 4
0
 virtual void run(ComponentInstance *ci,int out){
     Component *c = ci->component;
     OSCData *d = (OSCData *)ci->privateData;
     
     bool changed=false;
     float data[NUMOSCINS];
     int outct=0;
     for(int i=0;i<NUMOSCINS;i++){
         if(c->isInputConnected(i)){
             float in = tFloat->getInput(ci,i);
             data[outct++]=in;
             if(in!=d->prev[i]){
                 d->prev[i]=in;
                 changed=true;
             }
         }
     }
     if(changed){
         sendOsc(pTopic->get(c),data,outct);
     }
 }
Ejemplo n.º 5
0
 virtual const char *getExtraText(Component *c,char *buf){
     sprintf(buf,"topic:%s",pTopic->get(c));
     return buf;
 }