annotate testApp.h @ 46:1e266647840d

beta 2. interpolation movement , smoothing (crap) and timbre only.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 24 Apr 2013 17:58:08 +0100
parents c2fffc8ea84d
children 0d3a993405e4
rev   line source
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@46 47 bool animatingGrid;
rt300@46 48 bool allowAnimation;
rt300@24 49 interfaceType whichInterfaceShowing;
rt300@46 50 interfaceType previousInterface;
rt300@24 51 BottomTabViewController *bottomTabViewController;
rt300@25 52 UsernameAlertViewController *usernameAlertViewController;
rt300@26 53 HelpViewController *helpViewController;
rt300@27 54 QuestionnaireViewController * questionnaireViewController;
rt300@27 55 IntroViewController * introViewController;
rt300@27 56 TopButtonViewController * topButtonViewController;
rt300@27 57 SliderViewController * sliderViewController;
rt300@29 58 TimedSessionController * tsc;
rt300@0 59 int prevTouchX;
rt300@0 60 int prevTouchY;
rt300@0 61 double prevDist;
rt300@16 62 bool paused;
rt300@0 63 // not many so dont bother with vectors/arrays?
rt300@0 64 TwoVector touch0;
rt300@0 65 TwoVector touch1;
rt300@0 66 TwoVector prevTouch0;
rt300@0 67 TwoVector prevTouch1;
rt300@5 68
rt300@0 69 bool xLocked, yLocked;
rt300@6 70 unsigned int lastMoveTime;
rt300@0 71
rt300@0 72 TwoVector moveVel; // velocity at which we were moving the grid
rt300@0 73
rt300@0 74 vector <ofxUISlider *> sliders;
rt300@0 75
rt300@0 76 double slowFactor;
rt300@0 77 double zoomVel; // do the same
rt300@0 78 double prevZoom, prevZoom2;
rt300@5 79 TwoVector move, prevMove, prevMove2;
rt300@0 80
rt300@0 81 vector<int> sliderVals;
rt300@3 82 vector<int> freqIndexes;
rt300@36 83 vector<vector <int> > sequences;
rt300@36 84 int currentSequence;
rt300@0 85
rt300@0 86 int numActiveTouches;
rt300@27 87 bool preventingMovePostScroll;
rt300@38 88 void setInterp(int state);
rt300@27 89
rt300@0 90 //
rt300@0 91
rt300@16 92 void setup();
rt300@16 93 void update();
rt300@16 94 void draw();
rt300@16 95 void exit();
rt300@16 96
rt300@42 97 void initialiseVariables();
rt300@42 98 void initialiseGUIs();
rt300@42 99 void initialiseMIDI();
rt300@42 100
rt300@16 101 float getWidth();
rt300@16 102 float getHeight();
rt300@16 103
rt300@16 104 void touchDown(ofTouchEventArgs &touch);
rt300@16 105 void touchMoved(ofTouchEventArgs &touch);
rt300@16 106 void touchUp(ofTouchEventArgs &touch);
rt300@16 107 void touchDoubleTap(ofTouchEventArgs &touch);
rt300@16 108 void touchCancelled(ofTouchEventArgs &touch);
rt300@0 109
rt300@1 110 void handleScroll();
rt300@1 111 void handleZoom();
rt300@1 112
rt300@0 113 vector<float> vectorFilter(vector<float> newVec);
rt300@16 114
rt300@16 115 void lostFocus();
rt300@16 116 void gotFocus();
rt300@16 117 void gotMemoryWarning();
rt300@16 118 void deviceOrientationChanged(int newOrientation);
rt300@16 119
rt300@44 120 bool tapFlag;
rt300@16 121 ofxOscSender sender;
rt300@0 122 void sendOSCParams();
rt300@0 123
rt300@27 124 void setupNewUser();
rt300@27 125
rt300@24 126 void lockSynthPressed(bool locked);
rt300@24 127 void lockSequencerPressed(bool locked);
rt300@24 128
rt300@16 129 void showQuestionnaire();
rt300@28 130 void questionnaireHidden(vector<int> answers, const char* userComments);
rt300@24 131 void showIntro();
rt300@24 132 void introHidden(bool OK);
rt300@24 133 void interfaceSelected(int which);
rt300@39 134 void freeUseMode();
rt300@39 135
rt300@24 136 void seqStartStop(bool go);
rt300@27 137 void showHelp();
rt300@27 138 void helpHidden();
rt300@42 139 void startTimedSession();
rt300@33 140 // shortcut function for testing
rt300@33 141 void justStart();
rt300@36 142 void loadSequences();
rt300@46 143 int nextSequence();
rt300@24 144
rt300@24 145 void setupBottomGui();
rt300@24 146 void bottomGuiEvent();
rt300@24 147 void setupTopGui();
rt300@24 148 void topGuiEvent();
rt300@16 149
rt300@0 150 // stardard GUI - knbs and sliders - hides zoomer
rt300@24 151 void sliderGUIEvent(ofxUIEventArgs &e);
rt300@24 152 void setupSliderGui();
rt300@24 153 ofxUICanvas *sliderGUI;
rt300@24 154
rt300@22 155 void sliderMoved(int which, float value);
rt300@22 156 void setAllGUISliders(vector<int> vals);
rt300@25 157 void randomise();
rt300@0 158
rt300@0 159 // zoom gui - the swap view button and save preset button
rt300@0 160 void zoomGUIEvent(ofxUIEventArgs &e);
rt300@0 161 void setupZoomGui();
rt300@0 162
rt300@22 163
rt300@3 164 void sendParametersToPD();
rt300@3 165 void sendOscShape(int ctrlin);
rt300@3 166 void sendFiltShape(int ctrlin);
rt300@3 167 void sendFiltType(int ctrlin);
rt300@3 168 void sendFiltFreq(int ctrlin);
rt300@3 169 void sendEnvShape(int ctrlin);
rt300@45 170 void sendResonance(int ctrlin);
rt300@43 171 void sendAmpEnvShape(int ctrlin);
rt300@43 172 void sendFiltEnvShape(int ctrlin);
rt300@3 173 void sendModFreq(int ctrlin);
rt300@45 174 void sendFMAmt(int ctrlin);
rt300@45 175 void sendDistortion(int ctrlin);
rt300@45 176 void sendRevAmt(int ctrlin);
rt300@45 177 void sendFiltEnvModAmt(int ctrlin);
rt300@45 178
rt300@39 179 void sendMidiParams();
rt300@39 180 void sendMidiParam(int which);
rt300@0 181 ofxUICanvas *zoomGUI;
rt300@0 182
rt300@2 183 // audio callbacks
rt300@2 184 void audioReceived(float * input, int bufferSize, int nChannels);
rt300@2 185 void audioRequested(float * output, int bufferSize, int nChannels);
rt300@2 186
rt300@2 187 AppCore core;
rt300@2 188
rt300@39 189 // message
rt300@39 190 void addMessage(string msg);
rt300@39 191
rt300@39 192 // midi message callback
rt300@39 193 void newMidiMessage(ofxMidiMessage& msg);
rt300@39 194
rt300@39 195 // midi device (dis)connection event callbacks
rt300@39 196 void midiInputAdded(string name, bool isNetwork);
rt300@39 197 void midiInputRemoved(string name, bool isNetwork);
rt300@39 198
rt300@39 199 void midiOutputAdded(string nam, bool isNetwork);
rt300@39 200 void midiOutputRemoved(string name, bool isNetwork);
rt300@39 201
rt300@39 202 vector<ofxMidiIn*> inputs;
rt300@39 203 vector<ofxMidiOut*> outputs;
rt300@39 204
rt300@39 205 deque<string> messages;
rt300@39 206 int maxMessages;
rt300@39 207
rt300@39 208 int note, ctl;
rt300@39 209 vector<unsigned char> bytes;
rt300@39 210
rt300@45 211 void sendFiltTypeOld(int ctrlin);
rt300@45 212
rt300@0 213 };
rt300@0 214
rt300@22 215 // should be off split into
rt300@22 216 // GUI controller
rt300@22 217 // parameter converter
rt300@22 218 //