# HG changeset patch # User Robert Tubb # Date 1413810743 -3600 # Node ID af71bf84660f817ebc504ac1b0f34dba5cd0e8e0 # Parent 91c3fba6e5b9801095509ff65338169c1a0905d7 icon stuff. not working/tested. diff -r 91c3fba6e5b9 -r af71bf84660f AppCore.mm --- a/AppCore.mm Mon Oct 20 11:23:55 2014 +0100 +++ b/AppCore.mm Mon Oct 20 14:12:23 2014 +0100 @@ -172,8 +172,7 @@ } void AppCore::receiveFloat(const std::string& dest, float value) { - cout << "OF: receiveFloat " << dest << ": " << value << endl; - + if (dest == "onTickOF"){ // call our on tick function clockTickSender(value); diff -r 91c3fba6e5b9 -r af71bf84660f ExplorePresetManager.h --- a/ExplorePresetManager.h Mon Oct 20 11:23:55 2014 +0100 +++ b/ExplorePresetManager.h Mon Oct 20 14:12:23 2014 +0100 @@ -91,7 +91,7 @@ Preset* getPreset(int index){ if (index >= thePresets.size()){ - cout << "ERROR: index exceeds number of presets" << endl; + cout << "ERROR: index " << index << " exceeds number of presets " << thePresets.size() << endl; return NULL; }else{ return thePresets[index]; diff -r 91c3fba6e5b9 -r af71bf84660f PDSynthWrapper.h --- a/PDSynthWrapper.h Mon Oct 20 11:23:55 2014 +0100 +++ b/PDSynthWrapper.h Mon Oct 20 14:12:23 2014 +0100 @@ -37,8 +37,8 @@ timbreParams.push_back(SynthParam(64,aCore,"FiltTyp",sp)); timbreParams.push_back(SynthParam(64,aCore,"FiltFrq",sp)); - timbreParams.push_back(SynthParam(64,aCore,"SPAM",sp)); - timbreParams.push_back(SynthParam(64,aCore,"FILTH",sp)); + //timbreParams.push_back(SynthParam(64,aCore,"SPAM",sp)); + //timbreParams.push_back(SynthParam(64,aCore,"FILTH",sp)); //timbreParams.push_back(SynthParam(64,aCore,"reson",sp)); if (timbreParams.size() != TOTAL_NUM_PARAMS){ @@ -245,6 +245,12 @@ core->pd.sendMessage("fromOF", "startMetro", toPD); } + void stopMetronome(){ + // play the noise + List toPD; + core->pd.sendMessage("fromOF", "stopMetro", toPD); + + } void onTick(int tickNo){ // diff -r 91c3fba6e5b9 -r af71bf84660f PresetView.h --- a/PresetView.h Mon Oct 20 11:23:55 2014 +0100 +++ b/PresetView.h Mon Oct 20 14:12:23 2014 +0100 @@ -8,23 +8,47 @@ #ifndef __riftathon__PresetView__ #define __riftathon__PresetView__ +#include "ofMain.h" +#include +#include "UIProperties.h" +#include "UIElement.h" +#include "ofxiPhoneExtras.h" +class PresetIconView{ + +public: + PresetIconView(string aName, string aImageFileName){ + imageFileName = aImageFileName; + if (imageFileName != ""){ + // these are NOT put in images/ directory for some reason... + string fname = ofFilePath::getAbsolutePath(ofToDataPath(imageFileName)); -#include + ofFile f = ofFile(fname); + + + cout << fname << endl; + cout << f.exists() << endl; + + image.loadImage(fname); + } + -#include "presetManager.h" -#include "UIElement.h" + name = aName; -class PresetIconView : public UIElement { + + + }; + + bool handleMyTouch(int x, int y, touchType ttype, int touchID){ + return false; + } + ofImage* getImage(){ + return ℑ + } +private: string imageFileName; ofImage image; string name; - - - - void draw(); - - }; #endif /* defined(__riftathon__PresetView__) */ diff -r 91c3fba6e5b9 -r af71bf84660f PresetView.mm --- a/PresetView.mm Mon Oct 20 11:23:55 2014 +0100 +++ b/PresetView.mm Mon Oct 20 14:12:23 2014 +0100 @@ -7,3 +7,5 @@ // #include "PresetView.h" + + diff -r 91c3fba6e5b9 -r af71bf84660f SequenceController.h --- a/SequenceController.h Mon Oct 20 11:23:55 2014 +0100 +++ b/SequenceController.h Mon Oct 20 14:12:23 2014 +0100 @@ -43,6 +43,8 @@ // if end of sequence return something else so we can do something // if end of tempo ramp return something else + uint randomInt = rand() % 8; + return randomInt; }; protected: diff -r 91c3fba6e5b9 -r af71bf84660f TrainingMessageOrganiser.h --- a/TrainingMessageOrganiser.h Mon Oct 20 11:23:55 2014 +0100 +++ b/TrainingMessageOrganiser.h Mon Oct 20 14:12:23 2014 +0100 @@ -14,6 +14,8 @@ #include "MessageOrganiser.h" #include "SequenceController.h" #include "globalVariables.h" +#include "IconPanel.h" + extern ExplorePresetManager expPresetManager; class TrainingMessageOrganiser : public MessageOrganiser { @@ -27,6 +29,8 @@ TickListenerFunction callback; callback = boost::bind(&TrainingMessageOrganiser::onNextTick, this, _1); candidateSynth.registerForTicks(callback); + + sequencePreview = true; } void setupDefaultMapping(){ @@ -34,7 +38,7 @@ controlPanelType cpt = REVISITABLE; vector elemList; - for(int i = 0; i < 8; i++){ + for(int i = 0; i < TOTAL_NUM_PARAMS; i++){ elemList.push_back(SLIDER); } @@ -47,7 +51,7 @@ vector getMappingIDsFromSynths(){ vector index; - for(int i = 0; i < 8; i++){ + for(int i = 0; i < TOTAL_NUM_PARAMS; i++){ index.push_back(i); } vector mids = candidateSynth.getMappingIDForIndices(index); @@ -60,6 +64,9 @@ }; + void setIconPanel(IconPanel * ip){ + presetIconPanel = ip; + } void onNextTick(int tickNumber){ cout << "TICK " << tickNumber << endl; @@ -71,6 +78,7 @@ if (sequencePreview){ // show next target preset + presetIconPanel->setTextAndImage(currentTargetPreset->name, currentTargetPreset->getImage()); // show image // show name @@ -96,7 +104,9 @@ // flash the interface? }else{ - // else the user should be hitting the play button + // has this been done? yes. candidateSynth.setAllParams(ui stuff); + candidateSynth.trigger(); + showUserHowTheyDid(); } } @@ -104,7 +114,12 @@ protected: - + void showUserHowTheyDid(){ + // colour flash + // distance ? + // score + + } void loadPreset(string pname){ vector values = expPresetManager.recallPreset(pname); @@ -183,5 +198,6 @@ TrainingTestController* trainingTestController; bool sequencePreview; Preset * currentTargetPreset; + IconPanel* presetIconPanel; }; #endif /* defined(__riftathon__TrainingMessageOrganiser__) */ diff -r 91c3fba6e5b9 -r af71bf84660f UI code/UIElement.h --- a/UI code/UIElement.h Mon Oct 20 11:23:55 2014 +0100 +++ b/UI code/UIElement.h Mon Oct 20 14:12:23 2014 +0100 @@ -27,6 +27,12 @@ UIElement(); virtual ~UIElement(){}; + + UIElement(float ax, + float ay, + float awidth, + float aheight); + // recommended UIElement(float ax, float ay, diff -r 91c3fba6e5b9 -r af71bf84660f UI code/UIElement.mm --- a/UI code/UIElement.mm Mon Oct 20 11:23:55 2014 +0100 +++ b/UI code/UIElement.mm Mon Oct 20 14:12:23 2014 +0100 @@ -7,6 +7,7 @@ // #include "UIElement.h" + //---------------------------------------------------------------------- UIElement::UIElement(){ // @@ -14,6 +15,9 @@ init(); } //---------------------------------------------------------------------- + + +//---------------------------------------------------------------------- UIElement::UIElement(float ax, float ay, float awidth, diff -r 91c3fba6e5b9 -r af71bf84660f globalVariables.h --- a/globalVariables.h Mon Oct 20 11:23:55 2014 +0100 +++ b/globalVariables.h Mon Oct 20 14:12:23 2014 +0100 @@ -29,7 +29,7 @@ #define ALTERNATION_SPEED 180 // ms that target / candidate sounds play // globles -#define TOTAL_NUM_PARAMS 8 +#define TOTAL_NUM_PARAMS 6 #define TARGET_SCORE_CC_BAND 6 // number of cc vals per target band in dartboard typedef enum {TOUCH_DOWN, TOUCH_MOVED, TOUCH_UP} touchType; typedef enum {INTRO,QUESTIONNAIRE, HELP, TEST_IN_PROGRESS, SCORE_AND_HINT, COUNT_DOWN, READY_FOR_NEXT} interfaceType; diff -r 91c3fba6e5b9 -r af71bf84660f presetManager.h --- a/presetManager.h Mon Oct 20 11:23:55 2014 +0100 +++ b/presetManager.h Mon Oct 20 14:12:23 2014 +0100 @@ -23,7 +23,7 @@ #include "eventLogger.h" #include "json.h" #include - +#include "PresetView.h" //--------------------------------------------------------------------------- class Preset{ @@ -35,11 +35,15 @@ unsigned long long creationTime; // datetime that preset was created milliseconds string imageFileName; vector CCValues; // the actual data - ofImage presetImage; bool isFilled; - + PresetIconView* iconView; // from save button press - Preset(vector aCCValues, string aname, int aID, string un, unsigned int uid, string imageFile = ""){ + Preset(vector aCCValues, + string aname, + int aID, + string un, + unsigned int uid, + string imageFile = ""){ CCValues = aCCValues; if (CCValues.size()){ isFilled = true; @@ -58,8 +62,8 @@ //TODO color / texture? imageFileName = imageFile; - if (imageFile != ""){ - presetImage.loadImage("Images/" + imageFile); + if (imageFileName != ""){ + iconView = new PresetIconView(name, imageFileName); } }; @@ -85,12 +89,15 @@ } if (imageFileName != ""){ - presetImage.loadImage(imageFileName); + iconView = new PresetIconView(name, imageFileName); } + } - - void draw(); + + ofImage* getImage(){ + return iconView->getImage(); + } Json::Value presetToJson(); string displayTextDescription(){ // eg: for grid hover diff -r 91c3fba6e5b9 -r af71bf84660f presetManager.mm --- a/presetManager.mm Mon Oct 20 11:23:55 2014 +0100 +++ b/presetManager.mm Mon Oct 20 14:12:23 2014 +0100 @@ -12,10 +12,7 @@ extern EventLogger eventLogger; -//--------------------------------------------------------------------------- -void Preset::draw(){ - // probably just hint values on sliders -}; + //--------------------------------------------------------------------------- Json::Value Preset::presetToJson(){ // create the string for this instance of Preset object diff -r 91c3fba6e5b9 -r af71bf84660f testApp.mm --- a/testApp.mm Mon Oct 20 11:23:55 2014 +0100 +++ b/testApp.mm Mon Oct 20 14:12:23 2014 +0100 @@ -137,6 +137,12 @@ trainingMessageOrganiser.setBottomPanel(bottomButtonPanel); UIElements.push_back(bottomButtonPanel); bottomButtonPanel->hide(); + + IconPanel* iconPanel = new IconPanel(200, 10, 200, 150, p); + trainingMessageOrganiser.setIconPanel(iconPanel); + UIElements.push_back(iconPanel); + iconPanel->show(); + } //-------------------------------------------------------------- // gui for the old style tweakathlon stage