rt300@0
|
1 #include "testApp.h"
|
rt300@2
|
2
|
rt300@24
|
3 #define SLIDER_GUI_WIDTH 256
|
rt300@25
|
4 #define NUM_PARAMS 10
|
rt300@0
|
5 extern Grid theGridView;
|
rt300@0
|
6 extern PresetManager presetManager;
|
rt300@1
|
7 extern EventLogger eventLogger;
|
rt300@3
|
8 extern Frequencer frequencer;
|
rt300@9
|
9
|
rt300@24
|
10 const vector<string> parameterNames;
|
rt300@24
|
11
|
rt300@24
|
12 const string sliderParamNames[10] = {"Transpose", "1/4 note","1/6 note","1/7 note","1/8 note","Waveform", "Filter Type","Filter Freq", "Envelope","FM amt"};
|
rt300@24
|
13 //const vector<const string> v(ra[0],ra[1]);
|
rt300@24
|
14
|
rt300@24
|
15
|
rt300@7
|
16 //DeviceID3523537000
|
rt300@0
|
17 //--------------------------------------------------------------
|
rt300@0
|
18 void testApp::setup(){
|
rt300@16
|
19 paused = true;
|
rt300@16
|
20
|
rt300@24
|
21
|
rt300@16
|
22 ofBackground( 0, 0, 0 );
|
rt300@0
|
23 ofEnableAlphaBlending();
|
rt300@21
|
24 //ofEnableSmoothing();
|
rt300@0
|
25
|
rt300@0
|
26 // open an outgoing connection to HOST:PORT
|
rt300@0
|
27 sender.setup( HOST, PORT );
|
rt300@3
|
28 ofSetFrameRate(30);
|
rt300@0
|
29 // reciever
|
rt300@6
|
30 lastMoveTime = ofGetSystemTimeMicros();
|
rt300@0
|
31 prevTouchX = 0;
|
rt300@0
|
32 prevTouchY = 0;
|
rt300@0
|
33
|
rt300@0
|
34 xLocked = false;
|
rt300@0
|
35 yLocked = false;
|
rt300@0
|
36
|
rt300@0
|
37 numActiveTouches = 0;
|
rt300@3
|
38 touch0.setCoord(17./7., 2./3.);
|
rt300@0
|
39 touch1.setCoord(10,20);
|
rt300@3
|
40
|
rt300@0
|
41 prevTouch0.setCoord(1,2);
|
rt300@0
|
42 prevTouch1.setCoord(10,20);
|
rt300@0
|
43 prevDist = 10;
|
rt300@16
|
44 slowFactor = 0.98;
|
rt300@16
|
45
|
rt300@16
|
46
|
rt300@16
|
47 // the 5 harmonics for the frequencer
|
rt300@16
|
48 freqIndexes.push_back(0);
|
rt300@16
|
49 freqIndexes.push_back(4);
|
rt300@16
|
50 freqIndexes.push_back(6);
|
rt300@16
|
51 freqIndexes.push_back(7);
|
rt300@16
|
52 freqIndexes.push_back(8);
|
rt300@16
|
53
|
rt300@16
|
54
|
rt300@16
|
55 ofxiPhoneSetOrientation( OFXIPHONE_ORIENTATION_PORTRAIT ); // do this before setting up all the other objects
|
rt300@0
|
56
|
rt300@24
|
57 // initialise the interfaces
|
rt300@0
|
58 theGridView.init();
|
rt300@0
|
59
|
rt300@24
|
60 setupSliderGui();
|
rt300@24
|
61 sliderGUI->setVisible(true);
|
rt300@0
|
62
|
rt300@0
|
63 // initial slider vals
|
rt300@0
|
64 for(int i=0; i<10;i++){
|
rt300@0
|
65 sliderVals.push_back(64);
|
rt300@0
|
66 }
|
rt300@8
|
67
|
rt300@24
|
68 // initialise PD
|
rt300@24
|
69
|
rt300@2
|
70 int ticksPerBuffer = 8; // 8 * 64 = buffer len of 512
|
rt300@2
|
71
|
rt300@2
|
72 // setup the app core
|
rt300@2
|
73 core.setup(2, 1, 44100, ticksPerBuffer);
|
rt300@2
|
74
|
rt300@2
|
75 // setup OF sound stream
|
rt300@2
|
76 ofSoundStreamSetup(2, 1, this, 44100, ofxPd::blockSize()*ticksPerBuffer, 3);
|
rt300@1
|
77
|
rt300@24
|
78
|
rt300@24
|
79
|
rt300@24
|
80 // set up iOS gui stuff
|
rt300@24
|
81 bottomTabViewController = [[BottomTabViewController alloc] initWithNibName:@"BottomTabViewController" bundle:nil];
|
rt300@24
|
82 [ofxiPhoneGetGLParentView() addSubview:bottomTabViewController.view];
|
rt300@24
|
83
|
rt300@24
|
84 [bottomTabViewController setAppRef:(id)this];
|
rt300@24
|
85 [bottomTabViewController show:(id)this];
|
rt300@24
|
86
|
rt300@24
|
87 bottomTabViewController.view.frame = CGRectMake(0,getHeight()-44,getWidth(),44);
|
rt300@24
|
88
|
rt300@24
|
89 /////
|
rt300@24
|
90
|
rt300@24
|
91 topButtonViewController = [[TopButtonViewController alloc] initWithNibName:@"TopButtonViewController" bundle:nil];
|
rt300@24
|
92 [ofxiPhoneGetGLParentView() addSubview:topButtonViewController.view];
|
rt300@24
|
93 [topButtonViewController setAppRef:(id)this];
|
rt300@24
|
94 [topButtonViewController show:(id)this];
|
rt300@24
|
95 topButtonViewController.view.frame = CGRectMake(0,0,getWidth(),44);
|
rt300@24
|
96
|
rt300@25
|
97 usernameAlertViewController = [[UsernameAlertViewController alloc] init];
|
rt300@25
|
98 /*
|
rt300@25
|
99 sliderViewController = [[SliderViewController alloc] initWithNibName:@"SLiderViewController" bundle:nil];
|
rt300@25
|
100 [ofxiPhoneGetGLParentView() addSubview:sliderViewController.view];
|
rt300@25
|
101
|
rt300@25
|
102 [sliderViewController setAppRef:(id)this];
|
rt300@25
|
103 [sliderViewController show:(id)this];
|
rt300@25
|
104
|
rt300@25
|
105 sliderViewController.view.frame = CGRectMake(0,getHeight()-43 - 363,getWidth(),44);
|
rt300@25
|
106 */
|
rt300@25
|
107
|
rt300@24
|
108 // initialise user logging stuff
|
rt300@5
|
109 presetManager.startupLoadAll();
|
rt300@7
|
110 eventLogger.init();
|
rt300@24
|
111
|
rt300@25
|
112 whichInterfaceShowing = BOTH;
|
rt300@24
|
113 // GO
|
rt300@16
|
114 paused = false;
|
rt300@16
|
115
|
rt300@24
|
116 }
|
rt300@24
|
117
|
rt300@24
|
118
|
rt300@24
|
119 //--------------------------------------------------------------
|
rt300@24
|
120 void testApp::exit(){
|
rt300@25
|
121
|
rt300@25
|
122 presetManager.exitAndSaveAll();
|
rt300@25
|
123 eventLogger.exitAndSave();
|
rt300@25
|
124
|
rt300@24
|
125 core.exit();
|
rt300@24
|
126
|
rt300@25
|
127 // are these handled automatically?
|
rt300@25
|
128 //[introViewController release];
|
rt300@25
|
129 //[topButtonViewController release];
|
rt300@25
|
130 //[bottomTabViewController release];
|
rt300@24
|
131
|
rt300@24
|
132 delete sliderGUI;
|
rt300@24
|
133
|
rt300@24
|
134 cout << "exit done \n";
|
rt300@0
|
135 }
|
rt300@24
|
136
|
rt300@24
|
137 //--------------------------------------------------------------
|
rt300@3
|
138 #pragma mark GUI
|
rt300@16
|
139 //--
|
rt300@16
|
140 float testApp::getWidth(){
|
rt300@16
|
141 // depends on orientation
|
rt300@16
|
142 return ofGetWidth();
|
rt300@16
|
143
|
rt300@16
|
144 }
|
rt300@16
|
145 float testApp::getHeight(){
|
rt300@16
|
146 // depends on orientation
|
rt300@16
|
147 return ofGetHeight();
|
rt300@16
|
148
|
rt300@16
|
149 }
|
rt300@24
|
150 #pragma mark GUI
|
rt300@24
|
151 ////////////////////////////
|
rt300@24
|
152 // These functions called from iOS toolbars
|
rt300@24
|
153 //--------------------------------------------------------------
|
rt300@24
|
154 void testApp::lockSequencerPressed(bool locked){
|
rt300@24
|
155 theGridView.shiftCentreToSnapped();
|
rt300@24
|
156 xLocked = locked;
|
rt300@25
|
157 eventLogger.logEvent(SEQ_LOCKED);
|
rt300@25
|
158
|
rt300@24
|
159
|
rt300@24
|
160 }
|
rt300@24
|
161 //--------------------------------------------------------------
|
rt300@24
|
162 void testApp::lockSynthPressed(bool locked){
|
rt300@24
|
163 theGridView.shiftCentreToSnapped();
|
rt300@24
|
164 yLocked = locked;
|
rt300@25
|
165 eventLogger.logEvent(SYNTH_LOCKED);
|
rt300@24
|
166
|
rt300@24
|
167 }
|
rt300@24
|
168 //--------------------------------------------------------------
|
rt300@24
|
169 void testApp::seqStartStop(bool go){
|
rt300@24
|
170 if(!go){ //stop
|
rt300@24
|
171 core.pd.startMessage();
|
rt300@24
|
172 core.pd.addFloat(0);
|
rt300@24
|
173 core.pd.finishMessage("fromOF", "seqStartStop");
|
rt300@25
|
174 eventLogger.logEvent(PAUSE_PRESSED);
|
rt300@24
|
175 }else { // play
|
rt300@24
|
176 //stopSequencer();
|
rt300@24
|
177 core.pd.startMessage();
|
rt300@24
|
178 core.pd.addFloat(1);
|
rt300@24
|
179 core.pd.finishMessage("fromOF", "seqStartStop");
|
rt300@25
|
180 eventLogger.logEvent(PLAY_PRESSED);
|
rt300@24
|
181 }
|
rt300@24
|
182 }
|
rt300@24
|
183 //--------------------------------------------------------------
|
rt300@24
|
184 void testApp::showQuestionnaire(){
|
rt300@24
|
185 // stop updating / drawing
|
rt300@24
|
186
|
rt300@24
|
187 // if(eventLogger.questionnaireCompleted) return;
|
rt300@24
|
188
|
rt300@24
|
189 paused = true;
|
rt300@24
|
190
|
rt300@24
|
191 //stopSequencer
|
rt300@24
|
192 core.pd.startMessage();
|
rt300@24
|
193 core.pd.addFloat(0);
|
rt300@24
|
194 core.pd.finishMessage("fromOF", "seqStartStop");
|
rt300@24
|
195
|
rt300@24
|
196 questionnaireViewController = [[QuestionnaireViewController alloc] initWithNibName:@"QuestionnaireViewController" bundle:nil];
|
rt300@24
|
197 [ofxiPhoneGetGLParentView() addSubview:questionnaireViewController.view];
|
rt300@24
|
198
|
rt300@24
|
199 [questionnaireViewController setAppRef:(id)this];
|
rt300@24
|
200 [questionnaireViewController show:(id)this];
|
rt300@24
|
201
|
rt300@24
|
202 whichInterfaceShowing = QUESTIONNAIRE;
|
rt300@24
|
203
|
rt300@24
|
204
|
rt300@24
|
205 }
|
rt300@24
|
206 //--------------------------------------------------------------
|
rt300@24
|
207 void testApp::questionnaireHidden(vector<int> answers){
|
rt300@24
|
208 // send answers to server as json
|
rt300@24
|
209 eventLogger.questionnaireAnswersObtained(answers);
|
rt300@24
|
210
|
rt300@24
|
211 // set "we've done questionnaire" to true in event logger
|
rt300@24
|
212 paused = false;
|
rt300@24
|
213
|
rt300@24
|
214 //startSequencer (TODO what about the toggle ? ?)
|
rt300@24
|
215 core.pd.startMessage();
|
rt300@24
|
216 core.pd.addFloat(1);
|
rt300@24
|
217 core.pd.finishMessage("fromOF", "seqStartStop");
|
rt300@24
|
218 whichInterfaceShowing = BOTH;
|
rt300@24
|
219 // tell bottomtabviewcontroller
|
rt300@24
|
220
|
rt300@24
|
221 }
|
rt300@24
|
222 //--------------------------------------------------------------
|
rt300@24
|
223 void testApp::showIntro(){
|
rt300@24
|
224 paused = true;
|
rt300@25
|
225
|
rt300@24
|
226 cout << "SHOW INTRO\n";
|
rt300@24
|
227
|
rt300@24
|
228 introViewController = [[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil];
|
rt300@24
|
229 [ofxiPhoneGetGLParentView() addSubview:introViewController.view];
|
rt300@24
|
230
|
rt300@24
|
231 [introViewController setAppRef:(id)this];
|
rt300@24
|
232 [introViewController show:(id)this];
|
rt300@24
|
233
|
rt300@24
|
234
|
rt300@24
|
235 whichInterfaceShowing = INTRO;
|
rt300@24
|
236
|
rt300@24
|
237 }
|
rt300@24
|
238 //--------------------------------------------------------------
|
rt300@24
|
239 void testApp::introHidden(bool OK){
|
rt300@24
|
240 if(OK){
|
rt300@24
|
241 paused = false;
|
rt300@25
|
242 eventLogger.consentGiven = true;
|
rt300@24
|
243 whichInterfaceShowing = BOTH;
|
rt300@25
|
244 // show username prompt
|
rt300@25
|
245 [usernameAlertViewController showUserNamePrompt];
|
rt300@24
|
246 }
|
rt300@24
|
247 // no unOK
|
rt300@24
|
248 }
|
rt300@24
|
249 //--------------------------------------------------------------
|
rt300@24
|
250 // called from BottomTabViewController iOS segmented thing
|
rt300@24
|
251 void testApp::interfaceSelected(int which){
|
rt300@24
|
252 switch (which){
|
rt300@24
|
253 case 0:
|
rt300@24
|
254
|
rt300@24
|
255 whichInterfaceShowing = SLIDERS;
|
rt300@24
|
256 sliderGUI->setVisible(true);
|
rt300@24
|
257 // set the slider values to stuff got from zoomer
|
rt300@24
|
258 sliderVals = theGridView.getParams();
|
rt300@24
|
259 setAllGUISliders(sliderVals);
|
rt300@25
|
260
|
rt300@24
|
261 break;
|
rt300@24
|
262 case 1:
|
rt300@24
|
263
|
rt300@24
|
264 whichInterfaceShowing = BOTH;
|
rt300@24
|
265 sliderGUI->setVisible(true);
|
rt300@24
|
266 // set the slider values to stuff got from zoomer
|
rt300@24
|
267 sliderVals = theGridView.getParams();
|
rt300@24
|
268 setAllGUISliders(sliderVals);
|
rt300@24
|
269 break;
|
rt300@24
|
270 case 2:
|
rt300@24
|
271
|
rt300@24
|
272 sliderGUI->setVisible(false);
|
rt300@24
|
273 whichInterfaceShowing = ZOOMER;
|
rt300@24
|
274 break;
|
rt300@24
|
275 }
|
rt300@25
|
276 eventLogger.logEvent(SWAP_VIEW,TwoVector(),0.0, which);
|
rt300@24
|
277 }
|
rt300@24
|
278 //--------------------------------------------------------------
|
rt300@24
|
279 //--------------------------------------------------------------
|
rt300@24
|
280 void testApp::setupSliderGui(){
|
rt300@24
|
281 float xInit = OFX_UI_GLOBAL_WIDGET_SPACING;
|
rt300@24
|
282 float length = SLIDER_GUI_WIDTH - (OFX_UI_GLOBAL_WIDGET_SPACING*2);
|
rt300@24
|
283
|
rt300@24
|
284
|
rt300@24
|
285 //float dim = 42;
|
rt300@24
|
286
|
rt300@24
|
287 // make this iphone size...?
|
rt300@24
|
288 int height = 480;
|
rt300@24
|
289 int width = 320;
|
rt300@24
|
290 float dim = (height-10.0*OFX_UI_GLOBAL_WIDGET_SPACING)/10.0;
|
rt300@24
|
291 // LEFT GUI
|
rt300@24
|
292 sliderGUI = new ofxUICanvas(0,100,SLIDER_GUI_WIDTH,getHeight());
|
rt300@24
|
293
|
rt300@24
|
294 // Uh.. loop this
|
rt300@24
|
295 for(int i = 1; i<=10;i++){
|
rt300@24
|
296
|
rt300@24
|
297 ofxUISlider *slider;
|
rt300@25
|
298 slider = (ofxUISlider *)sliderGUI->addWidgetDown(new ofxUISlider(length,dim,0.0,127,64,sliderParamNames[i-1]));
|
rt300@24
|
299 slider->setDrawPadding(true);
|
rt300@24
|
300 if(i <= 5){
|
rt300@24
|
301 slider->setColorFill(ofColor(0,0,255));
|
rt300@24
|
302 slider->setColorFillHighlight(ofColor(0,0,255));
|
rt300@24
|
303 }else{
|
rt300@24
|
304 slider->setColorFill(ofColor(255,0,0));
|
rt300@24
|
305 slider->setColorFillHighlight(ofColor(255,0,0));
|
rt300@24
|
306 }
|
rt300@24
|
307
|
rt300@24
|
308 sliders.push_back(slider);
|
rt300@24
|
309 }
|
rt300@24
|
310
|
rt300@24
|
311
|
rt300@24
|
312
|
rt300@24
|
313 ofAddListener(sliderGUI->newGUIEvent, this, &testApp::sliderGUIEvent);
|
rt300@24
|
314
|
rt300@24
|
315 }
|
rt300@24
|
316 //--------------------------------------------------------------
|
rt300@24
|
317 void testApp::sliderGUIEvent(ofxUIEventArgs &e){
|
rt300@24
|
318 if(whichInterfaceShowing == ZOOMER){
|
rt300@24
|
319 cout << "GUI ERROR";
|
rt300@24
|
320 return;
|
rt300@24
|
321 }
|
rt300@24
|
322
|
rt300@0
|
323 // "normal" parameter changes
|
rt300@0
|
324 for(int i = 1; i<=10;i++){
|
rt300@0
|
325
|
rt300@24
|
326 if(e.widget->getName() == sliderParamNames[i-1])
|
rt300@0
|
327 {
|
rt300@0
|
328 //cout << "param change: " << p;
|
rt300@0
|
329 ofxUISlider *slider = (ofxUISlider *) e.widget;
|
rt300@3
|
330 sliderMoved(i-1,slider->getScaledValue()); // internal array 0 indexed
|
rt300@0
|
331 }
|
rt300@0
|
332 }
|
rt300@24
|
333
|
rt300@0
|
334 }
|
rt300@0
|
335 //--------------------------------------------------------------
|
rt300@3
|
336 void testApp::sliderMoved(int which, float value){
|
rt300@3
|
337 // an update caused by slider view being touched
|
rt300@0
|
338 sliderVals[which] = (int)value;
|
rt300@0
|
339 theGridView.setParams(sliderVals);
|
rt300@24
|
340
|
rt300@3
|
341 sendParametersToPD();
|
rt300@5
|
342
|
rt300@9
|
343 eventLogger.logEvent(CHANGE_SLIDER, TwoVector(),0.0,which , value);
|
rt300@5
|
344
|
rt300@0
|
345 }
|
rt300@0
|
346 //--------------------------------------------------------------
|
rt300@3
|
347 void testApp::setAllGUISliders(vector<int> vals){
|
rt300@3
|
348 // an update caused by zoomer view being moved
|
rt300@25
|
349 for(int i = 0; i<NUM_PARAMS;i++){
|
rt300@0
|
350 sliders[i]->setValue(vals[i]);
|
rt300@1
|
351 sliderVals[i] = vals[i];
|
rt300@0
|
352 }
|
rt300@3
|
353
|
rt300@0
|
354 }
|
rt300@0
|
355 //--------------------------------------------------------------
|
rt300@25
|
356 void testApp::randomise(){
|
rt300@25
|
357 // pick random settings for all params
|
rt300@25
|
358 for(int i=0; i < NUM_PARAMS ; i++){
|
rt300@25
|
359 sliderVals[i] = ofRandom(0, 127);
|
rt300@25
|
360
|
rt300@25
|
361 }
|
rt300@25
|
362
|
rt300@25
|
363 // send to grid, sliders and PD
|
rt300@25
|
364 theGridView.setParams(sliderVals);
|
rt300@25
|
365 setAllGUISliders(sliderVals);
|
rt300@25
|
366 sendParametersToPD();
|
rt300@25
|
367
|
rt300@25
|
368 eventLogger.logEvent(RANDOMISE, theGridView.getCoord() ,0.0);
|
rt300@25
|
369
|
rt300@25
|
370 }
|
rt300@25
|
371 //--------------------------------------------------------------
|
rt300@3
|
372 void testApp::sendParametersToPD(){
|
rt300@3
|
373 // frequencer stuff to get 16 steps
|
rt300@3
|
374 vector<double> vals;
|
rt300@3
|
375
|
rt300@3
|
376
|
rt300@3
|
377 vals.push_back((sliderVals[0]+32)*8.); // DC offset
|
rt300@3
|
378 for(int i=1; i<5;i++){
|
rt300@3
|
379 vals.push_back((sliderVals[i] - 64)*2.);
|
rt300@3
|
380 }
|
rt300@3
|
381
|
rt300@3
|
382 vector<double> steps = frequencer.freqMagEdit(freqIndexes, vals);
|
rt300@3
|
383 // send a list using the List object
|
rt300@3
|
384 List seqSteps;
|
rt300@3
|
385
|
rt300@3
|
386 seqSteps.addSymbol("seqSteps");
|
rt300@3
|
387 for(int i=0; i < 16; i++){
|
rt300@3
|
388 seqSteps.addFloat(round(steps[i])); // rounding here??
|
rt300@3
|
389 }
|
rt300@3
|
390
|
rt300@3
|
391 core.pd.sendList("fromOF", seqSteps);
|
rt300@8
|
392
|
rt300@3
|
393 sendOscShape(sliderVals[5]);
|
rt300@3
|
394 sendFiltType(sliderVals[6]);
|
rt300@3
|
395 sendFiltFreq(sliderVals[7]);
|
rt300@3
|
396 sendEnvShape(sliderVals[8]);
|
rt300@3
|
397 sendModFreq(sliderVals[9]);
|
rt300@3
|
398
|
rt300@3
|
399 }
|
rt300@8
|
400 //--------------------------------------------------------------
|
rt300@3
|
401 #pragma mark STANDARD OF FUNCTIONS
|
rt300@3
|
402 //--------------------------------------------------------------
|
rt300@0
|
403 void testApp::update(){
|
rt300@0
|
404 //we do a heartbeat on iOS as the phone will shut down the network connection to save power
|
rt300@0
|
405 //this keeps the network alive as it thinks it is being used.
|
rt300@16
|
406 if(paused) return;
|
rt300@16
|
407
|
rt300@0
|
408 if( ofGetFrameNum() % 120 == 0 ){
|
rt300@0
|
409 ofxOscMessage m;
|
rt300@0
|
410 m.setAddress( "/misc/heartbeat" );
|
rt300@0
|
411 m.addIntArg( ofGetFrameNum() );
|
rt300@0
|
412 sender.sendMessage( m );
|
rt300@0
|
413 }
|
rt300@0
|
414
|
rt300@5
|
415 // continiue to move at velocity, unless snapped
|
rt300@3
|
416
|
rt300@3
|
417 if (numActiveTouches == 0){ // no touches, use momentum
|
rt300@3
|
418
|
rt300@22
|
419 if(moveVel.norm() > 0.3){
|
rt300@22
|
420 if(theGridView.snapped){
|
rt300@22
|
421 // stop it, send snap event
|
rt300@22
|
422 moveVel.setCoord(0.0,0.0);
|
rt300@22
|
423 }else{
|
rt300@22
|
424 theGridView.move(moveVel);
|
rt300@22
|
425 moveVel = moveVel*slowFactor;
|
rt300@22
|
426 }
|
rt300@3
|
427 // and get new parameter values
|
rt300@5
|
428 setAllGUISliders(theGridView.getParams());
|
rt300@3
|
429 sendParametersToPD();
|
rt300@22
|
430 }else if(moveVel.norm() > 0.01){ // and less than 0.3
|
rt300@3
|
431 // stop it
|
rt300@3
|
432 moveVel.setCoord(0.0,0.0);
|
rt300@5
|
433 setAllGUISliders(theGridView.getParams());
|
rt300@3
|
434 sendParametersToPD();
|
rt300@5
|
435 eventLogger.logEvent(SCROLL_STOPPED, theGridView.getCoord() );
|
rt300@22
|
436
|
rt300@3
|
437 }else{
|
rt300@3
|
438 // stopped - do nothing
|
rt300@3
|
439 }
|
rt300@3
|
440
|
rt300@0
|
441 }
|
rt300@0
|
442 // continiue to zoom at velocity
|
rt300@0
|
443 if (numActiveTouches < 2 && abs(zoomVel)>0.001){
|
rt300@0
|
444 theGridView.zoom(zoomVel + 1.0); // +1 because zoomVel factor is + or - , wheras zoom is a multiplier near 1
|
rt300@0
|
445 zoomVel = zoomVel*slowFactor;
|
rt300@0
|
446 }
|
rt300@6
|
447
|
rt300@0
|
448 }
|
rt300@0
|
449 //--------------------------------------------------------------
|
rt300@0
|
450 void testApp::sendOSCParams(){
|
rt300@0
|
451
|
rt300@0
|
452 vector<int> params = theGridView.getParams(); // FILTER HERE? NEED FLOATS...
|
rt300@0
|
453 vector<int>::iterator iter = params.begin();
|
rt300@0
|
454
|
rt300@0
|
455 ofxOscMessage m;
|
rt300@0
|
456 m.setAddress( "p" );
|
rt300@0
|
457
|
rt300@0
|
458 for(;iter < params.end();iter++){
|
rt300@0
|
459
|
rt300@0
|
460 m.addFloatArg( *iter );
|
rt300@0
|
461
|
rt300@0
|
462 }
|
rt300@0
|
463 sender.sendMessage( m );
|
rt300@0
|
464 }
|
rt300@0
|
465 //--------------------------------------------------------------
|
rt300@0
|
466 void testApp::draw(){
|
rt300@16
|
467 if(paused) return;
|
rt300@24
|
468
|
rt300@24
|
469 switch (whichInterfaceShowing){
|
rt300@24
|
470 case SLIDERS:
|
rt300@24
|
471 break;
|
rt300@24
|
472 case ZOOMER:
|
rt300@24
|
473 theGridView.draw();
|
rt300@24
|
474 break;
|
rt300@24
|
475 case BOTH:
|
rt300@24
|
476
|
rt300@24
|
477 theGridView.draw();
|
rt300@24
|
478 break;
|
rt300@24
|
479 case INTRO:
|
rt300@24
|
480 break;
|
rt300@24
|
481
|
rt300@24
|
482 case QUESTIONNAIRE:
|
rt300@24
|
483 break;
|
rt300@24
|
484
|
rt300@0
|
485 }
|
rt300@16
|
486
|
rt300@4
|
487
|
rt300@0
|
488 }
|
rt300@0
|
489
|
rt300@0
|
490 //--------------------------------------------------------------
|
rt300@0
|
491 void testApp::touchDown(ofTouchEventArgs &touch){
|
rt300@24
|
492
|
rt300@24
|
493 // TODO check if in gui area!!!
|
rt300@24
|
494 if(whichInterfaceShowing == SLIDERS){
|
rt300@24
|
495 return;
|
rt300@24
|
496 }else if (whichInterfaceShowing == BOTH && touch.x < (SLIDER_GUI_WIDTH+10)){
|
rt300@24
|
497 return;
|
rt300@24
|
498
|
rt300@24
|
499 }// otherwise we're good to let the zoomer handle touch
|
rt300@0
|
500
|
rt300@0
|
501 numActiveTouches++;
|
rt300@0
|
502 // absolute position doesn't matter
|
rt300@0
|
503 // which one?
|
rt300@0
|
504 if(touch.id == 0){
|
rt300@0
|
505 touch0.setCoord(touch.x,touch.y);
|
rt300@0
|
506 prevTouch0 = touch0;
|
rt300@0
|
507 }else if(touch.id == 1){
|
rt300@0
|
508
|
rt300@0
|
509 touch1.setCoord(touch.x,touch.y);
|
rt300@0
|
510 prevTouch1 = touch1;
|
rt300@0
|
511
|
rt300@0
|
512 }
|
rt300@0
|
513 if(numActiveTouches == 1){
|
rt300@0
|
514 moveVel.setCoord(0.0, 0.0);
|
rt300@0
|
515 prevMove.setCoord(0.0, 0.0);
|
rt300@0
|
516 prevMove2.setCoord(0.0, 0.0);
|
rt300@0
|
517 }else if(numActiveTouches == 2){
|
rt300@0
|
518 zoomVel = 0.0;
|
rt300@0
|
519 prevZoom = 0.0;
|
rt300@0
|
520 prevZoom2 = 0.0;
|
rt300@0
|
521 double dist = touch1.distanceTo(touch0);
|
rt300@0
|
522 prevDist = dist;
|
rt300@0
|
523 }
|
rt300@0
|
524
|
rt300@0
|
525 }
|
rt300@0
|
526
|
rt300@0
|
527 //--------------------------------------------------------------
|
rt300@0
|
528 void testApp::touchMoved(ofTouchEventArgs &touch){
|
rt300@1
|
529
|
rt300@24
|
530 // TODO check if in gui area!!!
|
rt300@24
|
531 if(whichInterfaceShowing == SLIDERS){
|
rt300@24
|
532 return;
|
rt300@24
|
533 }else if (whichInterfaceShowing == BOTH && touch.x < (SLIDER_GUI_WIDTH+10)){
|
rt300@24
|
534 return;
|
rt300@24
|
535
|
rt300@24
|
536 }// otherwise we're good to let the zoomer handle touch
|
rt300@24
|
537
|
rt300@1
|
538
|
rt300@7
|
539 // check if in other gui area
|
rt300@16
|
540 if(touch.x > getWidth()-200 && touch.y < 300){
|
rt300@7
|
541 return;
|
rt300@7
|
542 }
|
rt300@0
|
543
|
rt300@1
|
544 // which one? keep track of each touch point
|
rt300@0
|
545 if(touch.id == 0){
|
rt300@0
|
546 touch0.setCoord(touch.x,touch.y);
|
rt300@0
|
547
|
rt300@0
|
548 }else if(touch.id == 1){
|
rt300@0
|
549
|
rt300@0
|
550 touch1.setCoord(touch.x,touch.y);
|
rt300@0
|
551 }
|
rt300@0
|
552
|
rt300@1
|
553 if(numActiveTouches == 1){
|
rt300@0
|
554
|
rt300@1
|
555 handleScroll();
|
rt300@0
|
556 }else if(numActiveTouches == 2){
|
rt300@1
|
557 handleZoom();
|
rt300@0
|
558
|
rt300@0
|
559 }
|
rt300@0
|
560 prevTouch0 = touch0;
|
rt300@0
|
561
|
rt300@0
|
562
|
rt300@0
|
563 }
|
rt300@5
|
564
|
rt300@1
|
565 //--------------------------------------------------------------
|
rt300@1
|
566 void testApp::handleScroll(){
|
rt300@6
|
567
|
rt300@1
|
568 TwoVector move = touch0 - prevTouch0;
|
rt300@5
|
569 if(yLocked){
|
rt300@5
|
570 move.y = 0.0;
|
rt300@5
|
571 }
|
rt300@5
|
572 if(xLocked){
|
rt300@5
|
573 move.x = 0.0;
|
rt300@5
|
574 }
|
rt300@5
|
575
|
rt300@6
|
576 // check time since last move - if
|
rt300@6
|
577 unsigned int moveTime = ofGetSystemTimeMicros();
|
rt300@6
|
578 if(moveTime - lastMoveTime > 100000){
|
rt300@6
|
579 moveVel = TwoVector(); // zero
|
rt300@6
|
580 }else{
|
rt300@6
|
581 moveVel = (move*0.3 + prevMove*0.34 + prevMove2*0.38); // use the time
|
rt300@6
|
582
|
rt300@6
|
583 }
|
rt300@6
|
584 lastMoveTime = moveTime;
|
rt300@6
|
585
|
rt300@5
|
586
|
rt300@1
|
587 prevMove2 = prevMove;
|
rt300@1
|
588 prevMove = move;
|
rt300@1
|
589
|
rt300@5
|
590
|
rt300@3
|
591 theGridView.move(move);
|
rt300@3
|
592
|
rt300@3
|
593 // and get new parameter values
|
rt300@3
|
594 setAllGUISliders(theGridView.getParams());
|
rt300@3
|
595 sendParametersToPD();
|
rt300@1
|
596 }
|
rt300@1
|
597 //--------------------------------------------------------------
|
rt300@1
|
598 void testApp::handleZoom(){
|
rt300@1
|
599 // work out change in difference
|
rt300@1
|
600 double dist = touch1.distanceTo(touch0);
|
rt300@1
|
601 double zoomFactor = prevDist/dist;
|
rt300@1
|
602
|
rt300@1
|
603 //TODO check for sensible maximums, e.g. spurious touch data
|
rt300@1
|
604 if(zoomFactor > 2.0 || zoomFactor < 0.5){
|
rt300@1
|
605 cout << "Zoom too much!!!!" << zoomFactor;
|
rt300@1
|
606 zoomFactor = 1.0;
|
rt300@1
|
607 }
|
rt300@1
|
608
|
rt300@1
|
609 zoomVel = (zoomFactor-1)*0.3 + prevZoom*0.34 + prevZoom2*0.38;
|
rt300@1
|
610 prevZoom2 = prevZoom;
|
rt300@1
|
611 prevZoom = (zoomFactor-1);
|
rt300@1
|
612
|
rt300@1
|
613 theGridView.zoom(zoomFactor);
|
rt300@1
|
614
|
rt300@1
|
615 prevDist = dist;
|
rt300@3
|
616
|
rt300@1
|
617 }
|
rt300@0
|
618 //--------------------------------------------------------------
|
rt300@0
|
619 void testApp::touchUp(ofTouchEventArgs &touch){
|
rt300@1
|
620 if(numActiveTouches > 0) numActiveTouches--; // dirty
|
rt300@1
|
621
|
rt300@24
|
622 // TODO check if in gui area!!!
|
rt300@24
|
623 if(whichInterfaceShowing == SLIDERS){
|
rt300@24
|
624 return;
|
rt300@24
|
625 }else if (whichInterfaceShowing == BOTH && touch.x < 256){
|
rt300@24
|
626 return;
|
rt300@1
|
627
|
rt300@24
|
628 }// otherwise we're good to let the zoomer handle touch
|
rt300@24
|
629
|
rt300@1
|
630
|
rt300@0
|
631 // which one?
|
rt300@0
|
632 if(touch.id == 0){
|
rt300@0
|
633 // tricky situation - we tried to zoom but may have left non-move finger on
|
rt300@0
|
634 prevTouch0.setCoord(touch.x,touch.y);
|
rt300@0
|
635
|
rt300@0
|
636 }else if(touch.id == 1){
|
rt300@0
|
637
|
rt300@0
|
638
|
rt300@0
|
639 prevTouch1.setCoord(0,0);
|
rt300@6
|
640
|
rt300@6
|
641 }
|
rt300@6
|
642 if(numActiveTouches == 0){
|
rt300@6
|
643 // check time since last move
|
rt300@6
|
644 // check time since last move - if
|
rt300@6
|
645 unsigned int moveTime = ofGetSystemTimeMicros();
|
rt300@6
|
646 if(moveTime - lastMoveTime > 100000){
|
rt300@6
|
647 moveVel = TwoVector(); // zero
|
rt300@6
|
648 }else{
|
rt300@6
|
649 moveVel = (move*0.3 + prevMove*0.34 + prevMove2*0.38); // use the time
|
rt300@6
|
650
|
rt300@6
|
651 }
|
rt300@6
|
652 lastMoveTime = moveTime;
|
rt300@0
|
653 }
|
rt300@0
|
654
|
rt300@0
|
655 }
|
rt300@0
|
656
|
rt300@0
|
657 //--------------------------------------------------------------
|
rt300@0
|
658 void testApp::touchDoubleTap(ofTouchEventArgs &touch){
|
rt300@0
|
659 // preset?
|
rt300@25
|
660
|
rt300@25
|
661 /* ballses everything for some reason
|
rt300@25
|
662 TwoVector centre = TwoVector(getWidth()*0.5,getHeight()*0.5);
|
rt300@25
|
663 // if near centre
|
rt300@25
|
664 if((touch.x < centre.x+10) && (touch.x > centre.x-10) && (touch.y < centre.y+10) && (touch.y > centre.y-10)){
|
rt300@25
|
665 numActiveTouches = 0; // dirty
|
rt300@25
|
666 presetManager.showNameDialog();
|
rt300@25
|
667
|
rt300@25
|
668 }
|
rt300@25
|
669 */
|
rt300@25
|
670
|
rt300@0
|
671 }
|
rt300@0
|
672
|
rt300@0
|
673 //--------------------------------------------------------------
|
rt300@0
|
674 void testApp::lostFocus(){
|
rt300@0
|
675
|
rt300@0
|
676 }
|
rt300@0
|
677
|
rt300@0
|
678 //--------------------------------------------------------------
|
rt300@0
|
679 void testApp::gotFocus(){
|
rt300@0
|
680
|
rt300@0
|
681 }
|
rt300@0
|
682
|
rt300@0
|
683 //--------------------------------------------------------------
|
rt300@0
|
684 void testApp::gotMemoryWarning(){
|
rt300@0
|
685
|
rt300@0
|
686 }
|
rt300@0
|
687
|
rt300@0
|
688 //--------------------------------------------------------------
|
rt300@0
|
689 void testApp::deviceOrientationChanged(int newOrientation){
|
rt300@16
|
690 /*
|
rt300@0
|
691 cout << "orientation: " << newOrientation;
|
rt300@15
|
692
|
rt300@0
|
693 if(newOrientation == 4){
|
rt300@16
|
694 ofxiPhoneSetOrientation( OF_ORIENTATION_DEFAULT );
|
rt300@16
|
695
|
rt300@0
|
696 }else if(newOrientation == 3){
|
rt300@0
|
697 ofxiPhoneSetOrientation( OF_ORIENTATION_90_LEFT );
|
rt300@16
|
698 }else if(newOrientation == 3){
|
rt300@16
|
699 ofxiPhoneSetOrientation( OF_ORIENTATION_90_LEFT );
|
rt300@16
|
700 }
|
rt300@16
|
701
|
rt300@16
|
702
|
rt300@16
|
703 [ofxiPhoneGetGLView() updateDimensions];
|
rt300@16
|
704 */
|
rt300@0
|
705 }
|
rt300@0
|
706
|
rt300@0
|
707
|
rt300@0
|
708 //--------------------------------------------------------------
|
rt300@0
|
709 void testApp::touchCancelled(ofTouchEventArgs& args){
|
rt300@0
|
710
|
rt300@0
|
711 }
|
rt300@3
|
712 //---------------------------------------------------------------
|
rt300@3
|
713 // AUDIO STUFF
|
rt300@3
|
714 //---------------------------------------------------------------
|
rt300@3
|
715
|
rt300@3
|
716 #pragma mark AUDIO STREAMS
|
rt300@3
|
717 //--------------------------------------------------------------
|
rt300@3
|
718 void testApp::audioReceived(float * input, int bufferSize, int nChannels) {
|
rt300@3
|
719 core.audioReceived(input, bufferSize, nChannels);
|
rt300@3
|
720 }
|
rt300@3
|
721
|
rt300@3
|
722 void testApp::audioRequested(float * output, int bufferSize, int nChannels) {
|
rt300@3
|
723 core.audioRequested(output, bufferSize, nChannels);
|
rt300@3
|
724 }
|
rt300@3
|
725 //---------------------------------------------------------------
|
rt300@3
|
726 #pragma mark UTILITIES
|
rt300@0
|
727
|
rt300@0
|
728 // 5hz cut off
|
rt300@0
|
729 const double fB[3] = {0.049489956268677, 0.098979912537354, 0.049489956268677};
|
rt300@0
|
730
|
rt300@0
|
731 const double fA[3] = {1.000000000000000, -1.279632424997809, 0.477592250072517};
|
rt300@0
|
732
|
rt300@0
|
733 // 1hz cut off
|
rt300@0
|
734 //const double fB[3] = {0.002550535158536, 0.005101070317073, 0.002550535158536};
|
rt300@0
|
735
|
rt300@0
|
736 //const double fA[3] = {1.000000000000000, -1.852146485395936, 0.862348626030081};
|
rt300@0
|
737
|
rt300@0
|
738
|
rt300@0
|
739 //a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)- a(2)*y(n-1) - ... - a(na+1)*y(n-na)
|
rt300@0
|
740 //---------------------------------------------------------------
|
rt300@0
|
741 vector<float> testApp::vectorFilter(vector<float> newVec){
|
rt300@0
|
742 static vector<float> x0(10,0);
|
rt300@0
|
743 static vector<float> x1(10,0);
|
rt300@0
|
744 static vector<float> x2(10,0);
|
rt300@0
|
745 static vector<float> y0(10,0);
|
rt300@0
|
746 static vector<float> y1(10,0);
|
rt300@0
|
747 static vector<float> y2(10,0);
|
rt300@0
|
748
|
rt300@0
|
749 x0 = newVec;
|
rt300@0
|
750
|
rt300@0
|
751 // this low passes a bunch of params values all at once
|
rt300@0
|
752 int sz = newVec.size();
|
rt300@0
|
753 for(int i=0; i<sz; i++){
|
rt300@0
|
754 y0[i] = fB[0]*x0[i] + fB[1]*x1[i] + fB[2]*x2[i] - fA[1]*y1[i] - fA[2]*y2[i];
|
rt300@0
|
755 }
|
rt300@0
|
756 // shift
|
rt300@0
|
757 x2 = x1;
|
rt300@0
|
758 x1 = x0;
|
rt300@0
|
759 y2 = y1;
|
rt300@0
|
760 y1 = y0;
|
rt300@0
|
761
|
rt300@0
|
762 return y0;
|
rt300@2
|
763 }
|
rt300@24
|
764 float ctrlSmoother(float newsamp){
|
rt300@24
|
765 static float x1,x2,y1,y2;
|
rt300@24
|
766 float x0, y0;
|
rt300@24
|
767
|
rt300@24
|
768 x0 = newsamp;
|
rt300@24
|
769
|
rt300@24
|
770 y0 = fB[0]*x0 + fB[1]*x1 + fB[2]*x2 - fA[1]*y1 - fA[2]*y2;
|
rt300@24
|
771
|
rt300@24
|
772 // shift
|
rt300@24
|
773 x2 = x1;
|
rt300@24
|
774 x1 = x0;
|
rt300@24
|
775 y2 = y1;
|
rt300@24
|
776 y1 = y0;
|
rt300@24
|
777
|
rt300@24
|
778 return y0;
|
rt300@24
|
779 }
|
rt300@8
|
780 //---------------------------------------------------------------
|
rt300@3
|
781 void testApp::sendOscShape(int ctrlin){
|
rt300@3
|
782
|
rt300@3
|
783 static int numpoints = 5;
|
rt300@3
|
784 static int numcontrols = 5;
|
rt300@3
|
785 //float values[points][controls] =
|
rt300@3
|
786 float ctrlout[numcontrols];
|
rt300@3
|
787 string ctrlName[5] = {"pWidth" , "sqVol", "sawVol", "sineVol", "FMAmt"};
|
rt300@3
|
788 float values[5][5] =
|
rt300@3
|
789 {{0.5, 0., 0., 1., 1.}, // 0
|
rt300@3
|
790 {0.5, 0., 0., 1., 0.}, // 32
|
rt300@3
|
791 {0.5, 0., 1., 0., 0.}, // 64
|
rt300@3
|
792 {0.5, 1., 1., 0., 0.}, // 96
|
rt300@3
|
793 {0.01,1., 1., 0., 0.}}; // 127
|
rt300@3
|
794
|
rt300@3
|
795 float fidx = (numpoints-1)*ctrlin/128.;
|
rt300@3
|
796 int idx = floor(fidx);
|
rt300@3
|
797 float frac = fidx - idx;
|
rt300@3
|
798 for(int i=0; i < numcontrols; i++){
|
rt300@3
|
799 ctrlout[i] = (1 - frac)*values[idx][i] + (frac)*values[idx+1][i];
|
rt300@3
|
800 // send to PD
|
rt300@3
|
801 List toPD;
|
rt300@3
|
802
|
rt300@3
|
803 toPD.addSymbol(ctrlName[i]);
|
rt300@3
|
804 toPD.addFloat(ctrlout[i]); // rounding here??
|
rt300@3
|
805
|
rt300@3
|
806 core.pd.sendList("fromOF", toPD);
|
rt300@3
|
807 //cout << ctrlName[i] << "sending" << ctrlout[i] << "\n";
|
rt300@3
|
808 }
|
rt300@3
|
809
|
rt300@2
|
810 }
|
rt300@8
|
811 //---------------------------------------------------------------
|
rt300@3
|
812 void testApp::sendFiltType(int ctrlin){
|
rt300@3
|
813 static int numpoints = 3;
|
rt300@3
|
814 static int numcontrols = 4;
|
rt300@3
|
815 //float values[points][controls] =
|
rt300@3
|
816 float ctrlout[numcontrols];
|
rt300@3
|
817 string ctrlName[4] = {"lpLev" , "bpLev", "hpLev", "reson"};
|
rt300@3
|
818 float values[3][4] =
|
rt300@24
|
819 {{2., 0., 0., 1.}, // 0
|
rt300@24
|
820 {0., 10., 0., 10.}, // 64
|
rt300@24
|
821 {0., 0., 1., 1.}}; // 127
|
rt300@3
|
822
|
rt300@3
|
823 float fidx = (numpoints-1)*ctrlin/128.;
|
rt300@3
|
824 int idx = floor(fidx);
|
rt300@3
|
825 float frac = fidx - idx;
|
rt300@3
|
826 for(int i=0; i < numcontrols; i++){
|
rt300@3
|
827 ctrlout[i] = (1 - frac)*values[idx][i] + (frac)*values[idx+1][i];
|
rt300@3
|
828 // send to PD
|
rt300@3
|
829 List toPD;
|
rt300@3
|
830
|
rt300@3
|
831 toPD.addSymbol(ctrlName[i]);
|
rt300@3
|
832 toPD.addFloat(ctrlout[i]); // rounding here??
|
rt300@3
|
833
|
rt300@3
|
834 core.pd.sendList("fromOF", toPD);
|
rt300@3
|
835 //cout << ctrlName[i] << "sending" << ctrlout[i] << "\n";
|
rt300@3
|
836 }
|
rt300@2
|
837 }
|
rt300@8
|
838 //---------------------------------------------------------------
|
rt300@3
|
839 void testApp::sendFiltFreq(int ctrlin){
|
rt300@24
|
840 // smooth this
|
rt300@24
|
841 float fin = ctrlin;
|
rt300@24
|
842 float fout;
|
rt300@24
|
843 fout = (int)ctrlSmoother(fin);
|
rt300@3
|
844 List toPD;
|
rt300@3
|
845
|
rt300@3
|
846 toPD.addSymbol("filtFreq");
|
rt300@24
|
847 toPD.addFloat(fout);
|
rt300@3
|
848
|
rt300@3
|
849 core.pd.sendList("fromOF", toPD);
|
rt300@3
|
850 }
|
rt300@8
|
851 //---------------------------------------------------------------
|
rt300@3
|
852 void testApp::sendEnvShape(int ctrlin){
|
rt300@3
|
853 static int numpoints = 5;
|
rt300@3
|
854 static int numcontrols = 3;
|
rt300@3
|
855 //float values[points][controls] =
|
rt300@3
|
856 float ctrlout[numcontrols];
|
rt300@3
|
857 string ctrlName[3] = {"attack" , "decay", "sustain"};
|
rt300@3
|
858 float values[5][3] =
|
rt300@3
|
859 {{0., 0., 0.}, // 0
|
rt300@3
|
860 {0., 0.5, 0.}, // 32
|
rt300@3
|
861 {0.0, 1., 0.8}, // 64
|
rt300@3
|
862 {0.99, 0.3, 0.}, // 96
|
rt300@3
|
863 {0.3, 0.1, 0.}}; // 127
|
rt300@3
|
864
|
rt300@3
|
865 float fidx = (numpoints-1)*ctrlin/128.;
|
rt300@3
|
866 int idx = floor(fidx);
|
rt300@3
|
867 float frac = fidx - idx;
|
rt300@3
|
868 for(int i=0; i < numcontrols; i++){
|
rt300@3
|
869 ctrlout[i] = (1 - frac)*values[idx][i] + (frac)*values[idx+1][i];
|
rt300@3
|
870 // send to PD
|
rt300@3
|
871 List toPD;
|
rt300@3
|
872
|
rt300@3
|
873 toPD.addSymbol(ctrlName[i]);
|
rt300@3
|
874 toPD.addFloat(ctrlout[i]); // rounding here??
|
rt300@3
|
875
|
rt300@3
|
876 core.pd.sendList("fromOF", toPD);
|
rt300@3
|
877 //cout << ctrlName[i] << "sending" << ctrlout[i] << "\n";
|
rt300@3
|
878 }
|
rt300@3
|
879 }
|
rt300@8
|
880 //---------------------------------------------------------------
|
rt300@3
|
881 void testApp::sendModFreq(int ctrlin){
|
rt300@3
|
882 float fm = ctrlin/127.;
|
rt300@3
|
883 List toPD;
|
rt300@3
|
884
|
rt300@3
|
885 toPD.addSymbol("FMFreq");
|
rt300@3
|
886 toPD.addFloat(fm); // rounding here??
|
rt300@3
|
887
|
rt300@3
|
888 core.pd.sendList("fromOF", toPD);
|
rt300@8
|
889 }
|
rt300@8
|
890 //--------------------------------------------------------------- |