changeset 28:953db6518738

leap version more or less there, needs btter results feedback but thats detail. "no movement" bit is stupid cos peopel can move their hand. light flash not work.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Thu, 30 Oct 2014 18:35:00 +0000
parents 27cdf475aa4b
children e7af34b1af83
files ExpMessageOrganiser.mm IntroViewController.mm MessageOrganiser.mm SearchMessageOrganiser.h SequenceController.h TrainingMessageOrganiser.mm UI code/3Dbox.h UI code/3Dbox.mm UI code/6Dbox.h UI code/6Dbox.mm UI code/IconPanel.h UI code/IconPanel.mm UI code/UIElement.h UI code/sliderPanel.h UI code/sliderPanel.mm testApp.h testApp.mm
diffstat 17 files changed, 330 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/ExpMessageOrganiser.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/ExpMessageOrganiser.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -22,6 +22,10 @@
     instructionPanel->setLabel("Find a sound\n that expresses:");
     instructionPanel->show();
     bottomPanel->show();
+    controlPanel->show();
+    controlPanel->showHint(false);
+    controlPanel->showValueIndicators(true);
+    
     okToGetMidi = true;
 }
 
@@ -43,6 +47,9 @@
         return;
     }
     presetIconPanel->setTextAndImage(expPresetManager.getCurrentPresetSlot()->name, expPresetManager.getCurrentPresetSlot()->getImage(),expPresetManager.getCurrentPresetSlot()->isFilled);
+    
+    controlPanel->setIndicatorTexture(expPresetManager.getCurrentPresetSlot()->getImage());
+    
     if(expPresetManager.getCurrentPresetSlot()->isFilled){
         // show this preset on sliders
         loadPreset(expPresetManager.getCurrentPresetSlot()->name);
@@ -90,6 +97,8 @@
         bool finished = expPresetManager.writeValuesToSlot(candidateSynth.getAllParamValues());
         if(finished){
             instructionPanel->setLabel("ALL PRESETS MADE");
+            controlPanel->hide();
+            
         }else{
             showCurrentSlot();
         }
--- a/IntroViewController.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/IntroViewController.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -53,9 +53,11 @@
     ((testApp *)self.theOFAppRef)->introHidden(1);
 }
 - (IBAction)enterTrainMode:(id)sender {
+    ((testApp *)self.theOFAppRef)->interfaceSelected(self.interfaceSelection);
     ((testApp *)self.theOFAppRef)->introHidden(2);
 }
 - (IBAction)enterSearchMode:(id)sender {
+    ((testApp *)self.theOFAppRef)->interfaceSelected(self.interfaceSelection);
     ((testApp *)self.theOFAppRef)->introHidden(3);
 }
 
--- a/MessageOrganiser.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/MessageOrganiser.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -112,29 +112,31 @@
 
 
 void MessageOrganiser::setAllSlidersToValues(vector<int> values){
-    for(int i = 0; i < values.size(); i++){
-        setUIToParam(i, values[i]);
-    }
+    controlPanel->setValues(values);
 }
 // we want to set UI object
-void MessageOrganiser::setUIToParam(int index, int value){ // e.g. from MIDI incoming, will handle both box and sliders...
-    // theXY->setValueAndScale(candidateSynth.getParamValueForID(mids[i]), candidateSynth.getParamValueForID(mids[i+1]));
-    UIElement* elem;
-    // get the element
-    if(controlPanel->subElements.size() <= index){
-        cout << "ERROR: index out of range for num sliders" << endl;
-        return;
+void MessageOrganiser::setUIToParam(int index, int value){
+    
+    if(controlPanel->getPanelType() == ALL_SLIDERS){
+        
+        UIElement* elem;
+        // get the element
+        if(controlPanel->subElements.size() <= index){
+            cout << "ERROR: index out of range for num sliders" << endl;
+            return;
+        }
+        elem = controlPanel->subElements[index];
+        if ( elem->getType() == SLIDER){
+            ButtronSlider* theSlider = (ButtronSlider*)elem;
+            theSlider->setValueAndScale(value);
+            
+        }
+    }else if (controlPanel->getPanelType() == LEAP6DOF){
+        Leap6DBox* box =  (Leap6DBox*)controlPanel->subElements[0];
+        box->setValueAndScale(index,value);
+        
     }
-    elem = controlPanel->subElements[index];
-    if ( elem->getType() == SLIDER){
-        ButtronSlider* theSlider = (ButtronSlider*)elem;
-        theSlider->setValueAndScale(value);
-        
-    }else if ( elem->getType() == LEAP6D){
-        Leap6DBox* theBox = (Leap6DBox*)elem;
-        theBox->setValueAndScale(index, value);
-    }
-
+    
 };
 
 
--- a/SearchMessageOrganiser.h	Wed Oct 29 15:38:38 2014 +0000
+++ b/SearchMessageOrganiser.h	Thu Oct 30 18:35:00 2014 +0000
@@ -406,7 +406,7 @@
                 typeListLog.push_back(int(LEAP3D));
                 
             }else{
-                cout << "ERROR ERROR: ui type not handled my mapping function !" << endl;
+                cout << "ERROR ERROR SEARCHMSGORG: ui type not handled my mapping function !" << endl;
             }
         }
         
--- a/SequenceController.h	Wed Oct 29 15:38:38 2014 +0000
+++ b/SequenceController.h	Thu Oct 30 18:35:00 2014 +0000
@@ -12,13 +12,13 @@
 #include <iostream>
 #include "ofMain.h"
 
-#define MIN_TARGETS_IN_SEQUENCE 1
+#define MIN_TARGETS_IN_SEQUENCE 2
 #define MAX_TARGETS_IN_SEQUENCE 5
 #define MIN_TEMPO   60
-#define MAX_TEMPO   120
-#define NUM_TEMPO_STEPS 16
+#define MAX_TEMPO   300
+#define NUM_TEMPO_STEPS 12
 #define NUM_PRESETS 8
-#define NO_GUIDES_LEVEL false
+#define NO_GUIDES_LEVEL true
 class AnimStep{
 
     
@@ -36,7 +36,7 @@
     stepType type;
     
     float getTimeBetweenTicks(){
-        return 1000. * (60.0/tempo);
+        return 1000* (60.0/tempo);
     }
     int presetIndex;
     int whichInSequence;
--- a/TrainingMessageOrganiser.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/TrainingMessageOrganiser.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -43,7 +43,7 @@
 //-----------------------------------------------------------------------
 void TrainingMessageOrganiser::displayInstructions(string text){
 
-    instructionPanel->setText("COUNT_IN" + ofToString(downCounter));
+    instructionPanel->setText(text);
     instructionPanel->show();
 
 }
@@ -313,6 +313,9 @@
 }
 //-----------------------------------------------------------------------------
 void TrainingMessageOrganiser::previewNeutralCount(AnimStep newStep){
+    
+    middlePanel->hide();
+    
     Preset * currentTargetPreset;
     
     // show eveything at start?
@@ -333,7 +336,7 @@
     targetSynth.setAllParams(newTargetValues);
     candidateSynth.setAllParams(newTargetValues);
     
-    displayInstructions("previewNeutralCount");
+    displayInstructions("preview Neutral Count");
 }
 //-----------------------------------------------------------------------------
 void TrainingMessageOrganiser::previewMove(AnimStep newStep){
@@ -350,9 +353,9 @@
     controlPanel->showValueIndicators(false);
     // guide animates to next target
 
-    controlPanel->setAndShowHint(newTargetValues, currentTargetPreset->getImage());
-
-    displayInstructions("previewMove");
+    //controlPanel->setAndShowHint(newTargetValues, currentTargetPreset->getImage());
+    controlPanel->animateToNewHintValues(newTargetValues, newStep.getTimeBetweenTicks()*4, currentTargetPreset->getImage());
+    displayInstructions("preview Move");
 }
 //-----------------------------------------------------------------------------
 void TrainingMessageOrganiser::previewHit(AnimStep newStep){
@@ -395,18 +398,25 @@
 }
 //-----------------------------------------------------------------------------
 void TrainingMessageOrganiser::matchingMove(AnimStep newStep){
+    middlePanel->hide();
+    
     Preset * currentTargetPreset;
     currentTargetPreset =  expPresetManager.getPresetAtIndex(newStep.presetIndex);
     vector<int> newTargetValues = currentTargetPreset->getValues();
     
     targetSynth.setAllParams(newTargetValues);
     
+    controlPanel->setHintColor(ofColor::white);
+    
     // if showing guides show all the targets as transparent ghosts
     if (newStep.showsGuides){
         presetIconPanel->setTextAndImage(currentTargetPreset->name, currentTargetPreset->getImage(), false);
         presetIconPanel->show();
         
         controlPanel->setAndShowHint(newTargetValues, currentTargetPreset->getImage());
+    }else{
+        presetIconPanel->hide();
+        controlPanel->showHint(false);
     }
     
     // show your hand and allow movement
@@ -414,28 +424,47 @@
     okToGetMidi = true;
     
     displayInstructions("Match MOVE");
+
+
+
 }
 //-----------------------------------------------------------------------------
 void TrainingMessageOrganiser::matchingHit(AnimStep newStep){
     Preset * currentTargetPreset;
     currentTargetPreset =  expPresetManager.getPresetAtIndex(newStep.presetIndex);
     vector<int> newTargetValues = currentTargetPreset->getValues();
-    
-    if (newStep.showsGuides){
-        presetIconPanel->setTextAndImage(currentTargetPreset->name, currentTargetPreset->getImage(), false);
-        presetIconPanel->show();
-       
-        controlPanel->setAndShowHint(newTargetValues, currentTargetPreset->getImage());
-    }
+
+    sendSynthValuesAgain();
     
     // show your hand and allow movement (so you can set off to next target??)
     //box6D->showIndicator(true);
     okToGetMidi = true;
     
     targetSynth.setAllParams(newTargetValues);
-    candidateSynth.trigger();
+    triggerCandidateSound();
     
     displayInstructions("Match HIT");
+    
+    
+    TrainingTestResult result =
+    trainingScoreManager.getScoreForAnswer(candidateSynth.getAllParamValues(),
+                                           newTargetValues,
+                                           newStep.getTimeBetweenTicks());
+    
+    
+    //middlePanel->setLabel(result.displayText);
+    instructionPanel->setColor(result.colorBand);
+    //middlePanel->setText(result.displayText);
+    
+    // show where you should have been
+    controlPanel->setHintColor(result.colorBand);
+    presetIconPanel->setTextAndImage(currentTargetPreset->name, currentTargetPreset->getImage(), false);
+    presetIconPanel->show();
+    controlPanel->setAndShowHint(newTargetValues, currentTargetPreset->getImage());
+
+    controlPanel->flashResultLight(result.colorBand, newStep.getTimeBetweenTicks());
+    middlePanel->show();
+    displayInstructions(result.displayText);
 }
 
 //-----------------------------------------------------------------------------
\ No newline at end of file
--- a/UI code/3Dbox.h	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/3Dbox.h	Thu Oct 30 18:35:00 2014 +0000
@@ -183,5 +183,7 @@
     ofColor backgroundLo;
     ofColor fgInactive;
     ofColor hintColor;
+    
+    
 };
 #endif /* defined(__tweakathlon___Dbox__) */
--- a/UI code/3Dbox.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/3Dbox.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -20,6 +20,8 @@
     zx = azx;
     zy = -azy; // cos of stoopid screen coords
     init(props);
+    
+
 }
 
 void Leap3DBox::init(const UIProps& props){
@@ -39,4 +41,5 @@
     on = false;
     
     myType = LEAP3D;
+
 }
\ No newline at end of file
--- a/UI code/6Dbox.h	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/6Dbox.h	Thu Oct 30 18:35:00 2014 +0000
@@ -12,6 +12,60 @@
 #include "ofxVectormath.h"
 #include <iostream>
 
+struct Node {
+    float x;
+    float y;
+    float z;
+    float roll;
+    float pitch;
+    float yaw;
+    
+    void set(vector<float> vec){
+        x = vec[0];
+        y = vec[1];
+        z = vec[2];
+        roll = vec[3];
+        pitch = vec[4];
+        yaw = vec[5];
+    }
+    void setFromCC(vector<int> vec){
+        float minVal = 0.;
+        float maxVal = 127.;
+        
+        x =  (vec[0] - minVal)/(maxVal - minVal);
+        y =  (vec[1] - minVal)/(maxVal - minVal);
+        z =  (vec[2] - minVal)/(maxVal - minVal);
+        
+        roll =  57.3*  (2.0*(vec[3] - minVal)/(maxVal - minVal) - 1.0);
+        pitch = - 57.3*  (2.0*(vec[4] - minVal)/(maxVal - minVal) - 1.0);
+        yaw =    - 57.3*  (2.0*(vec[5] - minVal)/(maxVal - minVal) - 1.0);
+    }
+    vector<float> getAsVector(){
+        vector<float> v;
+        v.push_back(x);
+        v.push_back(y);
+        v.push_back(z);
+        v.push_back(roll);
+        v.push_back(pitch);
+        v.push_back(yaw);
+        return v;
+    };
+    ofVec3f getPositionVector(){
+        ofVec3f v;
+        v.x = x;
+        v.y = y;
+        v.z = z;
+        return v;
+    };
+    ofVec3f getEulerRotVector(){
+        ofVec3f v;
+        v.x = roll;
+        v.y = pitch;
+        v.z = yaw;
+        return v;
+    };
+};
+
 class Leap6DBox : public Leap3DBoxGL {
     
 public:
@@ -33,7 +87,8 @@
     void setHintValue(int which, int val);
     void setHintTexture(ofImage* img);
     void update();
-    void animateHintToNewValues(float x, float y, float z, float r, float p, float yaw);
+    void animateHintToNewValues(vector<int> targetValues, float timeToTake, ofImage* newTexture);
+    void animateHintToNewValues(Node targetValues, float timeToTake);
     void setHintValues(vector<int> vals);
     void setValues(vector<int> vals);
     
@@ -41,7 +96,7 @@
     void showValueIndicator(bool showing){
         indicatorShowing = showing;
     };
-  
+
 private:
 
     
@@ -54,8 +109,13 @@
     float rollVal, pitchVal, yawVal;
     ofMatrix4x4 getRotationQuat(float roll, float pitch, float yaw);
     
+    ofVec3f curPos;
+    ofVec3f curRot;
+    ofVec3f posAnimIncr;
+    ofVec3f rotAnimIncr;
+    
     ofMesh handMesh;
-    ofImage* texImg;
+    ofImage* defaultHandTextureRef;
     ofImage defaultImage;
     ofImage hintImage;
     ofImage* hintImageRef;
@@ -65,6 +125,8 @@
     float hintRoll, hintPitch, hintYaw;
     float minAngVal, maxAngVal;
     bool indicatorShowing;
+    
+    bool animating;
 };
 
 
--- a/UI code/6Dbox.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/6Dbox.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -12,6 +12,8 @@
 ofVec3f fwdUnit = ofVec3f(0.0, 0.0, 1.0);
 ofVec3f rightUnit = ofVec3f(1.0, 0.0, 0.0);
 
+
+
 Leap6DBox::Leap6DBox(float ax,
                          float ay,
                          float awidth,
@@ -35,7 +37,7 @@
     hl = 1.0;
     scale = 40;
     
-    string fname = ofFilePath::getAbsolutePath(ofToDataPath("turqoise.jpeg"));
+    string fname = ofFilePath::getAbsolutePath(ofToDataPath("buttron.jpeg"));
     defaultImage.loadImage(fname);
     
     fname = ofFilePath::getAbsolutePath(ofToDataPath("bakedbeans.jpeg"));
@@ -47,15 +49,19 @@
     
     showHint(true);
     
+    myType = LEAP6D;
+    
 }
 
 void Leap6DBox::setHintValues(vector<int> vals){
+    animating = false;
+    
     if (vals.size() != 6){
         cout << "ERROR: need 6 vals for 6dof box set hint" << endl;
     }
     
     for(int i = 0; i < 6; i++){
-        Leap3DBox::setHintValue(i, vals[i]);
+        Leap6DBox::setHintValue(i, vals[i]);
     }
 }
 void Leap6DBox::setValues(vector<int> vals){
@@ -64,7 +70,7 @@
     }
     
     for(int i = 0; i < 6; i++){
-        Leap3DBox::setValueAndScale(i, vals[i]);
+        Leap6DBox::setValueAndScale(i, vals[i]);
     }
 }
 
@@ -210,7 +216,7 @@
 
 
 void Leap6DBox::setTexture(ofImage* img){
-    texImg = img;
+    defaultHandTextureRef = img;
     
     
 }
@@ -244,8 +250,8 @@
     ofTranslate( x+width/2, y+height/2, camTrans);
     ofRotate( angleX, 1, 0, 0 );
     ofRotate( angleY, 0, 1, 0 );
-    
-    
+
+    ofScale(0.7,0.7,0.7);
     ofSetColor(foregroundHi);
     boxMesh.draw();
     
@@ -307,13 +313,13 @@
     if(isHint){
         atexImg = hintImageRef;
     }else{
-        atexImg = texImg;
+        atexImg = defaultHandTextureRef;
     }
     
     if (isHint){
-        draw6DOFIndicatorBlob(x, y, z, c, hintRoll, hintPitch, 	hintYaw, hintImageRef);
+        draw6DOFIndicatorBlob(x, y, z, c, hintRoll, hintPitch, 	hintYaw, atexImg);
     }else{
-        draw6DOFIndicatorBlob(x, y, z, c, rollVal, pitchVal, yawVal, texImg);
+        draw6DOFIndicatorBlob(x, y, z, c, rollVal, pitchVal, yawVal, atexImg);
 
     }
 }
@@ -337,6 +343,7 @@
     (*atexImg).bind();
     
     handMesh.draw();
+    
     (*atexImg).unbind();
     ofPopMatrix();
     ofSetColor(c);
@@ -349,17 +356,46 @@
     rot.makeRotationMatrix(roll, fwdUnit, pitch, rightUnit, yaw, upUnit);
     return rot;
 }
-void Leap6DBox::animateHintToNewValues(float tx, float ty, float tz, float tr, float tp, float tyaw){
-    ofVec3f curAnimPos = ofVec3f(hintX, hintY,hintZ);
-    ofVec3f animtargetPos = ofVec3f(tx, ty, tz);
+void Leap6DBox::animateHintToNewValues(vector<int> targetValues, float timeToTake , ofImage* newTexture){
+
+    Node targ;
+    targ.setFromCC(targetValues);
     
-    ofMatrix4x4 curRot = getRotationQuat(hintRoll, hintPitch, hintYaw);
+    animateHintToNewValues(targ, timeToTake);
+}
+                                       
+void Leap6DBox::animateHintToNewValues(Node target, float timeToTake){
     
+    curPos = ofVec3f(hintX,hintY,hintZ);
+    curRot = ofVec3f(hintRoll,hintPitch,hintYaw);
+
+    ofVec3f targPos = target.getPositionVector();
+    ofVec3f targRot = target.getEulerRotVector();
     
+    float amtPerFrame = 1000./(ofGetFrameRate() * timeToTake);
+
+    posAnimIncr = (targPos - curPos)*amtPerFrame;
+    rotAnimIncr = (targRot - curRot)*amtPerFrame;
+    
+    animating = true;
 }
 
 // for animation
 void Leap6DBox::update(){
     
+    if(!animating) return;
     
+    curPos += posAnimIncr;
+    curRot += rotAnimIncr;
+
+    hintX = curPos.x;
+    hintY =curPos.y;
+    hintZ = curPos.z;
+    
+    hintRoll = curRot.x;
+    hintPitch = curRot.y;
+    hintYaw = curRot.z;
+    
+    // show and shit
 }
+
--- a/UI code/IconPanel.h	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/IconPanel.h	Thu Oct 30 18:35:00 2014 +0000
@@ -61,6 +61,7 @@
     ofImage* textureImage;
     bool hasBeenSet;
     bool showTick;
+    bool showCross;
 };
 
 
--- a/UI code/IconPanel.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/IconPanel.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -31,6 +31,7 @@
     hasBeenSet = false;
     textureImage = NULL;
     showTick = false;
+    showCross = false;
 }
 //------------------------------------------------------------------
 void IconPanel::draw(){
@@ -47,7 +48,8 @@
     }
     if(showTick){
         drawTick();
-    }else{
+    }
+    if(showCross){
         drawCross();
     }
     
--- a/UI code/UIElement.h	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/UIElement.h	Thu Oct 30 18:35:00 2014 +0000
@@ -115,6 +115,10 @@
         
         setZLayer(e->getZLayer() + 1);
     }
+    
+    virtual void update(){
+        
+    }
 protected:
 
     void init();
--- a/UI code/sliderPanel.h	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/sliderPanel.h	Thu Oct 30 18:35:00 2014 +0000
@@ -42,6 +42,7 @@
     void showHint(bool value);
     //
     void setHintValues(vector<int> vals);
+    void setValues(vector<int> vals);
     void setHintColor(ofColor c);
     void setSliderColors(ofColor c);
     void flash();
@@ -50,11 +51,20 @@
 
     UIElement* getSlider(int index);
     void setHintTexture(ofImage* texture);
-
+    void setIndicatorTexture(ofImage* texture);
+    void animateToNewHintValues(vector<int> newTargetValues, float timeToTake, ofImage* newTexture);
     void showValueIndicators(bool show);
+    void update();
+    controlPanelType getPanelType(){
+        return thisPanelType;
+    }
+    void flashResultLight(ofColor c, int howLong);
+    void turnOffResultLight();
 private:
     bool flashing;
     controlPanelType thisPanelType;
+    bool animating;
+    ofLight resultLight;
 };
 
 #endif /* defined(__tweakathlon__sliderPanel__) */
--- a/UI code/sliderPanel.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/UI code/sliderPanel.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -20,6 +20,15 @@
     cout << "SliderPanel auto layout contructor\n";
 
     // generateControls(elemList);// called from messageorganiser
+    
+    
+    ofVec3f ori;
+    ori.x = 1.;
+    ori.y = 0.5;
+    
+    resultLight.setOrientation(ori);
+    resultLight.setDirectional();
+    resultLight.setDiffuseColor(ofColor::white);
 }
 //--------------------------------------------------------------------------------
 
@@ -128,7 +137,23 @@
     }
     }
 }
-
+//------------------------
+void SliderPanel::setValues(vector<int> vals){
+    if (thisPanelType == LEAP6DOF){ // yeuch
+        if (subElements[0]->getType() == LEAP6D){
+            Leap6DBox * box = (Leap6DBox*)subElements[0];
+            
+            box->setValues(vals);
+        }
+    }else if(thisPanelType == ALL_SLIDERS){
+        int i = 0;
+        for(auto UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
+            ButtronSlider* thisSlider = (ButtronSlider *)(*UIitr);
+            thisSlider->setValue(vals[i]);
+            i++;
+        }
+    }
+}
 
 //-----------------------------------------------------------------------------
 vector<UIElement*> SliderPanel::generateControls(vector<controllerType> elemList, controlPanelType panelType){
@@ -215,6 +240,7 @@
 }
 //-----------------------------------------------------------------------
 void SliderPanel::setAndShowHint(vector<int> values, ofImage* texture){
+    animating = false;
     setHintValues(values);
     setHintTexture(texture);
     showHint(true);
@@ -231,4 +257,61 @@
         
     }
 }
+//------------------------------------------
+void SliderPanel::setIndicatorTexture(ofImage* texture){
+    if (thisPanelType == LEAP6DOF){ // yeuch
+        if (subElements[0]->getType() == LEAP6D){
+            Leap6DBox * box = (Leap6DBox*)subElements[0];
+            
+            box->setTexture(texture);
+        }
+        
+    }
+}
+//---------------------------------------------
+void SliderPanel::animateToNewHintValues(vector<int> newTargetValues, float timeToTake, ofImage* newTexture){
+    animating = true;
+    
+    if(thisPanelType == LEAP6DOF){
+        if (subElements[0]->getType() == LEAP6D){
+            Leap6DBox * box = (Leap6DBox*)subElements[0];
+            
+            box->animateHintToNewValues(newTargetValues, timeToTake, newTexture);
+        }
+    }
+    
+}
+//---------------------------------------------
 
+void SliderPanel::update(){
+    if(!animating) return;
+    if(thisPanelType == LEAP6DOF){
+        if (subElements[0]->getType() == LEAP6D){
+            Leap6DBox * box = (Leap6DBox*)subElements[0];
+            
+            box->update();
+        }
+    }
+    
+}
+
+
+void SliderPanel::flashResultLight(ofColor c, int howLong){
+    
+    resultLight.setDiffuseColor(c);
+    resultLight.enable();
+    // set up timer
+    TimerCallbackFunction tcb;
+    tcb = boost::bind(&SliderPanel::turnOffResultLight, this);
+    timeController.scheduleEvent(tcb, howLong);
+}
+void SliderPanel::turnOffResultLight(){
+    
+    resultLight.setDiffuseColor(ofColor::white);
+    resultLight.disable();
+}
+//---------------------------------------------
+//---------------------------------------------
+//---------------------------------------------
+//---------------------------------------------
+
--- a/testApp.h	Wed Oct 29 15:38:38 2014 +0000
+++ b/testApp.h	Thu Oct 30 18:35:00 2014 +0000
@@ -93,6 +93,7 @@
     
     // various views
     vector<UIElement *> UIElements;
+    vector<UIElement *> AnimatedUIElements;
     
     void touchToUIElements(int x, int y, touchType ttype, int tid);
     void touchDown(ofTouchEventArgs &touch);
--- a/testApp.mm	Wed Oct 29 15:38:38 2014 +0000
+++ b/testApp.mm	Thu Oct 30 18:35:00 2014 +0000
@@ -123,13 +123,8 @@
     UIElements.push_back(bottomButtonPanel);
     bottomButtonPanel->hide();
     
-    IconPanel* iconPanel = new IconPanel(420, 10, 150, 150, *props);
-    expMessageOrganiser.setIconPanel(iconPanel);
-    UIElements.push_back(iconPanel);
-    iconPanel->show();
-    
     TextPanel * instructionPanel = new TextPanel("Instrcution panel", 10, 50, 300,150,(*props));
-    instructionPanel->setFontSize(LARGEFONT);
+    instructionPanel->setFontSize(MEDIUMFONT);
     UIElements.push_back(instructionPanel);
     expMessageOrganiser.setInstructionPanel(instructionPanel);
     instructionPanel->show();
@@ -150,14 +145,10 @@
     trainingMessageOrganiser.setBottomPanel(bottomButtonPanel);
     UIElements.push_back(bottomButtonPanel);
     bottomButtonPanel->hide();
-    
-    IconPanel* iconPanel = new IconPanel(420, 10, 150, 150, *props);
-    trainingMessageOrganiser.setIconPanel(iconPanel);
-    UIElements.push_back(iconPanel);
-    iconPanel->hide();
+
     
     TextPanel * instructionPanel = new TextPanel("Instrcution panel", 10, 50, 300,150,(*props));
-    instructionPanel->setFontSize(LARGEFONT);
+    instructionPanel->setFontSize(MEDIUMFONT);
     UIElements.push_back(instructionPanel);
     trainingMessageOrganiser.setInstructionPanel(instructionPanel);
     instructionPanel->hide();
@@ -240,6 +231,12 @@
     newTestButton->hide();
     searchMessageOrganiser.setNewTestButton(newTestButton);
     
+    TextPanel * instructionPanel = new TextPanel("Instrcution panel", 10, 50, 300,150,(*props));
+    instructionPanel->setFontSize(MEDIUMFONT);
+    UIElements.push_back(instructionPanel);
+    searchMessageOrganiser.setInstructionPanel(instructionPanel);
+    instructionPanel->hide();
+    
 //    TargetSymbol* targetSymbol = new TargetSymbol(ofGetWidth()*0.5,160,30,(*props));
 //    searchMessageOrganiser.setTargetSymbol(targetSymbol);
 //    UIElements.push_back(targetSymbol);
@@ -247,7 +244,7 @@
 }
 //--------------------------------------------------------------
 void testApp::setupSliderPanel(){
-
+// setupMutualPanels
     vector<controllerType> sl2;
     sl2.push_back(SLIDER);
     
@@ -259,12 +256,22 @@
                                                  sl2);
     
     UIElements.push_back(controlPanel);
+    AnimatedUIElements.push_back(controlPanel);
     searchMessageOrganiser.setControlPanel(controlPanel);
     trainingMessageOrganiser.setControlPanel(controlPanel);
     expMessageOrganiser.setControlPanel(controlPanel);
     controlPanel->showBorder(true);
     controlPanel->hide();
     
+    
+    IconPanel* iconPanel = new IconPanel(420, 10, 150, 150, *props);
+    trainingMessageOrganiser.setIconPanel(iconPanel);
+    expMessageOrganiser.setIconPanel(iconPanel);
+    searchMessageOrganiser.setIconPanel(iconPanel);
+    UIElements.push_back(iconPanel);
+    iconPanel->hide();
+    
+    
 //    Leap6DBox * box = new Leap6DBox(400 , 210 , (*props).XYsize*0.75,(*props).XYsize*0.75,150,50, *props);
 //    searchMessageOrganiser.setBox(box);
 //    trainingMessageOrganiser.setBox(box);
@@ -275,7 +282,7 @@
 //--------------------------------------------------------------
 void testApp::setupUIElements(){
 
-    ofBackground(255,255,255);
+    ofBackground(0,0,0);
 
     setupSearchViewPanels();
 
@@ -465,7 +472,7 @@
     // do countdown etc
     
     trainingMessageOrganiser.hideMyPanels();
-    //searchMessageOrganiser.hideMyPanels();
+    searchMessageOrganiser.hideMyPanels();
     expMessageOrganiser.setup(whichInterfaceAreWeUsing);
     
     expMessageOrganiser.showMyPanels();
@@ -525,18 +532,6 @@
     
 }
 
-//--------------------------------------------------------------
-//void testApp::sendOSCParams(){
-//       
-//    ofxOscMessage m;
-//    m.setAddress( "Template" );
-//
-//    m.addFloatArg(9.9999);
-//
-//    sender.sendMessage( m );
-//}
-//--------------------------------------------------------------
-
 void testApp::setupNewUser(){
     // this function is for supervised trials with my ipad
     eventLogger.newUser();
@@ -552,8 +547,10 @@
     // look at time, work out difference
     timeController.tick();
     
-    // test mutex crash thing
-    //eventLogger.logEvent(CANDIDATE_PLAYED);
+    vector<UIElement *>::iterator UIitr;
+    for(UIitr = AnimatedUIElements.begin(); UIitr < AnimatedUIElements.end(); UIitr++){
+        (*UIitr)->update();
+    }
 }
 //--------------------------------------------------------------