Mercurial > hg > screen-ui
view src/Voice.h @ 23:460c05dd74d0
Various enhancements and code refactorings:
* added some compiler warnings.
* text display is centred and with settable TrueType font
* removed highlight member from Voice state - value is derived from other data
and passed to Voice::draw()
* Changed voice radius from member to defined constant
* default number of voices is now 4
* adjusted some colours and buffer zone width
* new keyboard commands: reset, quit.
* when keyboard disabled, keys are now passed to server via OSC
* added handlers for various new OSC messages:
- fullscreen, reset, quit, keyboard enable
- notify (voice state) : several sub-messages
* call reset and calibrate on window resize (fits triangle to window)
author | samer |
---|---|
date | Sat, 04 Feb 2012 23:14:38 +0000 |
parents | 4dcc4312b5fa |
children | f4ebb87adec1 |
line wrap: on
line source
/* * Voice.h * MelodyTriangle * * Created by Henrik Ekeus on 12/01/2012. * Copyright 2012 Queen Mary University of London. All rights reserved. * */ #include "ofMain.h" #define RADIUS 12 class Voice { public: Voice(int id); enum status { clear, pending, waiting, moved }; class bad_status : public std::exception { string str; public: bad_status(string s): str(s) {} ~bad_status() throw() {} const char *what() const throw(); }; static status stringToStatus(string str) throw(bad_status); bool isInVoice(int x, int y) { return (ofDist(x, y, posx, posy)<=RADIUS); }; //void setPos(int x, int y) { posx=x; posy=y; status=pending; } double louder(); double quieter(); void draw(bool highlight); int id; int posx,posy; bool isActive; bool inTriangle; int octave; double amplitude; enum status status; };