Mercurial > hg > tweakathon2ios
changeset 15:e439bf85b665
PDSynthWrapper reorganisation
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 21 Oct 2014 16:52:56 +0100 |
parents | f83635861187 |
children | 2da0350a4aa2 |
files | PDSynthWrapper.h UI code/IconPanel.mm testApp.mm |
diffstat | 3 files changed, 56 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/PDSynthWrapper.h Tue Oct 21 16:39:39 2014 +0100 +++ b/PDSynthWrapper.h Tue Oct 21 16:52:56 2014 +0100 @@ -17,7 +17,6 @@ #include "boost/bind.hpp" #include "boost/function.hpp" #include "SynthParam.h" -#include "presetManager.h" #include "globalVariables.h" //--------------------------------------------------------------------- //--------------------------------------------------------------------- @@ -46,6 +45,20 @@ } cout << "initialised synth: " << sp << " with " << timbreParams.size() << " params" << endl; }; + +// PD SENDERS + + void trigger(){ + // play the noise + List toPD; + toPD.addSymbol(synthPrefix); + toPD.addSymbol("playSound"); + toPD.addFloat(1.0); // volume here, just in case?? + + core->pd.sendList("fromOF", toPD); + + }; + void sendAllParams(){ std::vector<SynthParam>::const_iterator psp; for(psp = timbreParams.begin(); psp < timbreParams.end(); psp++){ @@ -69,6 +82,8 @@ core->pd.sendList("fromOF", toPD); } + +// GETTERS const int getParamValueForID(int pid){ int v = 0; std::vector<SynthParam>::const_iterator psp; @@ -127,6 +142,35 @@ return result; } + + const int getParamValueFromName(string name) const{ + + int value = -1; + std::vector<SynthParam>::const_iterator psp; + for(psp = timbreParams.begin(); psp < timbreParams.end(); psp++){ + if (psp->getName() == name){ + value = psp->getValue(); + return value; + } + + } + cout << "ERROR ERROR: getParamValueFromName name not found" << endl; + return -1; + }; + + const int getNumParams(){ + return timbreParams.size(); + }; + + vector<int> getAllParamValues(){ + vector<int> pl; + std::vector<SynthParam>::const_iterator psp; + for(psp = timbreParams.begin(); psp < timbreParams.end(); psp++){ + pl.push_back(psp->getValue()); + } + return pl; + } + void paramChangeCallback(int mappingID, int value, bool send = true){ // look for id in params @@ -143,18 +187,8 @@ } cout << "ERROR ERROR: paramChangeCallback mappingID not found" << endl; }; - - void trigger(){ - // play the noise - List toPD; - toPD.addSymbol(synthPrefix); - toPD.addSymbol("playSound"); - toPD.addFloat(1.0); // volume here, just in case?? - - core->pd.sendList("fromOF", toPD); - }; - +// SETTERS void randomiseParams(){ cout << " randomising" << endl; @@ -189,25 +223,7 @@ return randomisedIDs; }; - - const int getParamValueFromName(string name) const{ - - int value = -1; - std::vector<SynthParam>::const_iterator psp; - for(psp = timbreParams.begin(); psp < timbreParams.end(); psp++){ - if (psp->getName() == name){ - value = psp->getValue(); - return value; - } - - } - cout << "ERROR ERROR: getParamValueFromName name not found" << endl; - return -1; - }; - - const int getNumParams(){ - return timbreParams.size(); - }; + void setAllParams(vector<int> params){ if(params.size() != timbreParams.size()){ @@ -223,19 +239,7 @@ } - vector<int> getAllParamValues(){ - vector<int> pl; - std::vector<SynthParam>::const_iterator psp; - for(psp = timbreParams.begin(); psp < timbreParams.end(); psp++){ - pl.push_back(psp->getValue()); - } - return pl; - } - - void storeParamsAsPreset(string name){ // ?? - presetManager.savePreset(name, getAllParamValues()); - - } +// METRONOME STUFF void registerForTicks(TickListenerFunction callback){ core->addTickListener(callback);
--- a/UI code/IconPanel.mm Tue Oct 21 16:39:39 2014 +0100 +++ b/UI code/IconPanel.mm Tue Oct 21 16:52:56 2014 +0100 @@ -47,8 +47,8 @@ } void IconPanel::drawTexture(){ - - textureImage->draw(x+10,y+10,width-20,height-20); + float z = 10; + textureImage->draw(x+10,y+10,z,width-20,height-20); } //------------------------------------------------------------------ void IconPanel::drawTextLabel(){
--- a/testApp.mm Tue Oct 21 16:39:39 2014 +0100 +++ b/testApp.mm Tue Oct 21 16:52:56 2014 +0100 @@ -131,17 +131,18 @@ UIElements.push_back(bottomButtonPanel); bottomButtonPanel->hide(); - IconPanel* iconPanel = new IconPanel(420, 10, 150, 150, *props); - trainingMessageOrganiser.setIconPanel(iconPanel); - UIElements.push_back(iconPanel); - iconPanel->show(); - TextPanel * instructionPanel = new TextPanel("Instrcution panel", 10, 50, 300,150,(*props)); instructionPanel->setFontSize(LARGEFONT); UIElements.push_back(instructionPanel); trainingMessageOrganiser.setInstructionPanel(instructionPanel); instructionPanel->show(); + IconPanel* iconPanel = new IconPanel(420, 10, 150, 150, *props); + trainingMessageOrganiser.setIconPanel(iconPanel); + UIElements.push_back(iconPanel); + iconPanel->show(); + + } //-------------------------------------------------------------- // gui for the old style tweakathlon stage