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@39
|
8 #include "ofxMidi.h"
|
rt300@39
|
9
|
rt300@0
|
10 #include "grid.h"
|
rt300@0
|
11 #include "2dvector.h"
|
rt300@0
|
12 #include "ofxUI.h"
|
rt300@0
|
13 #include "eventLogger.h"
|
rt300@2
|
14 #include "AppCore.h"
|
rt300@1
|
15
|
rt300@3
|
16 #include "presetManager.h"
|
rt300@3
|
17 #include "eventLogger.h"
|
rt300@3
|
18 #include "ofxPd.h"
|
rt300@3
|
19 #include "frequencer.h"
|
rt300@3
|
20
|
rt300@8
|
21 #include "json.h"
|
rt300@8
|
22
|
rt300@16
|
23 #import "QuestionnaireViewController.h"
|
rt300@24
|
24 #import "BottomTabViewController.h"
|
rt300@24
|
25 #import "IntroViewController.h"
|
rt300@27
|
26 #import "HelpViewController.h"
|
rt300@24
|
27 #import "TopButtonViewController.h"
|
rt300@25
|
28 #import "SliderViewController.h"
|
rt300@25
|
29 #import "usernameAlertViewController.h"
|
rt300@29
|
30 #import "TimedSessionController.h"
|
rt300@29
|
31 #define OSC_HOST "169.254.1.1"
|
rt300@29
|
32 #define OSC_PORT 12345
|
rt300@8
|
33
|
rt300@39
|
34 #define SLIDER_GUI_WIDTH 256
|
rt300@38
|
35 #define SLIDER_HEIGHT 256
|
rt300@38
|
36 #define NUM_PARAMS 10
|
rt300@38
|
37
|
rt300@29
|
38 typedef enum {SLIDERS,ZOOMER,BOTH,INTRO,QUESTIONNAIRE, HELP}interfaceType;
|
rt300@24
|
39
|
rt300@39
|
40 class testApp : public ofxiPhoneApp , public ofxiPhoneExternalDisplay, public ofxMidiListener, public ofxMidiConnectionListener {
|
rt300@0
|
41
|
rt300@3
|
42
|
rt300@3
|
43 public:
|
rt300@39
|
44 bool sendMIDIAndOSC;
|
rt300@39
|
45 int midiChannel;
|
rt300@39
|
46 int midiOffset;
|
rt300@0
|
47
|
rt300@24
|
48 interfaceType whichInterfaceShowing;
|
rt300@24
|
49 BottomTabViewController *bottomTabViewController;
|
rt300@25
|
50 UsernameAlertViewController *usernameAlertViewController;
|
rt300@26
|
51 HelpViewController *helpViewController;
|
rt300@27
|
52 QuestionnaireViewController * questionnaireViewController;
|
rt300@27
|
53 IntroViewController * introViewController;
|
rt300@27
|
54 TopButtonViewController * topButtonViewController;
|
rt300@27
|
55 SliderViewController * sliderViewController;
|
rt300@29
|
56 TimedSessionController * tsc;
|
rt300@0
|
57 int prevTouchX;
|
rt300@0
|
58 int prevTouchY;
|
rt300@0
|
59 double prevDist;
|
rt300@16
|
60 bool paused;
|
rt300@0
|
61 // not many so dont bother with vectors/arrays?
|
rt300@0
|
62 TwoVector touch0;
|
rt300@0
|
63 TwoVector touch1;
|
rt300@0
|
64 TwoVector prevTouch0;
|
rt300@0
|
65 TwoVector prevTouch1;
|
rt300@5
|
66
|
rt300@0
|
67 bool xLocked, yLocked;
|
rt300@6
|
68 unsigned int lastMoveTime;
|
rt300@0
|
69
|
rt300@0
|
70 TwoVector moveVel; // velocity at which we were moving the grid
|
rt300@0
|
71
|
rt300@0
|
72 vector <ofxUISlider *> sliders;
|
rt300@0
|
73
|
rt300@0
|
74 double slowFactor;
|
rt300@0
|
75 double zoomVel; // do the same
|
rt300@0
|
76 double prevZoom, prevZoom2;
|
rt300@5
|
77 TwoVector move, prevMove, prevMove2;
|
rt300@0
|
78
|
rt300@0
|
79 vector<int> sliderVals;
|
rt300@3
|
80 vector<int> freqIndexes;
|
rt300@36
|
81 vector<vector <int> > sequences;
|
rt300@36
|
82 int currentSequence;
|
rt300@0
|
83
|
rt300@0
|
84 int numActiveTouches;
|
rt300@27
|
85 bool preventingMovePostScroll;
|
rt300@38
|
86 void setInterp(int state);
|
rt300@27
|
87
|
rt300@0
|
88 //
|
rt300@0
|
89
|
rt300@16
|
90 void setup();
|
rt300@16
|
91 void update();
|
rt300@16
|
92 void draw();
|
rt300@16
|
93 void exit();
|
rt300@16
|
94
|
rt300@42
|
95 void initialiseVariables();
|
rt300@42
|
96 void initialiseGUIs();
|
rt300@42
|
97 void initialiseMIDI();
|
rt300@42
|
98
|
rt300@42
|
99
|
rt300@16
|
100 float getWidth();
|
rt300@16
|
101 float getHeight();
|
rt300@16
|
102
|
rt300@16
|
103 void touchDown(ofTouchEventArgs &touch);
|
rt300@16
|
104 void touchMoved(ofTouchEventArgs &touch);
|
rt300@16
|
105 void touchUp(ofTouchEventArgs &touch);
|
rt300@16
|
106 void touchDoubleTap(ofTouchEventArgs &touch);
|
rt300@16
|
107 void touchCancelled(ofTouchEventArgs &touch);
|
rt300@0
|
108
|
rt300@1
|
109 void handleScroll();
|
rt300@1
|
110 void handleZoom();
|
rt300@1
|
111
|
rt300@0
|
112 vector<float> vectorFilter(vector<float> newVec);
|
rt300@16
|
113
|
rt300@16
|
114 void lostFocus();
|
rt300@16
|
115 void gotFocus();
|
rt300@16
|
116 void gotMemoryWarning();
|
rt300@16
|
117 void deviceOrientationChanged(int newOrientation);
|
rt300@16
|
118
|
rt300@16
|
119 ofxOscSender sender;
|
rt300@0
|
120 void sendOSCParams();
|
rt300@0
|
121
|
rt300@27
|
122 void setupNewUser();
|
rt300@27
|
123
|
rt300@24
|
124 void lockSynthPressed(bool locked);
|
rt300@24
|
125 void lockSequencerPressed(bool locked);
|
rt300@24
|
126
|
rt300@16
|
127 void showQuestionnaire();
|
rt300@28
|
128 void questionnaireHidden(vector<int> answers, const char* userComments);
|
rt300@24
|
129 void showIntro();
|
rt300@24
|
130 void introHidden(bool OK);
|
rt300@24
|
131 void interfaceSelected(int which);
|
rt300@39
|
132 void freeUseMode();
|
rt300@39
|
133
|
rt300@24
|
134 void seqStartStop(bool go);
|
rt300@27
|
135 void showHelp();
|
rt300@27
|
136 void helpHidden();
|
rt300@42
|
137 void startTimedSession();
|
rt300@33
|
138 // shortcut function for testing
|
rt300@33
|
139 void justStart();
|
rt300@36
|
140 void loadSequences();
|
rt300@36
|
141 void nextSequence();
|
rt300@24
|
142
|
rt300@24
|
143 void setupBottomGui();
|
rt300@24
|
144 void bottomGuiEvent();
|
rt300@24
|
145 void setupTopGui();
|
rt300@24
|
146 void topGuiEvent();
|
rt300@16
|
147
|
rt300@0
|
148 // stardard GUI - knbs and sliders - hides zoomer
|
rt300@24
|
149 void sliderGUIEvent(ofxUIEventArgs &e);
|
rt300@24
|
150 void setupSliderGui();
|
rt300@24
|
151 ofxUICanvas *sliderGUI;
|
rt300@24
|
152
|
rt300@22
|
153 void sliderMoved(int which, float value);
|
rt300@22
|
154 void setAllGUISliders(vector<int> vals);
|
rt300@25
|
155 void randomise();
|
rt300@0
|
156
|
rt300@0
|
157 // zoom gui - the swap view button and save preset button
|
rt300@0
|
158 void zoomGUIEvent(ofxUIEventArgs &e);
|
rt300@0
|
159 void setupZoomGui();
|
rt300@0
|
160
|
rt300@22
|
161
|
rt300@3
|
162 void sendParametersToPD();
|
rt300@3
|
163 void sendOscShape(int ctrlin);
|
rt300@3
|
164 void sendFiltShape(int ctrlin);
|
rt300@3
|
165 void sendFiltType(int ctrlin);
|
rt300@3
|
166 void sendFiltFreq(int ctrlin);
|
rt300@3
|
167 void sendEnvShape(int ctrlin);
|
rt300@3
|
168 void sendModFreq(int ctrlin);
|
rt300@39
|
169 void sendMidiParams();
|
rt300@39
|
170 void sendMidiParam(int which);
|
rt300@0
|
171 ofxUICanvas *zoomGUI;
|
rt300@0
|
172
|
rt300@2
|
173 // audio callbacks
|
rt300@2
|
174 void audioReceived(float * input, int bufferSize, int nChannels);
|
rt300@2
|
175 void audioRequested(float * output, int bufferSize, int nChannels);
|
rt300@2
|
176
|
rt300@2
|
177 AppCore core;
|
rt300@2
|
178
|
rt300@39
|
179 // message
|
rt300@39
|
180 void addMessage(string msg);
|
rt300@39
|
181
|
rt300@39
|
182 // midi message callback
|
rt300@39
|
183 void newMidiMessage(ofxMidiMessage& msg);
|
rt300@39
|
184
|
rt300@39
|
185 // midi device (dis)connection event callbacks
|
rt300@39
|
186 void midiInputAdded(string name, bool isNetwork);
|
rt300@39
|
187 void midiInputRemoved(string name, bool isNetwork);
|
rt300@39
|
188
|
rt300@39
|
189 void midiOutputAdded(string nam, bool isNetwork);
|
rt300@39
|
190 void midiOutputRemoved(string name, bool isNetwork);
|
rt300@39
|
191
|
rt300@39
|
192 vector<ofxMidiIn*> inputs;
|
rt300@39
|
193 vector<ofxMidiOut*> outputs;
|
rt300@39
|
194
|
rt300@39
|
195 deque<string> messages;
|
rt300@39
|
196 int maxMessages;
|
rt300@39
|
197
|
rt300@39
|
198 int note, ctl;
|
rt300@39
|
199 vector<unsigned char> bytes;
|
rt300@39
|
200
|
rt300@0
|
201 };
|
rt300@0
|
202
|
rt300@22
|
203 // should be off split into
|
rt300@22
|
204 // GUI controller
|
rt300@22
|
205 // parameter converter
|
rt300@22
|
206 // |