rt300@0: // rt300@0: // SynthParam.h rt300@0: // tweakathlon rt300@0: // rt300@0: // Created by Robert Tubb on 10/10/2014. rt300@0: // rt300@0: // rt300@0: rt300@0: #ifndef tweakathlon_SynthParam_h rt300@0: #define tweakathlon_SynthParam_h rt300@0: rt300@0: // class that handles what a synth param "is" , a wrapper for the pd control rt300@0: class SynthParam { rt300@0: public: rt300@0: static int mappingUID; rt300@0: rt300@0: rt300@0: AppCore* core; rt300@0: SynthParam(int aVal , AppCore* aCore, string aName, string aSynthPrefix){ rt300@0: mappingID = mappingUID++; rt300@0: value = aVal; rt300@0: core = aCore; rt300@0: name = aName; rt300@0: synthPrefix = aSynthPrefix; rt300@0: // log the fact that this id is mapped to a certain param? rt300@0: }; rt300@0: void setValue(int i){ rt300@0: value = i; rt300@0: sendToPD(); rt300@0: }; rt300@9: void setValueWithoutSend(int i){ rt300@9: value = i; rt300@9: } rt300@0: int getValue() const{ rt300@0: return value; rt300@0: } rt300@0: int getID() const {return mappingID;}; rt300@0: string getName() const {return name;}; rt300@0: void sendToPD() const rt300@0: { rt300@0: // sends this parameter to pd synth rt300@0: List toPD; rt300@0: toPD.addSymbol(synthPrefix); rt300@0: toPD.addSymbol(name); rt300@0: toPD.addFloat(value); // rounding here?? rt300@0: rt300@0: core->pd.sendList("fromOF", toPD); rt300@0: //cout << "sending" << synthPrefix << ":" << name << " : " << value << "\n"; rt300@0: }; rt300@0: rt300@0: private: rt300@0: int value; // 0 to 127 rt300@0: int mappingID; // should be globally unique rt300@0: string name; // the string that gets routed in PD, and also the display label (?) rt300@0: string synthPrefix; rt300@0: rt300@0: }; rt300@0: rt300@0: #endif