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