Mercurial > hg > tweakathon2ios
diff SynthParam.h @ 0:a223551fdc1f
First commit - copy from tweakathlon.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 10 Oct 2014 11:46:42 +0100 |
parents | |
children | d5e928887f51 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SynthParam.h Fri Oct 10 11:46:42 2014 +0100 @@ -0,0 +1,57 @@ +// +// SynthParam.h +// tweakathlon +// +// Created by Robert Tubb on 10/10/2014. +// +// + +#ifndef tweakathlon_SynthParam_h +#define tweakathlon_SynthParam_h + +// class that handles what a synth param "is" , a wrapper for the pd control +class SynthParam { +public: + static int mappingUID; + + + AppCore* core; + SynthParam(int aVal , AppCore* aCore, string aName, string aSynthPrefix){ + mappingID = mappingUID++; + value = aVal; + core = aCore; + name = aName; + synthPrefix = aSynthPrefix; + // log the fact that this id is mapped to a certain param? + }; + void setValue(int i){ + value = i; + // TODO should this send an eventlog message? what if called from randomise ? what if different synth? + sendToPD(); + }; + int getValue() const{ + return value; + } + int getID() const {return mappingID;}; + string getName() const {return name;}; + void sendToPD() const + { + // sends this parameter to pd synth + List toPD; + toPD.addSymbol(synthPrefix); + toPD.addSymbol(name); + toPD.addFloat(value); // rounding here?? + + core->pd.sendList("fromOF", toPD); + //cout << "sending" << synthPrefix << ":" << name << " : " << value << "\n"; + }; + +private: + int value; // 0 to 127 + int mappingID; // should be globally unique + string name; // the string that gets routed in PD, and also the display label (?) + string synthPrefix; + +}; + +#endif