annotate 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
rev   line source
hekeus@6 1
hekeus@6 2
hekeus@6 3 #include "ofMain.h"
hekeus@6 4 #include "Voice.h"
hekeus@6 5
hekeus@6 6 #include "ofxOsc.h"
hekeus@6 7
samer@22 8 #define MAX_VOICES 10
hekeus@6 9
hekeus@6 10
hekeus@6 11 class melodyTriangle : public ofBaseApp{
hekeus@6 12
hekeus@6 13 public:
hekeus@8 14 melodyTriangle(const char *host, int port, int numVoices, bool enableKeys, int voiceIdOffset, int receivePort);
samer@22 15 ~melodyTriangle();
samer@22 16
hekeus@6 17 void setup();
hekeus@6 18 void update();
hekeus@6 19 void draw();
hekeus@6 20
hekeus@6 21 void keyPressed(int key);
hekeus@6 22 void keyReleased(int key);
hekeus@6 23 void mouseMoved(int x, int y );
hekeus@6 24 void mouseDragged(int x, int y, int button);
hekeus@6 25 void mousePressed(int x, int y, int button);
hekeus@6 26 void mouseReleased(int x, int y, int button);
hekeus@6 27 void windowResized(int w, int h);
samer@22 28
samer@22 29 private:
samer@22 30 // private methods
samer@22 31 void sendReplyTo();
samer@12 32 void sendCalibrate();
samer@22 33 void sendPosition(Voice v);
samer@12 34 void sendPeriod(int id, int num, int den);
samer@12 35 void sendShift(int id, int num, int den);
samer@12 36 void sendOctave(int id, int oct);
samer@13 37 void sendAmplitude(int id, float amp);
samer@22 38 bool clipToTriangle(int *cx, int *cy);
samer@22 39 void fitTriangleIn(int w, int h);
samer@22 40 void handleMessage(ofxOscMessage &m);
samer@22 41
samer@22 42 // Immutable after construction and setup
samer@22 43 ofxOscSender sender;
samer@22 44 ofxOscReceiver receiver;
samer@22 45 int receivePort; // for sending /reply_to message
samer@22 46 int numVoices;
samer@22 47 bool enableKeys;
hekeus@6 48
samer@22 49 // somewhat mutable (on window resize)
samer@22 50 int x1,y1,x2,y2,x3,y3; // Triangle Coords
samer@22 51 int DX13, DY13, SQLEN13; // to optimise clipping
hekeus@6 52
samer@22 53 // mutable state
samer@22 54 Voice *voices[MAX_VOICES];
samer@22 55 int voiceGrabbed;
samer@22 56 ofTrueTypeFont display_font;
samer@22 57 string display_msg;
samer@22 58 int display_frames;
samer@22 59 bool constrained;
hekeus@6 60 };