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()); } }
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()); } }
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); }
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); } }
virtual const char *getExtraText(Component *c,char *buf){ sprintf(buf,"topic:%s",pTopic->get(c)); return buf; }