annotate testApp.h @ 6:92850a2b099c

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