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