annotate testApp.h @ 38:0dfe9e0c01aa

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