annotate 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
rev   line source
rt300@0 1 //
rt300@0 2 // SynthParam.h
rt300@0 3 // tweakathlon
rt300@0 4 //
rt300@0 5 // Created by Robert Tubb on 10/10/2014.
rt300@0 6 //
rt300@0 7 //
rt300@0 8
rt300@0 9 #ifndef tweakathlon_SynthParam_h
rt300@0 10 #define tweakathlon_SynthParam_h
rt300@0 11
rt300@0 12 // class that handles what a synth param "is" , a wrapper for the pd control
rt300@0 13 class SynthParam {
rt300@0 14 public:
rt300@0 15 static int mappingUID;
rt300@0 16
rt300@0 17
rt300@0 18 AppCore* core;
rt300@0 19 SynthParam(int aVal , AppCore* aCore, string aName, string aSynthPrefix){
rt300@0 20 mappingID = mappingUID++;
rt300@0 21 value = aVal;
rt300@0 22 core = aCore;
rt300@0 23 name = aName;
rt300@0 24 synthPrefix = aSynthPrefix;
rt300@0 25 // log the fact that this id is mapped to a certain param?
rt300@0 26 };
rt300@0 27 void setValue(int i){
rt300@0 28 value = i;
rt300@0 29 // TODO should this send an eventlog message? what if called from randomise ? what if different synth?
rt300@0 30 sendToPD();
rt300@0 31 };
rt300@0 32 int getValue() const{
rt300@0 33 return value;
rt300@0 34 }
rt300@0 35 int getID() const {return mappingID;};
rt300@0 36 string getName() const {return name;};
rt300@0 37 void sendToPD() const
rt300@0 38 {
rt300@0 39 // sends this parameter to pd synth
rt300@0 40 List toPD;
rt300@0 41 toPD.addSymbol(synthPrefix);
rt300@0 42 toPD.addSymbol(name);
rt300@0 43 toPD.addFloat(value); // rounding here??
rt300@0 44
rt300@0 45 core->pd.sendList("fromOF", toPD);
rt300@0 46 //cout << "sending" << synthPrefix << ":" << name << " : " << value << "\n";
rt300@0 47 };
rt300@0 48
rt300@0 49 private:
rt300@0 50 int value; // 0 to 127
rt300@0 51 int mappingID; // should be globally unique
rt300@0 52 string name; // the string that gets routed in PD, and also the display label (?)
rt300@0 53 string synthPrefix;
rt300@0 54
rt300@0 55 };
rt300@0 56
rt300@0 57 #endif