view src/melodyTriangle.h @ 12:317637282293

Compressed keyboard handling code, added calibration key 'c'.
author samer
date Mon, 30 Jan 2012 00:00:15 +0000
parents 3d9e0db254dc
children 9e31c0507e65
line wrap: on
line source


#include "ofMain.h"
#include "Voice.h"

#include "ofxOsc.h"





class melodyTriangle : public ofBaseApp{
	
	public:
		melodyTriangle(const char *host, int port, int numVoices, bool enableKeys, int voiceIdOffset, int receivePort);
		
		void setup();
		void update();
		void draw();
		
		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 windowResized(int w, int h);
		int numVoices;
		int voiceIdOffset;	
		bool enableKeys;
		float 	counter;
		bool	bSmooth;
		//Voice *voices[NUMVOICES];
		Voice *voices[10];
	
		int x1,y1,x2,y2,x3,y3;//Triangle Coords
		int triangleHeight;
		int voiceGrabbed;
	    void sendStatus(Voice v);
		void sendCalibrate();
		void sendPeriod(int id, int num, int den);
		void sendShift(int id, int num, int den);
		void sendOctave(int id, int oct);
	    bool isInTriangle(int x, int y);
		
	
	private:
		ofxOscSender sender;
		ofxOscReceiver	receiver;
};