annotate src/Voice.cpp @ 12:317637282293

Compressed keyboard handling code, added calibration key 'c'.
author samer
date Mon, 30 Jan 2012 00:00:15 +0000
parents a8f71b5bdb0e
children 9e31c0507e65
rev   line source
hekeus@6 1 /*
hekeus@6 2 * Voice.cpp
hekeus@6 3 * MelodyTriangle
hekeus@6 4 *
hekeus@6 5 * Created by Henrik Ekeus on 12/01/2012.
hekeus@6 6 * Copyright 2012 Queen Mary University of London. All rights reserved.
hekeus@6 7 *
hekeus@6 8 */
hekeus@6 9
hekeus@6 10 #include "Voice.h"
hekeus@6 11
hekeus@6 12 Voice::Voice(int id, int x, int y){
hekeus@6 13 this->id=id;
hekeus@6 14 posx=x;
hekeus@6 15 posy=y;
hekeus@6 16 isActive=true;
samer@10 17 radius=12;
hekeus@6 18 inTriangle=false;
hekeus@6 19 octave=0;
hekeus@6 20 highlight=false;
hekeus@6 21 }
hekeus@6 22
hekeus@6 23 Voice::Voice(){}
hekeus@6 24
hekeus@6 25 void Voice::draw(){
samer@10 26 ofSetColor(200,0,0);
hekeus@6 27
hekeus@6 28 if (isActive){
hekeus@6 29 ofFill();
samer@10 30 } else {
hekeus@6 31 ofNoFill();
hekeus@6 32 }
hekeus@6 33 ofCircle(posx, posy, radius);
samer@12 34 if (highlight) ofSetColor(255, 192, 192);
samer@10 35 ofNoFill();
samer@10 36 ofCircle(posx, posy, radius);
hekeus@6 37 }
hekeus@6 38
hekeus@6 39 bool Voice::isInVoice(int x, int y){
hekeus@6 40 if (ofDist(x, y, posx, posy)<=radius){
hekeus@6 41 return true;
hekeus@6 42 }else {
hekeus@6 43 return false;
hekeus@6 44 }
hekeus@6 45
hekeus@6 46 }
hekeus@6 47