annotate testApp.h @ 7:4e00f92567d9

separated GUI setup stuff
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 17 Oct 2014 15:13:35 +0100
parents 92850a2b099c
children d59de9fd3496
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@7 50
rt300@0 51 ofTrueTypeFont verdBig;
rt300@0 52 bool sendMIDIAndOSC;
rt300@0 53 bool paused;
rt300@0 54
rt300@0 55 int midiChannel;
rt300@0 56 int midiOffset;
rt300@0 57 double tx,ty;
rt300@0 58 ofColor generalBackground;
rt300@0 59 //
rt300@0 60 void initialiseGUIs();
rt300@0 61 void initialiseVariables();
rt300@0 62 void initialiseMIDI();
rt300@0 63 void setupUIElements();
rt300@6 64 void setupExpressViewPanels();
rt300@6 65 void setupTrainingViewPanels();
rt300@6 66 void setupSearchViewPanels();
rt300@7 67 void setupSliderPanel();
rt300@0 68 void setup();
rt300@0 69 void update();
rt300@0 70 void draw();
rt300@0 71 void drawUIElements();
rt300@0 72 void exit();
rt300@0 73
rt300@0 74 HelpViewController *helpViewController;
rt300@0 75 QuestionnaireViewController *questionnaireViewController;
rt300@0 76 UsernameAlertViewController *usernameAlertViewController;
rt300@0 77 IntroViewController * introViewController;
rt300@0 78
rt300@0 79 MessageOrganiser messageOrganiser;
rt300@0 80 TestController* testController;
rt300@0 81 //TimeController timeController;
rt300@0 82 interfaceType whichInterfaceShowing, previousInterface;
rt300@0 83
rt300@7 84 // various views
rt300@0 85 vector<UIElement *> UIElements;
rt300@0 86
rt300@0 87 void touchToUIElements(int x, int y, touchType ttype, int tid);
rt300@0 88 void touchDown(ofTouchEventArgs &touch);
rt300@0 89 void touchMoved(ofTouchEventArgs &touch);
rt300@0 90 void touchUp(ofTouchEventArgs &touch);
rt300@0 91 void touchDoubleTap(ofTouchEventArgs &touch);
rt300@0 92 void touchCancelled(ofTouchEventArgs &touch);
rt300@0 93 double ofFixGetWidth();
rt300@0 94 double ofFixGetHeight();
rt300@0 95 ofTouchEventArgs transformTouchCoords(ofTouchEventArgs &point);
rt300@0 96 ofLight light;
rt300@0 97
rt300@0 98 void lostFocus();
rt300@0 99 void gotFocus();
rt300@0 100 void gotMemoryWarning();
rt300@0 101 void deviceOrientationChanged(int newOrientation);
rt300@0 102
rt300@0 103 // ofxOscSender sender;
rt300@0 104 // void sendOSCParams();
rt300@0 105
rt300@0 106 void showQuestionnaire();
rt300@0 107 void questionnaireHidden(vector<int> answers, const char* userComments);
rt300@0 108
rt300@0 109 void showIntro();
rt300@0 110 void introHidden();
rt300@2 111 void usernameEntered();
rt300@0 112 void startTheTests();
rt300@0 113 void showHelp();
rt300@0 114 void helpHidden();
rt300@0 115 void setupNewUser();
rt300@0 116 void appModeChange(interfaceType mode);
rt300@0 117
rt300@0 118 void sendParametersToPD();
rt300@0 119
rt300@0 120 void sendMidiParams();
rt300@0 121 void sendMidiParam(int which);
rt300@0 122
rt300@0 123 // audio callbacks
rt300@0 124 float * wavetableNew;
rt300@0 125 int bufSize;
rt300@0 126 void drawWaveform();
rt300@0 127 void drawScore();
rt300@0 128 void audioReceived(float * input, int bufferSize, int nChannels);
rt300@0 129 void audioRequested(float * output, int bufferSize, int nChannels);
rt300@0 130
rt300@0 131 AppCore core;
rt300@0 132
rt300@0 133 // message
rt300@0 134 void addMessage(string msg);
rt300@0 135
rt300@0 136 // midi message callback
rt300@0 137 void newMidiMessage(ofxMidiMessage& msg);
rt300@0 138
rt300@0 139 // midi device (dis)connection event callbacks
rt300@0 140 void midiInputAdded(string name, bool isNetwork);
rt300@0 141 void midiInputRemoved(string name, bool isNetwork);
rt300@0 142
rt300@0 143 void midiOutputAdded(string nam, bool isNetwork);
rt300@0 144 void midiOutputRemoved(string name, bool isNetwork);
rt300@0 145
rt300@0 146 vector<ofxMidiIn*> inputs;
rt300@0 147 vector<ofxMidiOut*> outputs;
rt300@0 148
rt300@0 149 deque<string> messages;
rt300@0 150 int maxMessages;
rt300@0 151
rt300@0 152 int note, ctl;
rt300@0 153 vector<unsigned char> bytes;
rt300@0 154
rt300@0 155 // in the h file:
rt300@0 156 ofTrueTypeFont myfont;
rt300@0 157
rt300@0 158 void windowResized(int w, int h){};
rt300@0 159
rt300@0 160 void rotateToPortrait(){};
rt300@0 161 void rotateToPortraitUpSideDown(){};
rt300@0 162 void rotateToLandscapeLeft(){};
rt300@0 163 void rotateToLandscapeRight(){};
rt300@0 164 void toggleAutoRotation(){};
rt300@0 165
rt300@0 166 };
rt300@0 167
rt300@0 168 // should be off split into
rt300@0 169 // GUI controller
rt300@0 170 // parameter converter
rt300@0 171 // MIDI stuff(?)
rt300@0 172
rt300@0 173