annotate testApp.h @ 27:ae4d2c3ce5e0

Details. Zoom trailing finger move sorted. Qs rephrased.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 13 Feb 2013 17:03:56 +0000
parents 2e1fdac115af
children e2c62db1e265
rev   line source
rt300@0 1 #pragma once
rt300@0 2
rt300@0 3 #include "ofMain.h"
rt300@0 4 #include "ofxiPhone.h"
rt300@0 5 #include "ofxiPhoneExtras.h"
rt300@0 6 #include "ofxOsc.h"
rt300@0 7 #include "grid.h"
rt300@0 8 #include "2dvector.h"
rt300@0 9 #include "ofxUI.h"
rt300@0 10 #include "eventLogger.h"
rt300@2 11 #include "AppCore.h"
rt300@1 12
rt300@3 13 #include "presetManager.h"
rt300@3 14 #include "eventLogger.h"
rt300@3 15 #include "ofxPd.h"
rt300@3 16 #include "frequencer.h"
rt300@3 17
rt300@8 18 #include "json.h"
rt300@8 19
rt300@16 20
rt300@16 21 #import "QuestionnaireViewController.h"
rt300@24 22 #import "BottomTabViewController.h"
rt300@24 23 #import "IntroViewController.h"
rt300@27 24 #import "HelpViewController.h"
rt300@24 25 #import "TopButtonViewController.h"
rt300@25 26 #import "SliderViewController.h"
rt300@25 27 #import "usernameAlertViewController.h"
rt300@8 28
rt300@0 29 #define HOST "169.254.1.1"
rt300@0 30 #define PORT 12345
rt300@0 31
rt300@24 32 typedef enum {SLIDERS,ZOOMER,BOTH,INTRO,QUESTIONNAIRE}interfaceType;
rt300@24 33
rt300@0 34 class testApp : public ofxiPhoneApp {
rt300@0 35
rt300@3 36
rt300@3 37 public:
rt300@0 38
rt300@24 39 interfaceType whichInterfaceShowing;
rt300@24 40 BottomTabViewController *bottomTabViewController;
rt300@25 41 UsernameAlertViewController *usernameAlertViewController;
rt300@26 42 HelpViewController *helpViewController;
rt300@27 43 QuestionnaireViewController * questionnaireViewController;
rt300@27 44 IntroViewController * introViewController;
rt300@27 45 TopButtonViewController * topButtonViewController;
rt300@27 46 SliderViewController * sliderViewController;
rt300@27 47
rt300@0 48 int prevTouchX;
rt300@0 49 int prevTouchY;
rt300@0 50 double prevDist;
rt300@16 51 bool paused;
rt300@0 52 // not many so dont bother with vectors/arrays?
rt300@0 53 TwoVector touch0;
rt300@0 54 TwoVector touch1;
rt300@0 55 TwoVector prevTouch0;
rt300@0 56 TwoVector prevTouch1;
rt300@5 57
rt300@0 58 bool xLocked, yLocked;
rt300@6 59 unsigned int lastMoveTime;
rt300@0 60
rt300@0 61 TwoVector moveVel; // velocity at which we were moving the grid
rt300@0 62
rt300@0 63 vector <ofxUISlider *> sliders;
rt300@0 64
rt300@0 65 double slowFactor;
rt300@0 66 double zoomVel; // do the same
rt300@0 67 double prevZoom, prevZoom2;
rt300@5 68 TwoVector move, prevMove, prevMove2;
rt300@0 69
rt300@0 70 vector<int> sliderVals;
rt300@3 71 vector<int> freqIndexes;
rt300@0 72
rt300@0 73 int numActiveTouches;
rt300@27 74 bool preventingMovePostScroll;
rt300@27 75
rt300@27 76
rt300@0 77 //
rt300@0 78
rt300@16 79 void setup();
rt300@16 80 void update();
rt300@16 81 void draw();
rt300@16 82 void exit();
rt300@16 83
rt300@16 84 float getWidth();
rt300@16 85 float getHeight();
rt300@16 86
rt300@16 87 void touchDown(ofTouchEventArgs &touch);
rt300@16 88 void touchMoved(ofTouchEventArgs &touch);
rt300@16 89 void touchUp(ofTouchEventArgs &touch);
rt300@16 90 void touchDoubleTap(ofTouchEventArgs &touch);
rt300@16 91 void touchCancelled(ofTouchEventArgs &touch);
rt300@0 92
rt300@1 93 void handleScroll();
rt300@1 94 void handleZoom();
rt300@1 95
rt300@0 96 vector<float> vectorFilter(vector<float> newVec);
rt300@16 97
rt300@16 98 void lostFocus();
rt300@16 99 void gotFocus();
rt300@16 100 void gotMemoryWarning();
rt300@16 101 void deviceOrientationChanged(int newOrientation);
rt300@16 102
rt300@16 103 ofxOscSender sender;
rt300@0 104 void sendOSCParams();
rt300@0 105
rt300@27 106 void setupNewUser();
rt300@27 107
rt300@24 108 void lockSynthPressed(bool locked);
rt300@24 109 void lockSequencerPressed(bool locked);
rt300@24 110
rt300@16 111 void showQuestionnaire();
rt300@22 112 void questionnaireHidden(vector<int> answers);
rt300@24 113 void showIntro();
rt300@24 114 void introHidden(bool OK);
rt300@24 115 void interfaceSelected(int which);
rt300@24 116 void seqStartStop(bool go);
rt300@27 117 void showHelp();
rt300@27 118 void helpHidden();
rt300@24 119
rt300@24 120 void setupBottomGui();
rt300@24 121 void bottomGuiEvent();
rt300@24 122 void setupTopGui();
rt300@24 123 void topGuiEvent();
rt300@16 124
rt300@0 125 // stardard GUI - knbs and sliders - hides zoomer
rt300@24 126 void sliderGUIEvent(ofxUIEventArgs &e);
rt300@24 127 void setupSliderGui();
rt300@24 128 ofxUICanvas *sliderGUI;
rt300@24 129
rt300@22 130 void sliderMoved(int which, float value);
rt300@22 131 void setAllGUISliders(vector<int> vals);
rt300@25 132 void randomise();
rt300@0 133
rt300@0 134 // zoom gui - the swap view button and save preset button
rt300@0 135 void zoomGUIEvent(ofxUIEventArgs &e);
rt300@0 136 void setupZoomGui();
rt300@0 137
rt300@22 138
rt300@3 139 void sendParametersToPD();
rt300@3 140 void sendOscShape(int ctrlin);
rt300@3 141 void sendFiltShape(int ctrlin);
rt300@3 142 void sendFiltType(int ctrlin);
rt300@3 143 void sendFiltFreq(int ctrlin);
rt300@3 144 void sendEnvShape(int ctrlin);
rt300@3 145 void sendModFreq(int ctrlin);
rt300@0 146
rt300@0 147 ofxUICanvas *zoomGUI;
rt300@0 148
rt300@2 149 // audio callbacks
rt300@2 150 void audioReceived(float * input, int bufferSize, int nChannels);
rt300@2 151 void audioRequested(float * output, int bufferSize, int nChannels);
rt300@2 152
rt300@2 153 AppCore core;
rt300@2 154
rt300@0 155 };
rt300@0 156
rt300@22 157 // should be off split into
rt300@22 158 // GUI controller
rt300@22 159 // parameter converter
rt300@22 160 //