diff src/melodyTriangle.h @ 30:9e8c19c90986

Added visual confirmation on keyboard enable/disable.
author samer
date Mon, 06 Feb 2012 11:50:03 +0000
parents f4ebb87adec1
children 417deb31dd4e
line wrap: on
line diff
--- a/src/melodyTriangle.h	Sun Feb 05 19:05:30 2012 +0000
+++ b/src/melodyTriangle.h	Mon Feb 06 11:50:03 2012 +0000
@@ -6,69 +6,72 @@
 
 class melodyTriangle : public ofBaseApp{
 	
+public:
+	~melodyTriangle();
+	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);
+
+private:
+	class bad_voice_id : public std::exception {
+		int	id;
 	public:
-		~melodyTriangle();
-		melodyTriangle(const char *host, int port, int numVoices, 
-					   bool enableKeys, int voiceIdOffset, int receivePort);
+		bad_voice_id(int id): id(id) {}
+		~bad_voice_id() throw() {}
+		const char *what() const throw();
+	};
 	
-		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);
+	// private methods
+	Voice *get_voice(int id) throw(bad_voice_id);
+	void  voiceKeypress(Voice *v, int key);
 
-	private:
-		class bad_voice_id : public std::exception {
-			int	id;
-		public:
-			bad_voice_id(int id): id(id) {}
-			~bad_voice_id() throw() {}
-			const char *what() const throw();
-		};
-		
-		// private methods
-		Voice *get_voice(int id) throw(bad_voice_id);
-		void  voiceKeypress(Voice *v, int key);
+	void sendReplyTo();
+	void sendCalibrate();
+	void sendPosition(Voice *v);
+	void sendPeriod(int id, int num, int den);
+	void sendShift(int id, int num, int den);
+	void sendOctave(int id, int oct);
+	void sendAmplitude(int id, float amp);
+	void send(const char *msg);
+	void send(const char *msg, int a);
+	void handleMessage(ofxOscMessage &m);
 	
-		void sendReplyTo();
-		void sendCalibrate();
-		void sendPosition(Voice *v);
-		void sendPeriod(int id, int num, int den);
-		void sendShift(int id, int num, int den);
-		void sendOctave(int id, int oct);
-		void sendAmplitude(int id, float amp);
-		void send(const char *msg);
-		void send(const char *msg, int a);
-		void handleMessage(ofxOscMessage &m);
-		
-		bool clipToTriangle(int *cx, int *cy);
-		void fitTriangleIn(int w, int h);
-		void reset();
+	bool clipToTriangle(int *cx, int *cy);
+	void fitTriangleIn(int w, int h);
+	void reset();
+
+	void setKeyboardEnable(bool en);
 	
-		// Immutable after construction and setup
-		ofxOscSender	sender;
-		ofxOscReceiver	receiver;
-		int  receivePort;         // for sending /reply_to message
-		int	 numVoices;
-		
-		// somewhat mutable (on window resize)
-		int  x1,y1,x2,y2,x3,y3;   // Triangle Coords
-		int  DX13, DY13, SQLEN13; // to optimise clipping
+	// Immutable after construction and setup
+	ofxOscSender	sender;
+	ofxOscReceiver	receiver;
+	int  receivePort;         // for sending /reply_to message
+	int	 numVoices;
 	
-		// mutable state
-		Voice  *voices[MAX_VOICES];
-		Voice  *voiceGrabbed;
-		bool   constrained;
-		bool   enableKeys;
-		int    display_frames;
-		int    ratio;
-		int	   tempoIndex;
-		string display_msg;
-		ofTrueTypeFont display_font;
+	// somewhat mutable (on window resize)
+	int  x1,y1,x2,y2,x3,y3;   // Triangle Coords
+	int  DX13, DY13, SQLEN13; // to optimise clipping
+
+	// mutable state
+	Voice  *voices[MAX_VOICES];
+	Voice  *voiceGrabbed;
+	bool   constrained;
+	bool   enableKeys;
+	bool   allowExit;
+	int    display_frames;
+	int    ratio;
+	int	   tempoIndex;
+	string display_msg;
+	ofTrueTypeFont display_font;
 };