view testApp.h @ 8:e2c6cfe8c6b7

JSON logs and presets.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Thu, 10 Jan 2013 18:24:26 +0000
parents 34eba1046890
children fb2ef16dd013
line wrap: on
line source
#pragma once

#include "ofMain.h"
#include "ofxiPhone.h"
#include "ofxiPhoneExtras.h"
#include "ofxOsc.h"
#include "grid.h"
#include "2dvector.h"
#include "ofxUI.h"
#include "eventLogger.h"
#include "AppCore.h"

#include "presetManager.h"
#include "eventLogger.h"
#include "ofxPd.h"
#include "frequencer.h"

#include "json.h"

#import "iViewController.h"

#define HOST "169.254.1.1"
#define PORT 12345

class testApp : public ofxiPhoneApp {

	
public:
    

    int prevTouchX;
    int prevTouchY;
    double prevDist;
    
    // not many so dont bother with vectors/arrays?
    TwoVector touch0;
    TwoVector touch1;
    TwoVector prevTouch0;
    TwoVector prevTouch1;

    bool xLocked, yLocked;
    unsigned int lastMoveTime;
    
    TwoVector moveVel; // velocity at which we were moving the grid
    
    vector <ofxUISlider *> sliders;
    
    double slowFactor;
    double zoomVel; // do the same
     double prevZoom, prevZoom2;
     TwoVector move, prevMove, prevMove2;
    
    vector<int> sliderVals;
    vector<int> freqIndexes;
    
    int numActiveTouches;
    
    ofxiPhoneKeyboard * keyboard;
    //
    
		void setup();
		void update();
		void draw();
		void exit();
		
		void touchDown(ofTouchEventArgs &touch);
		void touchMoved(ofTouchEventArgs &touch);
		void touchUp(ofTouchEventArgs &touch);
		void touchDoubleTap(ofTouchEventArgs &touch);
		void touchCancelled(ofTouchEventArgs &touch);
    
    void handleScroll();
    void handleZoom();
    
    vector<float> vectorFilter(vector<float> newVec);

		void lostFocus();
		void gotFocus();
		void gotMemoryWarning();
		void deviceOrientationChanged(int newOrientation);
        
		ofxOscSender sender;
    void sendOSCParams();
    
    // stardard GUI - knbs and sliders - hides zoomer
    bool standardGUIShowing;
    void standardGUIEvent(ofxUIEventArgs &e);
    void setupStandardGui();
    ofxUICanvas *standardGUI;
    
    // zoom gui - the swap view button and save preset button
    void zoomGUIEvent(ofxUIEventArgs &e);
    void setupZoomGui();
    
    void sliderMoved(int which, float value);
    void setAllGUISliders(vector<int> vals);
    void sendParametersToPD();
    void sendOscShape(int ctrlin);
    void sendFiltShape(int ctrlin);
    void sendFiltType(int ctrlin);
    void sendFiltFreq(int ctrlin);
    void sendEnvShape(int ctrlin);
    void sendModFreq(int ctrlin);
    
    ofxUICanvas *zoomGUI;
    
    // audio callbacks
	void audioReceived(float * input, int bufferSize, int nChannels);
	void audioRequested(float * output, int bufferSize, int nChannels);
    
    AppCore core;
    
};