diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testApp.h	Fri Oct 10 11:46:42 2014 +0100
@@ -0,0 +1,168 @@
+#pragma once
+
+#include "ofMain.h"
+
+//#include "ofxiPhone.h"
+//#include "ofxiPhoneExtras.h"
+// #include "ofxiPhoneExternalDisplay.h"
+
+#include "ofxiOS.h"
+#include "ofxiOSExtras.h"
+
+#include "ofxOsc.h"
+#include "ofxMidi.h"
+#include "2dvector.h"
+#include "AppCore.h"
+#include "eventLogger.h"
+#include "ofxPd.h"
+#include "json.h"
+#import "QuestionnaireViewController.h"
+#import "HelpViewController.h"
+#import "UsernameAlertViewController.h"
+#import "IntroViewController.h"
+#include "sliderPanel.h"
+#include "UIElement.h"
+#include "UIElementContainer.h"
+#include "buttron.h"
+#include "ButtronSlider.h"
+#include "buttronXY.h"
+#include "UIGrid.h"
+#include "MessageOrganiser.h"
+#include "TestController.h"
+#include "timeController.h"
+#include <buttonPanel.h>
+#include "targetSymbol.h"
+#include "3Dbox.h"
+#include "TextPanel.h"
+//#define OSC_HOST "169.254.1.1"
+//#define OSC_PORT 12345
+
+#define SLIDER_GUI_WIDTH 256
+#define SLIDER_HEIGHT 256
+#define NUM_PARAMS 10
+
+
+
+class testApp : public ofxiOSApp , public ofxMidiListener, public ofxMidiConnectionListener {
+
+	
+public:
+    ofTrueTypeFont verdBig;
+    bool sendMIDIAndOSC;
+    bool paused;
+    
+    int midiChannel;
+    int midiOffset;
+    double tx,ty;
+    ofColor generalBackground;
+    //
+    void initialiseGUIs();
+    void initialiseVariables();
+    void initialiseMIDI();
+    void setupUIElements();
+    
+    void setup();
+    void update();
+    void draw();
+    void drawUIElements();
+    void exit();
+
+    HelpViewController *helpViewController;
+    QuestionnaireViewController *questionnaireViewController;
+    UsernameAlertViewController *usernameAlertViewController;
+    IntroViewController * introViewController;
+    
+    MessageOrganiser messageOrganiser;
+    TestController* testController;
+    //TimeController timeController;
+    interfaceType whichInterfaceShowing, previousInterface;
+    
+    // pannels buttrons and slidertrons
+    vector<UIElement *> UIElements;
+    
+    void touchToUIElements(int x, int y, touchType ttype, int tid);
+    void touchDown(ofTouchEventArgs &touch);
+    void touchMoved(ofTouchEventArgs &touch);
+    void touchUp(ofTouchEventArgs &touch);
+    void touchDoubleTap(ofTouchEventArgs &touch);
+    void touchCancelled(ofTouchEventArgs &touch);
+    double ofFixGetWidth();
+    double ofFixGetHeight();
+    ofTouchEventArgs transformTouchCoords(ofTouchEventArgs &point);
+    ofLight light;
+        
+    void lostFocus();
+    void gotFocus();
+    void gotMemoryWarning();
+    void deviceOrientationChanged(int newOrientation);
+
+//    ofxOscSender sender;
+//    void sendOSCParams();
+
+    void showQuestionnaire();
+    void questionnaireHidden(vector<int> answers,  const char* userComments);
+
+    void showIntro();
+    void introHidden();
+    void startTheTests();
+    void showHelp();
+    void helpHidden();
+    void setupNewUser();
+    void appModeChange(interfaceType mode);
+
+    void sendParametersToPD();
+    
+    void sendMidiParams();
+    void sendMidiParam(int which);
+    
+    // audio callbacks
+    float *  wavetableNew;
+    int bufSize;
+    void drawWaveform();
+    void drawScore();
+	void audioReceived(float * input, int bufferSize, int nChannels);
+	void audioRequested(float * output, int bufferSize, int nChannels);
+    
+    AppCore core;
+    
+    // message
+    void addMessage(string msg);
+	
+	// midi message callback
+	void newMidiMessage(ofxMidiMessage& msg);
+	
+	// midi device (dis)connection event callbacks
+	void midiInputAdded(string name, bool isNetwork);
+	void midiInputRemoved(string name, bool isNetwork);
+	
+	void midiOutputAdded(string nam, bool isNetwork);
+	void midiOutputRemoved(string name, bool isNetwork);
+    
+	vector<ofxMidiIn*> inputs;
+	vector<ofxMidiOut*> outputs;
+    
+	deque<string> messages;
+	int maxMessages;
+	
+	int note, ctl;
+	vector<unsigned char> bytes;
+    
+    // in the h file:
+    ofTrueTypeFont myfont;
+
+    void windowResized(int w, int h){};
+    
+    void rotateToPortrait(){};
+    void rotateToPortraitUpSideDown(){};
+    void rotateToLandscapeLeft(){};
+    void rotateToLandscapeRight(){};
+    void toggleAutoRotation(){};
+    
+};
+
+// should be off split into
+// GUI controller
+// parameter converter
+// MIDI stuff(?)
+
+