comparison src/melodyTriangle.h @ 37:260cc4f4d70a

Now using OSC bundles to make sure cotemporal messages are received in correct order; also added randInit state flag (toggle 'i') to control sending of /randinit on birth.
author samer
date Wed, 22 Feb 2012 00:30:20 +0000
parents 06a2fdb333ca
children 330f2746fedd
comparison
equal deleted inserted replaced
36:f973f0cc743b 37:260cc4f4d70a
30 bad_voice_id(int id): id(id) {} 30 bad_voice_id(int id): id(id) {}
31 ~bad_voice_id() throw() {} 31 ~bad_voice_id() throw() {}
32 const char *what() const throw(); 32 const char *what() const throw();
33 }; 33 };
34 34
35 // static methods
36 ofxOscMessage msgReplyTo();
37 ofxOscMessage msgCalibrate();
38 static ofxOscMessage msgPosition(Voice *v);
39 static ofxOscMessage msgPeriod(int id, int num, int den);
40 static ofxOscMessage msgShift(int id, int num, int den);
41 static ofxOscMessage msgOctave(int id, int oct);
42 static ofxOscMessage msgAmplitude(int id, float amp);
43 static ofxOscMessage msg(const char *msg);
44 static ofxOscMessage msg(const char *msg, int a);
45 static ofxOscMessage msg(const char *msg, int a, int b);
46 static ofxOscMessage msg(const char *msg, int a, int b, int c);
47
35 // private methods 48 // private methods
49 void handleMessage(ofxOscMessage &m);
36 Voice *get_voice(int id) throw(bad_voice_id); 50 Voice *get_voice(int id) throw(bad_voice_id);
37 void voiceKeypress(Voice *v, int key); 51 void voiceKeypress(Voice *v, int key);
38 52 void setKeyboardEnable(bool en);
39 void sendReplyTo();
40 void sendCalibrate();
41 void sendPosition(Voice *v);
42 void sendPeriod(int id, int num, int den);
43 void sendShift(int id, int num, int den);
44 void sendOctave(int id, int oct);
45 void sendAmplitude(int id, float amp);
46 void send(const char *msg);
47 void send(const char *msg, int a);
48 void send(const char *msg, int a, int b);
49 void send(const char *msg, int a, int b, int c);
50 void handleMessage(ofxOscMessage &m);
51
52 bool clipToTriangle(int *cx, int *cy); 53 bool clipToTriangle(int *cx, int *cy);
53 void fitTriangleIn(int w, int h); 54 void fitTriangleIn(int w, int h);
54 void reset(); 55 void reset();
55 56
56 void setKeyboardEnable(bool en);
57
58 // Immutable after construction and setup 57 // Immutable after construction and setup
59 ofxOscSender sender; 58 ofxOscSender sender;
60 ofxOscReceiver receiver; 59 ofxOscReceiver receiver;
61 int receivePort; // for sending /reply_to message 60 int receivePort; // for sending /reply_to message
62 int numVoices; 61 int numVoices;
70 Voice *voiceGrabbed; 69 Voice *voiceGrabbed;
71 bool constrained; 70 bool constrained;
72 bool enableKeys; 71 bool enableKeys;
73 bool allowExit; 72 bool allowExit;
74 bool snapTruePos; 73 bool snapTruePos;
74 bool randInit;
75 int display_frames; 75 int display_frames;
76 int ratio; 76 int ratio;
77 int tempoIndex; 77 int tempoIndex;
78 string display_msg; 78 string display_msg;
79 ofTrueTypeFont display_font; 79 ofTrueTypeFont display_font;