annotate testApp.h @ 0:a223551fdc1f

First commit - copy from tweakathlon.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 10 Oct 2014 11:46:42 +0100
parents
children 851833072cf1
rev   line source
rt300@0 1 #pragma once
rt300@0 2
rt300@0 3 #include "ofMain.h"
rt300@0 4
rt300@0 5 //#include "ofxiPhone.h"
rt300@0 6 //#include "ofxiPhoneExtras.h"
rt300@0 7 // #include "ofxiPhoneExternalDisplay.h"
rt300@0 8
rt300@0 9 #include "ofxiOS.h"
rt300@0 10 #include "ofxiOSExtras.h"
rt300@0 11
rt300@0 12 #include "ofxOsc.h"
rt300@0 13 #include "ofxMidi.h"
rt300@0 14 #include "2dvector.h"
rt300@0 15 #include "AppCore.h"
rt300@0 16 #include "eventLogger.h"
rt300@0 17 #include "ofxPd.h"
rt300@0 18 #include "json.h"
rt300@0 19 #import "QuestionnaireViewController.h"
rt300@0 20 #import "HelpViewController.h"
rt300@0 21 #import "UsernameAlertViewController.h"
rt300@0 22 #import "IntroViewController.h"
rt300@0 23 #include "sliderPanel.h"
rt300@0 24 #include "UIElement.h"
rt300@0 25 #include "UIElementContainer.h"
rt300@0 26 #include "buttron.h"
rt300@0 27 #include "ButtronSlider.h"
rt300@0 28 #include "buttronXY.h"
rt300@0 29 #include "UIGrid.h"
rt300@0 30 #include "MessageOrganiser.h"
rt300@0 31 #include "TestController.h"
rt300@0 32 #include "timeController.h"
rt300@0 33 #include <buttonPanel.h>
rt300@0 34 #include "targetSymbol.h"
rt300@0 35 #include "3Dbox.h"
rt300@0 36 #include "TextPanel.h"
rt300@0 37 //#define OSC_HOST "169.254.1.1"
rt300@0 38 //#define OSC_PORT 12345
rt300@0 39
rt300@0 40 #define SLIDER_GUI_WIDTH 256
rt300@0 41 #define SLIDER_HEIGHT 256
rt300@0 42 #define NUM_PARAMS 10
rt300@0 43
rt300@0 44
rt300@0 45
rt300@0 46 class testApp : public ofxiOSApp , public ofxMidiListener, public ofxMidiConnectionListener {
rt300@0 47
rt300@0 48
rt300@0 49 public:
rt300@0 50 ofTrueTypeFont verdBig;
rt300@0 51 bool sendMIDIAndOSC;
rt300@0 52 bool paused;
rt300@0 53
rt300@0 54 int midiChannel;
rt300@0 55 int midiOffset;
rt300@0 56 double tx,ty;
rt300@0 57 ofColor generalBackground;
rt300@0 58 //
rt300@0 59 void initialiseGUIs();
rt300@0 60 void initialiseVariables();
rt300@0 61 void initialiseMIDI();
rt300@0 62 void setupUIElements();
rt300@0 63
rt300@0 64 void setup();
rt300@0 65 void update();
rt300@0 66 void draw();
rt300@0 67 void drawUIElements();
rt300@0 68 void exit();
rt300@0 69
rt300@0 70 HelpViewController *helpViewController;
rt300@0 71 QuestionnaireViewController *questionnaireViewController;
rt300@0 72 UsernameAlertViewController *usernameAlertViewController;
rt300@0 73 IntroViewController * introViewController;
rt300@0 74
rt300@0 75 MessageOrganiser messageOrganiser;
rt300@0 76 TestController* testController;
rt300@0 77 //TimeController timeController;
rt300@0 78 interfaceType whichInterfaceShowing, previousInterface;
rt300@0 79
rt300@0 80 // pannels buttrons and slidertrons
rt300@0 81 vector<UIElement *> UIElements;
rt300@0 82
rt300@0 83 void touchToUIElements(int x, int y, touchType ttype, int tid);
rt300@0 84 void touchDown(ofTouchEventArgs &touch);
rt300@0 85 void touchMoved(ofTouchEventArgs &touch);
rt300@0 86 void touchUp(ofTouchEventArgs &touch);
rt300@0 87 void touchDoubleTap(ofTouchEventArgs &touch);
rt300@0 88 void touchCancelled(ofTouchEventArgs &touch);
rt300@0 89 double ofFixGetWidth();
rt300@0 90 double ofFixGetHeight();
rt300@0 91 ofTouchEventArgs transformTouchCoords(ofTouchEventArgs &point);
rt300@0 92 ofLight light;
rt300@0 93
rt300@0 94 void lostFocus();
rt300@0 95 void gotFocus();
rt300@0 96 void gotMemoryWarning();
rt300@0 97 void deviceOrientationChanged(int newOrientation);
rt300@0 98
rt300@0 99 // ofxOscSender sender;
rt300@0 100 // void sendOSCParams();
rt300@0 101
rt300@0 102 void showQuestionnaire();
rt300@0 103 void questionnaireHidden(vector<int> answers, const char* userComments);
rt300@0 104
rt300@0 105 void showIntro();
rt300@0 106 void introHidden();
rt300@0 107 void startTheTests();
rt300@0 108 void showHelp();
rt300@0 109 void helpHidden();
rt300@0 110 void setupNewUser();
rt300@0 111 void appModeChange(interfaceType mode);
rt300@0 112
rt300@0 113 void sendParametersToPD();
rt300@0 114
rt300@0 115 void sendMidiParams();
rt300@0 116 void sendMidiParam(int which);
rt300@0 117
rt300@0 118 // audio callbacks
rt300@0 119 float * wavetableNew;
rt300@0 120 int bufSize;
rt300@0 121 void drawWaveform();
rt300@0 122 void drawScore();
rt300@0 123 void audioReceived(float * input, int bufferSize, int nChannels);
rt300@0 124 void audioRequested(float * output, int bufferSize, int nChannels);
rt300@0 125
rt300@0 126 AppCore core;
rt300@0 127
rt300@0 128 // message
rt300@0 129 void addMessage(string msg);
rt300@0 130
rt300@0 131 // midi message callback
rt300@0 132 void newMidiMessage(ofxMidiMessage& msg);
rt300@0 133
rt300@0 134 // midi device (dis)connection event callbacks
rt300@0 135 void midiInputAdded(string name, bool isNetwork);
rt300@0 136 void midiInputRemoved(string name, bool isNetwork);
rt300@0 137
rt300@0 138 void midiOutputAdded(string nam, bool isNetwork);
rt300@0 139 void midiOutputRemoved(string name, bool isNetwork);
rt300@0 140
rt300@0 141 vector<ofxMidiIn*> inputs;
rt300@0 142 vector<ofxMidiOut*> outputs;
rt300@0 143
rt300@0 144 deque<string> messages;
rt300@0 145 int maxMessages;
rt300@0 146
rt300@0 147 int note, ctl;
rt300@0 148 vector<unsigned char> bytes;
rt300@0 149
rt300@0 150 // in the h file:
rt300@0 151 ofTrueTypeFont myfont;
rt300@0 152
rt300@0 153 void windowResized(int w, int h){};
rt300@0 154
rt300@0 155 void rotateToPortrait(){};
rt300@0 156 void rotateToPortraitUpSideDown(){};
rt300@0 157 void rotateToLandscapeLeft(){};
rt300@0 158 void rotateToLandscapeRight(){};
rt300@0 159 void toggleAutoRotation(){};
rt300@0 160
rt300@0 161 };
rt300@0 162
rt300@0 163 // should be off split into
rt300@0 164 // GUI controller
rt300@0 165 // parameter converter
rt300@0 166 // MIDI stuff(?)
rt300@0 167
rt300@0 168