annotate testApp.h @ 33:92dba082d957

Added trail and EVALUATION_POINT event type.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 26 Mar 2013 18:41:42 +0000
parents ab7c86d0f3d8
children a42903c61558
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@29 32 typedef enum {SLIDERS,ZOOMER,BOTH,INTRO,QUESTIONNAIRE, HELP}interfaceType;
rt300@24 33
rt300@32 34 class testApp : public ofxiPhoneApp , public ofxiPhoneExternalDisplay{
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@29 47 TimedSessionController * tsc;
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@28 112 void questionnaireHidden(vector<int> answers, const char* userComments);
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@33 119 // shortcut function for testing
rt300@33 120 void justStart();
rt300@24 121
rt300@24 122 void setupBottomGui();
rt300@24 123 void bottomGuiEvent();
rt300@24 124 void setupTopGui();
rt300@24 125 void topGuiEvent();
rt300@16 126
rt300@0 127 // stardard GUI - knbs and sliders - hides zoomer
rt300@24 128 void sliderGUIEvent(ofxUIEventArgs &e);
rt300@24 129 void setupSliderGui();
rt300@24 130 ofxUICanvas *sliderGUI;
rt300@24 131
rt300@22 132 void sliderMoved(int which, float value);
rt300@22 133 void setAllGUISliders(vector<int> vals);
rt300@25 134 void randomise();
rt300@0 135
rt300@0 136 // zoom gui - the swap view button and save preset button
rt300@0 137 void zoomGUIEvent(ofxUIEventArgs &e);
rt300@0 138 void setupZoomGui();
rt300@0 139
rt300@22 140
rt300@3 141 void sendParametersToPD();
rt300@3 142 void sendOscShape(int ctrlin);
rt300@3 143 void sendFiltShape(int ctrlin);
rt300@3 144 void sendFiltType(int ctrlin);
rt300@3 145 void sendFiltFreq(int ctrlin);
rt300@3 146 void sendEnvShape(int ctrlin);
rt300@3 147 void sendModFreq(int ctrlin);
rt300@0 148
rt300@0 149 ofxUICanvas *zoomGUI;
rt300@0 150
rt300@2 151 // audio callbacks
rt300@2 152 void audioReceived(float * input, int bufferSize, int nChannels);
rt300@2 153 void audioRequested(float * output, int bufferSize, int nChannels);
rt300@2 154
rt300@2 155 AppCore core;
rt300@2 156
rt300@0 157 };
rt300@0 158
rt300@22 159 // should be off split into
rt300@22 160 // GUI controller
rt300@22 161 // parameter converter
rt300@22 162 //