changeset 39:96ff7b41923a

tweaking
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Thu, 04 Dec 2014 18:32:32 +0000
parents fea11c3d1d94
children accc83229d76
files SequenceController.h SequenceController.mm TrainingMessageOrganiser.mm TrainingScoreManager.h UI code/6Dbox.h UI code/6Dbox.mm UI code/ButtronSlider.h UI code/ButtronSlider.mm UI code/IconPanel.mm UI code/sliderPanel.mm testApp.mm
diffstat 11 files changed, 34 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/SequenceController.h	Thu Dec 04 17:03:01 2014 +0000
+++ b/SequenceController.h	Thu Dec 04 18:32:32 2014 +0000
@@ -15,8 +15,8 @@
 #include "TrainingScoreManager.h"
 
 #define MIN_TARGETS_IN_SEQUENCE 1
-#define NUM_REPETITIONS_AT_LEVEL 1
-#define MAX_TARGETS_IN_SEQUENCE 4
+#define NUM_REPETITIONS_AT_LEVEL 2
+#define MAX_TARGETS_IN_SEQUENCE 3
 #define MIN_TEMPO   70
 #define MAX_TEMPO   500
 #define TEMPO_RANDOM_AMOUNT
--- a/SequenceController.mm	Thu Dec 04 17:03:01 2014 +0000
+++ b/SequenceController.mm	Thu Dec 04 18:32:32 2014 +0000
@@ -286,6 +286,8 @@
         nextStep.showsResultsAtEnd = false;
         steps.push_back(nextStep);
         
+        
+        
         // generate a sequence of random preset indices
         vector<int> stepPresetIndices = randomSequence(numInSequence);
         nextStep.thisSequence = stepPresetIndices;
@@ -589,6 +591,7 @@
         }
         // move back to neutral
         nextStep.presetIndex = -1;
+        nextStep.whichInSequence = 0;
         nextStep.type = AnimStep::MATCHING_LAST;
         nextStep.showsResultsAtEnd = false;
         steps.push_back(nextStep);
@@ -619,6 +622,7 @@
         
         // move back to neutral
         nextStep.presetIndex = -1;
+        nextStep.whichInSequence = 0;
         nextStep.type = AnimStep::MATCHING_LAST;
         nextStep.showsResultsAtEnd = false;
         steps.push_back(nextStep);
@@ -650,6 +654,8 @@
         
         nextStep.type = AnimStep::MATCHING_LAST;
         nextStep.presetIndex = -1;
+        nextStep.whichInSequence = 0;
+        nextStep.showsGuides = false; // so you know when to go to neutral
         nextStep.showsResultsAtEnd = false;
         steps.push_back(nextStep);
         
--- a/TrainingMessageOrganiser.mm	Thu Dec 04 17:03:01 2014 +0000
+++ b/TrainingMessageOrganiser.mm	Thu Dec 04 18:32:32 2014 +0000
@@ -27,7 +27,7 @@
     
     setupDefaultMapping(whichInterfaceAreWeUsing);
     
-    controlPanel->setValues(zeros<int>(TOTAL_NUM_PARAMS));
+    candidateSynth.setAllParams(expPresetManager.getNeutralPreset()->getValues());
     
     doHand(true);
 }
@@ -309,8 +309,7 @@
     seqNumPanel->hide();
     oldTargetValues = newTargetValues;
     controlPanel->setColor(ofColor::black);
-    
-    bottomPanel->show(); // so people can say they forgot
+
     forgotButton->show();
 }
 //-----------------------------------------------------------------------------
@@ -337,7 +336,7 @@
     oldTargetValues = newTargetValues;
     
     controlPanel->setColor(ofColor::black);
-    bottomPanel->hide(); // so people can say they forgot, or quit
+    bottomPanel->hide();
     forgotButton->hide();
     forgotButton->turnOff();
 }
@@ -360,7 +359,8 @@
 
     showSeqNum(newStep.whichInSequence);
     displayInstructions("Preview FINISHED");
-    
+    // set candidate and sliders to neutral
+    candidateSynth.setAllParams(expPresetManager.getNeutralPreset()->getValues());
     controlPanel->setColor(ofColor::darkMagenta);
 }
 
@@ -399,6 +399,10 @@
             // set sliders to default texture
             controlPanel->setIndicatorTexture(NULL);
         }
+        
+        //bottomPanel->show();
+        forgotButton->show();
+        forgotButton->turnOff(); // please
     }
 }
 //-----------------------------------------------------------------------------
@@ -463,7 +467,7 @@
 void TrainingMessageOrganiser::flashResult(TrainingTestResult r){
     
     // stick a colored number over target position
-    controlPanel->flashResultLight(r.colorBand, 30);
+    controlPanel->flashResultLight(r.colorBand, r.timeAllowed*ofGetFrameRate()/6000.);
 
     
 }
@@ -493,6 +497,10 @@
         controlPanel->showHint(false);
         distanceSlider->hide();
     }
+    // special case - always show neutral position
+    if(currentTargetPreset->name == "Neutral"){
+        controlPanel->setAndShowHint(currentTargetPreset->getValues(), currentTargetPreset->getImage());
+    }
     
 }
 //-----------------------------------------------------------------------------
--- a/TrainingScoreManager.h	Thu Dec 04 17:03:01 2014 +0000
+++ b/TrainingScoreManager.h	Thu Dec 04 18:32:32 2014 +0000
@@ -157,9 +157,7 @@
         msg << getMessageForBand(band) << endl;
         msg << "Distance: " << dist << endl;
         msg << "Score: " << round(TP*10) << endl;
-        msg << "-----" << endl;
-        msg << "Time allowed: " << timeAllowed/1000.0 << endl;
-        msg << "-----" << endl;
+
 
         result.realDistanceToTarget = dist;
         result.targetBandHit = band; // eg bullseye = 0 edge = 7
--- a/UI code/6Dbox.h	Thu Dec 04 17:03:01 2014 +0000
+++ b/UI code/6Dbox.h	Thu Dec 04 18:32:32 2014 +0000
@@ -109,7 +109,7 @@
     void showValueIndicator(bool showing){
         indicatorShowing = showing;
     };
-    void flashScore(int score, ofColor col);
+    void flashScore(int score, ofColor col, int howLong);
 private:
 
     
--- a/UI code/6Dbox.mm	Thu Dec 04 17:03:01 2014 +0000
+++ b/UI code/6Dbox.mm	Thu Dec 04 18:32:32 2014 +0000
@@ -463,7 +463,7 @@
 }
 
 //--------------------------------------------------------------------
-void Leap6DBox::flashScore(int score, ofColor col){
-    showScoreForFrames = 20;
+void Leap6DBox::flashScore(int score, ofColor col, int howLong){
+    showScoreForFrames = howLong;
     hintColor = col;
 }
--- a/UI code/ButtronSlider.h	Thu Dec 04 17:03:01 2014 +0000
+++ b/UI code/ButtronSlider.h	Thu Dec 04 18:32:32 2014 +0000
@@ -86,7 +86,7 @@
     void animateHintToNewValue(int newVal, float timeToTake);
     void animateToNewValue(int newVal, float timeToTake);
     void update();
-    void flashScore(int score, ofColor col);
+    void flashScore(int score, ofColor col, int howLong);
     
 private:
     void drawIndicator(double proportion);
--- a/UI code/ButtronSlider.mm	Thu Dec 04 17:03:01 2014 +0000
+++ b/UI code/ButtronSlider.mm	Thu Dec 04 18:32:32 2014 +0000
@@ -155,7 +155,7 @@
     return true;
 }
 //--------------------------------------------------------------------
-void ButtronSlider::flashScore(int score, ofColor col){
-    showScoreForFrames = 20;
+void ButtronSlider::flashScore(int score, ofColor col, int howLong){
+    showScoreForFrames = howLong;
     flashColor = col;
 }
--- a/UI code/IconPanel.mm	Thu Dec 04 17:03:01 2014 +0000
+++ b/UI code/IconPanel.mm	Thu Dec 04 18:32:32 2014 +0000
@@ -79,7 +79,7 @@
 void IconPanel::drawTexture(){
     float z = 10;
     ofSetColor(255,255,255);
-    textureImage->draw(x+30,y+20,z,width-20,height-30);
+    textureImage->draw(x+30,y+30,z,width-20,height-30);
     ofSetColor(foregroundHi);
 }
 //------------------------------------------------------------------
@@ -97,7 +97,7 @@
         fg = fgInactive;
     }
     ofSetColor(fg);
-    verdana16.drawString(labelName, x + thickness*2, y + 35);
+    verdana16.drawString(labelName, x + 40, y + 8);
     
 }
 //------------------------------------------------------------------
--- a/UI code/sliderPanel.mm	Thu Dec 04 17:03:01 2014 +0000
+++ b/UI code/sliderPanel.mm	Thu Dec 04 18:32:32 2014 +0000
@@ -362,12 +362,12 @@
         if (subElements[0]->getType() == LEAP6D){
             Leap6DBox * box = (Leap6DBox*)subElements[0];
             
-            box->flashScore(5, c);
+            box->flashScore(5, c,howLong);
         }
     }else if(thisPanelType == ALL_SLIDERS){
         for(auto UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
             ButtronSlider* thisSlider = (ButtronSlider *)(*UIitr);
-            thisSlider->flashScore(5, c);
+            thisSlider->flashScore(5, c,howLong);
             
         }
     }
--- a/testApp.mm	Thu Dec 04 17:03:01 2014 +0000
+++ b/testApp.mm	Thu Dec 04 18:32:32 2014 +0000
@@ -153,7 +153,7 @@
     Buttron * menuButton = new Buttron(props->buttonWidth*1.4,680, *props);
     menuButton->setLabel("TO MENU");
     mapButtonToAction(menuButton, TO_MENU_ID);
-    trainingMessageOrganiser.mapButtonToAction(menuButton, TO_MENU_ID);
+    //trainingMessageOrganiser.mapButtonToAction(menuButton, TO_MENU_ID);
     bottomButtonPanel->addButton(menuButton);
     
     bottomButtonPanel->hide();