Mercurial > hg > screen-ui
comparison src/melodyTriangle.h @ 22:4dcc4312b5fa
Bit of a tidy up, adding text display, added full screen toggle and window resize handler.
author | samer |
---|---|
date | Thu, 02 Feb 2012 18:17:24 +0000 |
parents | 9d7e139cd0a3 |
children | 460c05dd74d0 |
comparison
equal
deleted
inserted
replaced
21:95626beb91ab | 22:4dcc4312b5fa |
---|---|
3 #include "ofMain.h" | 3 #include "ofMain.h" |
4 #include "Voice.h" | 4 #include "Voice.h" |
5 | 5 |
6 #include "ofxOsc.h" | 6 #include "ofxOsc.h" |
7 | 7 |
8 | 8 #define MAX_VOICES 10 |
9 | |
10 | 9 |
11 | 10 |
12 class melodyTriangle : public ofBaseApp{ | 11 class melodyTriangle : public ofBaseApp{ |
13 | 12 |
14 public: | 13 public: |
15 melodyTriangle(const char *host, int port, int numVoices, bool enableKeys, int voiceIdOffset, int receivePort); | 14 melodyTriangle(const char *host, int port, int numVoices, bool enableKeys, int voiceIdOffset, int receivePort); |
16 | 15 ~melodyTriangle(); |
16 | |
17 void setup(); | 17 void setup(); |
18 void update(); | 18 void update(); |
19 void draw(); | 19 void draw(); |
20 | 20 |
21 void keyPressed(int key); | 21 void keyPressed(int key); |
23 void mouseMoved(int x, int y ); | 23 void mouseMoved(int x, int y ); |
24 void mouseDragged(int x, int y, int button); | 24 void mouseDragged(int x, int y, int button); |
25 void mousePressed(int x, int y, int button); | 25 void mousePressed(int x, int y, int button); |
26 void mouseReleased(int x, int y, int button); | 26 void mouseReleased(int x, int y, int button); |
27 void windowResized(int w, int h); | 27 void windowResized(int w, int h); |
28 int numVoices; | 28 |
29 int voiceIdOffset; | 29 private: |
30 bool enableKeys; | 30 // private methods |
31 float counter; | 31 void sendReplyTo(); |
32 bool bSmooth; | |
33 Voice *voices[10]; | |
34 | |
35 int x1,y1,x2,y2,x3,y3;//Triangle Coords | |
36 int triangleHeight; | |
37 int voiceGrabbed; | |
38 void sendPosition(Voice v); | |
39 void sendCalibrate(); | 32 void sendCalibrate(); |
33 void sendPosition(Voice v); | |
40 void sendPeriod(int id, int num, int den); | 34 void sendPeriod(int id, int num, int den); |
41 void sendShift(int id, int num, int den); | 35 void sendShift(int id, int num, int den); |
42 void sendOctave(int id, int oct); | 36 void sendOctave(int id, int oct); |
43 void sendAmplitude(int id, float amp); | 37 void sendAmplitude(int id, float amp); |
38 bool clipToTriangle(int *cx, int *cy); | |
39 void fitTriangleIn(int w, int h); | |
40 void handleMessage(ofxOscMessage &m); | |
41 | |
42 // Immutable after construction and setup | |
43 ofxOscSender sender; | |
44 ofxOscReceiver receiver; | |
45 int receivePort; // for sending /reply_to message | |
46 int numVoices; | |
47 bool enableKeys; | |
44 | 48 |
49 // somewhat mutable (on window resize) | |
50 int x1,y1,x2,y2,x3,y3; // Triangle Coords | |
51 int DX13, DY13, SQLEN13; // to optimise clipping | |
45 | 52 |
46 private: | 53 // mutable state |
47 ofxOscSender sender; | 54 Voice *voices[MAX_VOICES]; |
48 ofxOscReceiver receiver; | 55 int voiceGrabbed; |
49 int DX13, DY13, SQLEN13; | 56 ofTrueTypeFont display_font; |
50 | 57 string display_msg; |
51 bool clipToTriangle(int *cx, int *cy); | 58 int display_frames; |
59 bool constrained; | |
52 }; | 60 }; |