view SynthParam.h @ 44:d810aa9ca03a

times. cosmetic stuff
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Mon, 15 Dec 2014 17:33:41 +0000
parents d5e928887f51
children
line wrap: on
line source
//
//  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;
        sendToPD();
    };
    void setValueWithoutSend(int i){
        value = i;
    }
    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