annotate testApp.h @ 36:a42903c61558

Added sliderview (not operational though)
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 09 Apr 2013 13:22:28 +0100
parents 92dba082d957
children 0dfe9e0c01aa
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@36 72 vector<vector <int> > sequences;
rt300@36 73 int currentSequence;
rt300@0 74
rt300@0 75 int numActiveTouches;
rt300@27 76 bool preventingMovePostScroll;
rt300@27 77
rt300@27 78
rt300@0 79 //
rt300@0 80
rt300@16 81 void setup();
rt300@16 82 void update();
rt300@16 83 void draw();
rt300@16 84 void exit();
rt300@16 85
rt300@16 86 float getWidth();
rt300@16 87 float getHeight();
rt300@16 88
rt300@16 89 void touchDown(ofTouchEventArgs &touch);
rt300@16 90 void touchMoved(ofTouchEventArgs &touch);
rt300@16 91 void touchUp(ofTouchEventArgs &touch);
rt300@16 92 void touchDoubleTap(ofTouchEventArgs &touch);
rt300@16 93 void touchCancelled(ofTouchEventArgs &touch);
rt300@0 94
rt300@1 95 void handleScroll();
rt300@1 96 void handleZoom();
rt300@1 97
rt300@0 98 vector<float> vectorFilter(vector<float> newVec);
rt300@16 99
rt300@16 100 void lostFocus();
rt300@16 101 void gotFocus();
rt300@16 102 void gotMemoryWarning();
rt300@16 103 void deviceOrientationChanged(int newOrientation);
rt300@16 104
rt300@16 105 ofxOscSender sender;
rt300@0 106 void sendOSCParams();
rt300@0 107
rt300@27 108 void setupNewUser();
rt300@27 109
rt300@24 110 void lockSynthPressed(bool locked);
rt300@24 111 void lockSequencerPressed(bool locked);
rt300@24 112
rt300@16 113 void showQuestionnaire();
rt300@28 114 void questionnaireHidden(vector<int> answers, const char* userComments);
rt300@24 115 void showIntro();
rt300@24 116 void introHidden(bool OK);
rt300@24 117 void interfaceSelected(int which);
rt300@24 118 void seqStartStop(bool go);
rt300@27 119 void showHelp();
rt300@27 120 void helpHidden();
rt300@33 121 // shortcut function for testing
rt300@33 122 void justStart();
rt300@36 123 void loadSequences();
rt300@36 124 void nextSequence();
rt300@24 125
rt300@24 126 void setupBottomGui();
rt300@24 127 void bottomGuiEvent();
rt300@24 128 void setupTopGui();
rt300@24 129 void topGuiEvent();
rt300@16 130
rt300@0 131 // stardard GUI - knbs and sliders - hides zoomer
rt300@24 132 void sliderGUIEvent(ofxUIEventArgs &e);
rt300@24 133 void setupSliderGui();
rt300@24 134 ofxUICanvas *sliderGUI;
rt300@24 135
rt300@22 136 void sliderMoved(int which, float value);
rt300@22 137 void setAllGUISliders(vector<int> vals);
rt300@25 138 void randomise();
rt300@0 139
rt300@0 140 // zoom gui - the swap view button and save preset button
rt300@0 141 void zoomGUIEvent(ofxUIEventArgs &e);
rt300@0 142 void setupZoomGui();
rt300@0 143
rt300@22 144
rt300@3 145 void sendParametersToPD();
rt300@3 146 void sendOscShape(int ctrlin);
rt300@3 147 void sendFiltShape(int ctrlin);
rt300@3 148 void sendFiltType(int ctrlin);
rt300@3 149 void sendFiltFreq(int ctrlin);
rt300@3 150 void sendEnvShape(int ctrlin);
rt300@3 151 void sendModFreq(int ctrlin);
rt300@0 152
rt300@0 153 ofxUICanvas *zoomGUI;
rt300@0 154
rt300@2 155 // audio callbacks
rt300@2 156 void audioReceived(float * input, int bufferSize, int nChannels);
rt300@2 157 void audioRequested(float * output, int bufferSize, int nChannels);
rt300@2 158
rt300@2 159 AppCore core;
rt300@2 160
rt300@0 161 };
rt300@0 162
rt300@22 163 // should be off split into
rt300@22 164 // GUI controller
rt300@22 165 // parameter converter
rt300@22 166 //