hekeus@6: /* hekeus@6: * Voice.cpp hekeus@6: * MelodyTriangle hekeus@6: * hekeus@6: * Created by Henrik Ekeus on 12/01/2012. hekeus@6: * Copyright 2012 Queen Mary University of London. All rights reserved. hekeus@6: * hekeus@6: */ hekeus@6: hekeus@6: #include "Voice.h" hekeus@6: samer@13: inline static double min(double x,double y) { return (xid=id; hekeus@6: posx=x; hekeus@6: posy=y; hekeus@6: isActive=true; samer@10: radius=12; hekeus@6: inTriangle=false; hekeus@6: octave=0; hekeus@6: highlight=false; samer@13: amplitude=0.6; hekeus@6: } hekeus@6: hekeus@6: void Voice::draw(){ samer@10: ofSetColor(200,0,0); hekeus@6: hekeus@6: if (isActive){ hekeus@6: ofFill(); samer@10: } else { hekeus@6: ofNoFill(); hekeus@6: } hekeus@6: ofCircle(posx, posy, radius); samer@12: if (highlight) ofSetColor(255, 192, 192); samer@10: ofNoFill(); samer@10: ofCircle(posx, posy, radius); hekeus@6: } hekeus@6: samer@13: double Voice::louder() { return amplitude=min(1,amplitude*1.125); } samer@13: double Voice::quieter() { return amplitude/=1.125; } hekeus@6: