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@16
|
95 float getWidth();
|
rt300@16
|
96 float getHeight();
|
rt300@16
|
97
|
rt300@16
|
98 void touchDown(ofTouchEventArgs &touch);
|
rt300@16
|
99 void touchMoved(ofTouchEventArgs &touch);
|
rt300@16
|
100 void touchUp(ofTouchEventArgs &touch);
|
rt300@16
|
101 void touchDoubleTap(ofTouchEventArgs &touch);
|
rt300@16
|
102 void touchCancelled(ofTouchEventArgs &touch);
|
rt300@0
|
103
|
rt300@1
|
104 void handleScroll();
|
rt300@1
|
105 void handleZoom();
|
rt300@1
|
106
|
rt300@0
|
107 vector<float> vectorFilter(vector<float> newVec);
|
rt300@16
|
108
|
rt300@16
|
109 void lostFocus();
|
rt300@16
|
110 void gotFocus();
|
rt300@16
|
111 void gotMemoryWarning();
|
rt300@16
|
112 void deviceOrientationChanged(int newOrientation);
|
rt300@16
|
113
|
rt300@16
|
114 ofxOscSender sender;
|
rt300@0
|
115 void sendOSCParams();
|
rt300@0
|
116
|
rt300@27
|
117 void setupNewUser();
|
rt300@27
|
118
|
rt300@24
|
119 void lockSynthPressed(bool locked);
|
rt300@24
|
120 void lockSequencerPressed(bool locked);
|
rt300@24
|
121
|
rt300@16
|
122 void showQuestionnaire();
|
rt300@28
|
123 void questionnaireHidden(vector<int> answers, const char* userComments);
|
rt300@24
|
124 void showIntro();
|
rt300@24
|
125 void introHidden(bool OK);
|
rt300@24
|
126 void interfaceSelected(int which);
|
rt300@39
|
127 void freeUseMode();
|
rt300@39
|
128
|
rt300@24
|
129 void seqStartStop(bool go);
|
rt300@27
|
130 void showHelp();
|
rt300@27
|
131 void helpHidden();
|
rt300@33
|
132 // shortcut function for testing
|
rt300@33
|
133 void justStart();
|
rt300@36
|
134 void loadSequences();
|
rt300@36
|
135 void nextSequence();
|
rt300@24
|
136
|
rt300@24
|
137 void setupBottomGui();
|
rt300@24
|
138 void bottomGuiEvent();
|
rt300@24
|
139 void setupTopGui();
|
rt300@24
|
140 void topGuiEvent();
|
rt300@16
|
141
|
rt300@0
|
142 // stardard GUI - knbs and sliders - hides zoomer
|
rt300@24
|
143 void sliderGUIEvent(ofxUIEventArgs &e);
|
rt300@24
|
144 void setupSliderGui();
|
rt300@24
|
145 ofxUICanvas *sliderGUI;
|
rt300@24
|
146
|
rt300@22
|
147 void sliderMoved(int which, float value);
|
rt300@22
|
148 void setAllGUISliders(vector<int> vals);
|
rt300@25
|
149 void randomise();
|
rt300@0
|
150
|
rt300@0
|
151 // zoom gui - the swap view button and save preset button
|
rt300@0
|
152 void zoomGUIEvent(ofxUIEventArgs &e);
|
rt300@0
|
153 void setupZoomGui();
|
rt300@0
|
154
|
rt300@22
|
155
|
rt300@3
|
156 void sendParametersToPD();
|
rt300@3
|
157 void sendOscShape(int ctrlin);
|
rt300@3
|
158 void sendFiltShape(int ctrlin);
|
rt300@3
|
159 void sendFiltType(int ctrlin);
|
rt300@3
|
160 void sendFiltFreq(int ctrlin);
|
rt300@3
|
161 void sendEnvShape(int ctrlin);
|
rt300@3
|
162 void sendModFreq(int ctrlin);
|
rt300@39
|
163 void sendMidiParams();
|
rt300@39
|
164 void sendMidiParam(int which);
|
rt300@0
|
165 ofxUICanvas *zoomGUI;
|
rt300@0
|
166
|
rt300@2
|
167 // audio callbacks
|
rt300@2
|
168 void audioReceived(float * input, int bufferSize, int nChannels);
|
rt300@2
|
169 void audioRequested(float * output, int bufferSize, int nChannels);
|
rt300@2
|
170
|
rt300@2
|
171 AppCore core;
|
rt300@2
|
172
|
rt300@39
|
173 // message
|
rt300@39
|
174 void addMessage(string msg);
|
rt300@39
|
175
|
rt300@39
|
176 // midi message callback
|
rt300@39
|
177 void newMidiMessage(ofxMidiMessage& msg);
|
rt300@39
|
178
|
rt300@39
|
179 // midi device (dis)connection event callbacks
|
rt300@39
|
180 void midiInputAdded(string name, bool isNetwork);
|
rt300@39
|
181 void midiInputRemoved(string name, bool isNetwork);
|
rt300@39
|
182
|
rt300@39
|
183 void midiOutputAdded(string nam, bool isNetwork);
|
rt300@39
|
184 void midiOutputRemoved(string name, bool isNetwork);
|
rt300@39
|
185
|
rt300@39
|
186 vector<ofxMidiIn*> inputs;
|
rt300@39
|
187 vector<ofxMidiOut*> outputs;
|
rt300@39
|
188
|
rt300@39
|
189 deque<string> messages;
|
rt300@39
|
190 int maxMessages;
|
rt300@39
|
191
|
rt300@39
|
192 int note, ctl;
|
rt300@39
|
193 vector<unsigned char> bytes;
|
rt300@39
|
194
|
rt300@0
|
195 };
|
rt300@0
|
196
|
rt300@22
|
197 // should be off split into
|
rt300@22
|
198 // GUI controller
|
rt300@22
|
199 // parameter converter
|
rt300@22
|
200 // |