view testApp.h @ 3:43df75088d85

fixed sticking scroll more file fiddling
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Mon, 03 Dec 2012 18:29:07 +0000
parents fcb512cef986
children 5ee5ef99e117
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"

#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;
    
    
    TwoVector moveVel; // velocity at which we were moving the grid
    
    vector <ofxUISlider *> sliders;
    
    double slowFactor;
    double zoomVel; // do the same
     double prevZoom, prevZoom2;
     TwoVector 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;
    
};