diff testApp.mm @ 9:d5e928887f51

More refactoring. Mode for Synth value changes only sent to PD on triggering sound.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 17 Oct 2014 17:50:41 +0100
parents d59de9fd3496
children af71bf84660f
line wrap: on
line diff
--- a/testApp.mm	Fri Oct 17 16:35:22 2014 +0100
+++ b/testApp.mm	Fri Oct 17 17:50:41 2014 +0100
@@ -27,6 +27,7 @@
     candidateSynth.init(&core,"candidateSynth");
     
     searchMessageOrganiser.init(targetSynth, candidateSynth);
+    trainingMessageOrganiser.init(targetSynth,candidateSynth);
     timeController.init();
     initialiseGUIs();
     initialiseMIDI();
@@ -66,7 +67,7 @@
 	ofSoundStreamSetup(2, 2, this, 44100, ofxPd::blockSize()*ticksPerBuffer, 3);
     
     if(true){ // force start
-        startTheTests();
+        startTheTrainingTests();
     }else{
         
         if(eventLogger.questionnaireCompleted){ // then show play again dialog, and log the test number
@@ -124,7 +125,18 @@
 //--------------------------------------------------------------
 // gui for the main training stage
 void testApp::setupTrainingViewPanels(){
+    UIProps p;
+    ButtonPanel* bottomButtonPanel = new ButtonPanel(1,160+p.sliderPanelHeight,ofGetWidth(),250,p);
     
+    // play and submit are now same thing
+    Buttron * playCandidateButton = new Buttron(p.buttonWidth*1.4,680, p);
+    playCandidateButton->setLabel("PLAY");
+    trainingMessageOrganiser.mapButtonToAction(playCandidateButton, TRIGGER_CANDIDATE_ID);
+    bottomButtonPanel->addButton(playCandidateButton);
+
+    trainingMessageOrganiser.setBottomPanel(bottomButtonPanel);
+    UIElements.push_back(bottomButtonPanel);
+    bottomButtonPanel->hide();
 }
 //--------------------------------------------------------------
 // gui for the old style tweakathlon  stage
@@ -167,7 +179,7 @@
     searchMessageOrganiser.setBottomPanel(bottomButtonPanel);
     UIElements.push_back(bottomButtonPanel);
     bottomButtonPanel->showBorder(false);
-
+    bottomButtonPanel->hide();
 // -   -   - - - -- -  - OTHER BITS
     
     CountdownText * countDownBox = new CountdownText("5" , 500, 380, 455, 455, p);
@@ -217,6 +229,7 @@
     
     UIElements.push_back(controlPanel);
     searchMessageOrganiser.setControlPanel(controlPanel);
+    trainingMessageOrganiser.setControlPanel(controlPanel);
     controlPanel->showBorder(true);
 }
 //--------------------------------------------------------------
@@ -229,7 +242,7 @@
 
     setupSliderPanel();
 
-    
+    setupTrainingViewPanels();
 }
 //--------------------------------------------------------------------------
 void testApp::initialiseMIDI(){
@@ -376,16 +389,24 @@
 void testApp::usernameEntered(){
     // display a thing that gives us an option as to which stage to start
     // EXPLORE, PERFORMANCE TRAINING, SEARCH
+    
+    
 }
 //--------------------------------------------------------------
-void testApp::startTheTests(){
-    eventLogger.logEvent(START_THE_TESTS);
+void testApp::startTheSearchTests(){
+    eventLogger.logEvent(START_THE_SEARCH_TESTS);
     whichInterfaceShowing = COUNT_DOWN;
     // do countdown etc
     searchMessageOrganiser.countdownToNewTest();
     // TODO how is testApp going to kknow whichInterfaceShowing ???
     
 }
+void testApp::startTheTrainingTests(){
+    eventLogger.logEvent(START_THE_TRAINING_TESTS);
+    
+    trainingMessageOrganiser.setupDefaultMapping();
+    
+}
 //--------------------------------------------------------------
 //--------------------------------------------------------------
 void testApp::showHelp(){
@@ -486,7 +507,8 @@
     //ofLine(0,150,1024,150);
     
     //drawWaveform();
-    searchMessageOrganiser.drawScore();
+    if (currentStage == SEARCH)
+        searchMessageOrganiser.drawScore();
     
     
 
@@ -642,7 +664,10 @@
         int ctl_val = msg.value;
         // TODO route control change message here
         //cout << " ctrl : " << ctl_num << " : " << ctl_val << endl;
-        searchMessageOrganiser.midiFromLeap(ctl_num, ctl_val);
+        if (currentStage == SEARCH)
+            searchMessageOrganiser.midiFromLeap(ctl_num, ctl_val);
+        
+        
     }
  
 }