diff testApp.mm @ 8:e2c6cfe8c6b7

JSON logs and presets.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Thu, 10 Jan 2013 18:24:26 +0000
parents 845ea04f8e33
children 346807b47860
line wrap: on
line diff
--- a/testApp.mm	Thu Dec 06 18:26:51 2012 +0000
+++ b/testApp.mm	Thu Jan 10 18:24:26 2013 +0000
@@ -5,10 +5,10 @@
 extern PresetManager presetManager;
 extern EventLogger eventLogger;
 extern Frequencer frequencer;
+extern IViewController *iViewController;
 //DeviceID3523537000
 //--------------------------------------------------------------
 void testApp::setup(){
-	ofSetOrientation(OF_ORIENTATION_90_LEFT);
 
 	ofBackground( 0, 0, 0 );
     ofEnableAlphaBlending();
@@ -55,14 +55,15 @@
     freqIndexes.push_back(6);
     freqIndexes.push_back(7);
     freqIndexes.push_back(8);
+
+    ofxiPhoneDeviceType device = ofxiPhoneGetDeviceType();
+    cout << "Device: " << device << '\n';
     
-    keyboard = new ofxiPhoneKeyboard(500,380,320,32);
-	keyboard->setVisible(false);
-	keyboard->setBgColor(255, 255, 255, 255);
-	keyboard->setFontColor(0,0,0, 255);
-	keyboard->setFontSize(26);
+    ofxiPhoneSetOrientation( OF_ORIENTATION_DEFAULT ); // TODO orientation CRAP
+
     
-    ofxiPhoneSetOrientation( OF_ORIENTATION_90_RIGHT );
+    //NSString * q = @"Why the hell did you do that? Are you mad?";
+    //[iViewController showQuestionPrompt:q];
     
 //-----------------
     // the number if libpd ticks per buffer,
@@ -116,13 +117,13 @@
         if(((ofxUIButton *)e.widget)->getValue()){
             cout << "SAVE PRESET\n";
             stringstream n;
-            double timemsd = [NSDate timeIntervalSinceReferenceDate];
-            long long timems = (long long)(timemsd*1000);
-            n << "P" << timems;
+            //double timemsd = [NSDate timeIntervalSinceReferenceDate];
+            //long long timems = (long long)(timemsd*1000);
+            //n << "P" << timems;
             string name = n.str();
-            
-            presetManager.addPreset(theGridView.getCoord(),name);
-            eventLogger.logEvent(SAVE_PRESET, theGridView.getCoord());
+    
+            [iViewController showPresetNamePrompt:32];
+
         }
         /*
         if(!keyboard->isKeyboardShowing()){
@@ -147,10 +148,10 @@
     }else if(e.widget->getName() == "ZOOM MAX")
     {
         if(((ofxUIButton *)e.widget)->getValue()){
-        cout << "ZOOM MAX\n";
+            cout << "ZOOM MAX\n";
             theGridView.setMaxZoom();
             eventLogger.logEvent(SET_MAX_ZOOM);
-            //eventLogger.printAll();
+
         }
     }else{
         cout << "GUI error :  unknown event recieved\n";
@@ -290,11 +291,7 @@
     }
     
     core.pd.sendList("fromOF", seqSteps);
-    //core.pd.sendMessage("fromOF", "msg", seqSteps);
-    
-    // implement synth param calculations here?
-    // oscshape,  filt type , cut off, envelope, mod freq (fm for sine, ? for pulse, sync for saw) 
-    // oscillators:
+
     sendOscShape(sliderVals[5]);
     sendFiltType(sliderVals[6]);
     sendFiltFreq(sliderVals[7]);
@@ -302,6 +299,7 @@
     sendModFreq(sliderVals[9]);
     
 }
+//--------------------------------------------------------------
 #pragma mark STANDARD OF FUNCTIONS
 //--------------------------------------------------------------
 void testApp::update(){
@@ -570,7 +568,7 @@
 //--------------------------------------------------------------
 void testApp::deviceOrientationChanged(int newOrientation){
     cout << "orientation: " << newOrientation;
-    keyboard->updateOrientation(); // takes ages , only applies to text box
+    //keyboard->updateOrientation(); // takes ages , only applies to text box
     if(newOrientation == 4){
         ofxiPhoneSetOrientation( OF_ORIENTATION_90_RIGHT );
     }else if(newOrientation == 3){
@@ -636,7 +634,7 @@
     
     return y0;
 }
-
+//---------------------------------------------------------------
 void testApp::sendOscShape(int ctrlin){
     
     static int numpoints = 5;
@@ -667,6 +665,7 @@
     }
     
 }
+//---------------------------------------------------------------
 void testApp::sendFiltType(int ctrlin){
     static int numpoints = 3;
     static int numcontrols = 4;
@@ -693,6 +692,7 @@
         //cout << ctrlName[i] << "sending" << ctrlout[i] << "\n";
     }
 }
+//---------------------------------------------------------------
 void testApp::sendFiltFreq(int ctrlin){
     List toPD;
     
@@ -701,6 +701,7 @@
     
     core.pd.sendList("fromOF", toPD);
 }
+//---------------------------------------------------------------
 void testApp::sendEnvShape(int ctrlin){
     static int numpoints = 5;
     static int numcontrols = 3;
@@ -729,6 +730,7 @@
         //cout << ctrlName[i] << "sending" << ctrlout[i] << "\n";
     }
 }
+//---------------------------------------------------------------
 void testApp::sendModFreq(int ctrlin){
     float fm = ctrlin/127.;
     List toPD;
@@ -737,4 +739,5 @@
     toPD.addFloat(fm); // rounding here??
     
     core.pd.sendList("fromOF", toPD);
-}
\ No newline at end of file
+}
+//---------------------------------------------------------------
\ No newline at end of file