comparison testApp.h @ 0:a223551fdc1f

First commit - copy from tweakathlon.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 10 Oct 2014 11:46:42 +0100
parents
children 851833072cf1
comparison
equal deleted inserted replaced
-1:000000000000 0:a223551fdc1f
1 #pragma once
2
3 #include "ofMain.h"
4
5 //#include "ofxiPhone.h"
6 //#include "ofxiPhoneExtras.h"
7 // #include "ofxiPhoneExternalDisplay.h"
8
9 #include "ofxiOS.h"
10 #include "ofxiOSExtras.h"
11
12 #include "ofxOsc.h"
13 #include "ofxMidi.h"
14 #include "2dvector.h"
15 #include "AppCore.h"
16 #include "eventLogger.h"
17 #include "ofxPd.h"
18 #include "json.h"
19 #import "QuestionnaireViewController.h"
20 #import "HelpViewController.h"
21 #import "UsernameAlertViewController.h"
22 #import "IntroViewController.h"
23 #include "sliderPanel.h"
24 #include "UIElement.h"
25 #include "UIElementContainer.h"
26 #include "buttron.h"
27 #include "ButtronSlider.h"
28 #include "buttronXY.h"
29 #include "UIGrid.h"
30 #include "MessageOrganiser.h"
31 #include "TestController.h"
32 #include "timeController.h"
33 #include <buttonPanel.h>
34 #include "targetSymbol.h"
35 #include "3Dbox.h"
36 #include "TextPanel.h"
37 //#define OSC_HOST "169.254.1.1"
38 //#define OSC_PORT 12345
39
40 #define SLIDER_GUI_WIDTH 256
41 #define SLIDER_HEIGHT 256
42 #define NUM_PARAMS 10
43
44
45
46 class testApp : public ofxiOSApp , public ofxMidiListener, public ofxMidiConnectionListener {
47
48
49 public:
50 ofTrueTypeFont verdBig;
51 bool sendMIDIAndOSC;
52 bool paused;
53
54 int midiChannel;
55 int midiOffset;
56 double tx,ty;
57 ofColor generalBackground;
58 //
59 void initialiseGUIs();
60 void initialiseVariables();
61 void initialiseMIDI();
62 void setupUIElements();
63
64 void setup();
65 void update();
66 void draw();
67 void drawUIElements();
68 void exit();
69
70 HelpViewController *helpViewController;
71 QuestionnaireViewController *questionnaireViewController;
72 UsernameAlertViewController *usernameAlertViewController;
73 IntroViewController * introViewController;
74
75 MessageOrganiser messageOrganiser;
76 TestController* testController;
77 //TimeController timeController;
78 interfaceType whichInterfaceShowing, previousInterface;
79
80 // pannels buttrons and slidertrons
81 vector<UIElement *> UIElements;
82
83 void touchToUIElements(int x, int y, touchType ttype, int tid);
84 void touchDown(ofTouchEventArgs &touch);
85 void touchMoved(ofTouchEventArgs &touch);
86 void touchUp(ofTouchEventArgs &touch);
87 void touchDoubleTap(ofTouchEventArgs &touch);
88 void touchCancelled(ofTouchEventArgs &touch);
89 double ofFixGetWidth();
90 double ofFixGetHeight();
91 ofTouchEventArgs transformTouchCoords(ofTouchEventArgs &point);
92 ofLight light;
93
94 void lostFocus();
95 void gotFocus();
96 void gotMemoryWarning();
97 void deviceOrientationChanged(int newOrientation);
98
99 // ofxOscSender sender;
100 // void sendOSCParams();
101
102 void showQuestionnaire();
103 void questionnaireHidden(vector<int> answers, const char* userComments);
104
105 void showIntro();
106 void introHidden();
107 void startTheTests();
108 void showHelp();
109 void helpHidden();
110 void setupNewUser();
111 void appModeChange(interfaceType mode);
112
113 void sendParametersToPD();
114
115 void sendMidiParams();
116 void sendMidiParam(int which);
117
118 // audio callbacks
119 float * wavetableNew;
120 int bufSize;
121 void drawWaveform();
122 void drawScore();
123 void audioReceived(float * input, int bufferSize, int nChannels);
124 void audioRequested(float * output, int bufferSize, int nChannels);
125
126 AppCore core;
127
128 // message
129 void addMessage(string msg);
130
131 // midi message callback
132 void newMidiMessage(ofxMidiMessage& msg);
133
134 // midi device (dis)connection event callbacks
135 void midiInputAdded(string name, bool isNetwork);
136 void midiInputRemoved(string name, bool isNetwork);
137
138 void midiOutputAdded(string nam, bool isNetwork);
139 void midiOutputRemoved(string name, bool isNetwork);
140
141 vector<ofxMidiIn*> inputs;
142 vector<ofxMidiOut*> outputs;
143
144 deque<string> messages;
145 int maxMessages;
146
147 int note, ctl;
148 vector<unsigned char> bytes;
149
150 // in the h file:
151 ofTrueTypeFont myfont;
152
153 void windowResized(int w, int h){};
154
155 void rotateToPortrait(){};
156 void rotateToPortraitUpSideDown(){};
157 void rotateToLandscapeLeft(){};
158 void rotateToLandscapeRight(){};
159 void toggleAutoRotation(){};
160
161 };
162
163 // should be off split into
164 // GUI controller
165 // parameter converter
166 // MIDI stuff(?)
167
168