diff testApp.mm @ 46:1e266647840d

beta 2. interpolation movement , smoothing (crap) and timbre only.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 24 Apr 2013 17:58:08 +0100
parents c2fffc8ea84d
children 0d3a993405e4
line wrap: on
line diff
--- a/testApp.mm	Tue Apr 23 18:29:55 2013 +0100
+++ b/testApp.mm	Wed Apr 24 17:58:08 2013 +0100
@@ -12,6 +12,8 @@
 const string sliderParamNames[10] = {"Transpose", "1/4 note","1/6 note","1/7 note","1/8 note","Waveform", "Filter Type","Filter Freq", "Envelope","FM amt"};
 //const vector<const string> v(ra[0],ra[1]);
 
+// really GUI and all that stuff should be somewhere else
+
 //--------------------------------------------------------------
 void testApp::setup(){
     
@@ -24,6 +26,12 @@
     
 	int ticksPerBuffer = 8;	// 8 * 64 = buffer len of 512
 	core.setup(2, 1, 44100, ticksPerBuffer);
+    // send to PD
+    List toPD;
+    toPD.addSymbol("smoothing");
+    toPD.addFloat(70); // rounding here??
+    core.pd.sendList("fromOF", toPD);
+    //cout << ctrlName[i] << "sending" << ctrlout[i] << "\n";
     
 	// setup OF sound stream
 	ofSoundStreamSetup(2, 1, this, 44100, ofxPd::blockSize()*ticksPerBuffer, 3);
@@ -43,10 +51,11 @@
     
     // now do things that will affect the start up state of the app
     
-    if(true){
-    // if(eventLogger.questionnaireCompleted){ // then we go into do-what-you-like mode
+    //if(true){
+    if(eventLogger.questionnaireCompleted){ // then we go into do-what-you-like mode
         
         freeUseMode();
+        randomise();
     }else{
         // then we're in timed session mode
         showIntro();
@@ -62,9 +71,10 @@
 
 //DeviceID3523537000
 void testApp::initialiseVariables(){
+    animatingGrid = false;
     paused = true;
     sendMIDIAndOSC = false;
-    
+    allowAnimation = false;
     ofBackground( 0, 0, 0 );
     ofEnableAlphaBlending();
     currentSequence = 0;
@@ -328,6 +338,7 @@
     [topButtonViewController enableSmoothSwitch:(id)this];
     
     sendMIDIAndOSC = true;
+    allowAnimation = true;
 }
 //--------------------------------------------------------------
 void testApp::setInterp(int state){
@@ -365,7 +376,7 @@
         eventLogger.consentGiven = true;
         //
         // clear presets?
-        presetManager.clearAll();
+        //presetManager.clearAll();
         // show username prompt
         [usernameAlertViewController showUserNamePrompt];
         // reset top buttons
@@ -493,6 +504,9 @@
 void testApp::setAllGUISliders(vector<int> vals){
 
     // an update caused by zoomer view being moved
+    // can be called by theGridView or testApp
+    // casues PD and midi to be sent
+    
     for(int i = 0; i<NUM_PARAMS;i++){
         //sliders[i]->setValue(vals[i]);
         sliderVals[i] = vals[i];
@@ -528,24 +542,27 @@
 }
 //--------------------------------------------------------------
 void testApp::showHelp(){
+    previousInterface = whichInterfaceShowing;
     whichInterfaceShowing = HELP;
     seqStartStop(false);
     [topButtonViewController pausePressed:(id)this];
     helpViewController.view.hidden = NO;
     eventLogger.logEvent(HELP_PRESSED);
+    
 }
 void testApp::helpHidden(){
-    whichInterfaceShowing = BOTH;
+    whichInterfaceShowing = previousInterface;
     // start seq?
     
 }
 //--------------------------------------------------------------
-void testApp::nextSequence(){
+int testApp::nextSequence(){
     currentSequence++;
     if(currentSequence >= sequences.size()){
         currentSequence = 0;
     }
     sendParametersToPD();
+    return currentSequence;
 }
 //--------------------------------------------------------------
 //--------------------------------------------------------------
@@ -685,6 +702,11 @@
     
     if(paused) return;
     
+    if(theGridView.automatedMovementInProgress){
+        theGridView.update();
+        return;
+    }
+    
     if(ofxiPhoneExternalDisplay::isExternalScreenConnected()){
         if(!ofxiPhoneExternalDisplay::isMirroring()){
             ofxiPhoneExternalDisplay::mirrorOn();
@@ -692,6 +714,10 @@
         }
     }
     
+    if(animatingGrid){
+        // theGrid
+
+    }
     // continiue to move or zoom at velocity, unless snapped
     
     if (numActiveTouches == 0){ // no touches, use momentum
@@ -731,7 +757,6 @@
     }
     
 }
-
 //--------------------------------------------------------------
 
 void testApp::draw(){
@@ -760,7 +785,10 @@
 
 //--------------------------------------------------------------
 void testApp::touchDown(ofTouchEventArgs &touch){
-    
+    if(theGridView.automatedMovementInProgress) return;
+    if(whichInterfaceShowing == SLIDERS){
+        return;
+    }
     numActiveTouches++;
     preventingMovePostScroll = false;
     tapFlag = false; // unless touch 0
@@ -793,6 +821,11 @@
 
 //--------------------------------------------------------------
 void testApp::touchMoved(ofTouchEventArgs &touch){
+    if(theGridView.automatedMovementInProgress) return;
+    if(whichInterfaceShowing == SLIDERS){
+        return;
+    }
+    
     tapFlag = false;
     // which one? keep track of each touch point
     if(touch.id == 0){
@@ -817,6 +850,10 @@
 
 //--------------------------------------------------------------
 void testApp::touchUp(ofTouchEventArgs &touch){
+    if(theGridView.automatedMovementInProgress) return;
+    if(whichInterfaceShowing == SLIDERS){
+        return;
+    }
     if(numActiveTouches > 0) numActiveTouches--; // dirty
     preventingMovePostScroll = false;
     // TODO check if in gui area!!!
@@ -828,6 +865,7 @@
     if(tapFlag){
         cout << "TAP!!\n";
         // look for close preset
+    
         theGridView.tap(TwoVector(touch.x,touch.y));
     }
     tapFlag = false;