view testApp.h @ 0:c667dfe12d47

OK. Ther real deal.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Mon, 19 Nov 2012 13:00:42 +0000
parents
children 1d1bf0aac99e
line wrap: on
line source
// oF 072

#ifndef _TEST_APP
#define _TEST_APP

#include "ofMain.h"
#include "ofxiPhone.h"
#include "ofxiPhoneExtras.h"

#include "2dvector.h"
#include "lump.h"
#include "spring.h"
#include <iostream>
#include "mesh.h"
#include "dsptools.h"

#include "ofxUI.h"
#include "ofxOsc.h"
#include "globalForces.h"
#include "globalUI.h"

#define SAMPLE_RATE 44100
// listen on port 12345
#define INPORT 12345
#define OUTPORT 54321
#define HOST "192.168.1.3"
#define NUM_MSG_STRINGS 20

// defining this compiles it for ios otherwise osx
#define IPAD



class testApp : public ofxiPhoneApp {
	
public:
    int timesOpened;
	bool audioOn;
	bool drawingOn;
	
	bool paused;
    //bool inscribeScanPathMode;
	bool meshWaitingToDelete;
	Mesh *theMesh;
    
    DSPTools mydspTools;
	
	double timeStep;
    
    double pitch;
    double phasorIncr;
    


    int numTouches;

	void setup();
	void update();
	void draw();
    void exit();
    
    void loadLogXML();
    void saveLogXML();

	void touchDown(ofTouchEventArgs &touch);
	void touchMoved(ofTouchEventArgs &touch);
	void touchUp(ofTouchEventArgs &touch);
	void touchDoubleTap(ofTouchEventArgs &touch);
    void addTouch();
    void removeTouch();
    
    void UIcallBack(int buttID);

   
	void keyPressed  (int key);
	void keyReleased(int key);
	void mouseMoved(int x, int y );
	void mouseDragged(int x, int y, int button);
	void mousePressed(int x, int y, int button);
	void mouseReleased(int x, int y, int button);

    void restartAudioStream();
	void audioRequested 	(float * input, int bufferSize, int nChannels);
    void audioReceived(float * input, int bufferSize, int nChannels);
    
    void handleMessages();
    void drawMessages();
    
    void setupMesh();
    void regenerateMesh(string meshType, int dim1 = 3, int dim2 = 3);
    void deleteMesh();

    ofxOscReceiver	receiver;
    ofxOscSender sender;
    ofTrueTypeFont		font;
  
    int				current_msg_string;
    string		msg_strings[NUM_MSG_STRINGS];
    float			timers[NUM_MSG_STRINGS];
    
    int				mouseX, mouseY;
    string			mouseButtonState;
    
    ofxiPhoneKeyboard * keyboard;
    
    // ofxUI stuff
    
    ofxUICanvas *guiL;
    ofxUICanvas *guiR;
    void guiLEvent(ofxUIEventArgs &e);
    void guiREvent(ofxUIEventArgs &e);
    void setupGui();
    void drawSidePanels();
    
    ofxUILabel *counter;
     
};	



#endif