annotate Voice.cpp @ 3:3314e795adea

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