Mercurial > hg > screen-ui
diff src/Voice.cpp @ 13:9e31c0507e65
Added amplitude control (keys '*' and '/').
author | samer |
---|---|
date | Mon, 30 Jan 2012 13:29:53 +0000 |
parents | 317637282293 |
children | 9a414ea6880d |
line wrap: on
line diff
--- a/src/Voice.cpp Mon Jan 30 00:00:15 2012 +0000 +++ b/src/Voice.cpp Mon Jan 30 13:29:53 2012 +0000 @@ -9,6 +9,8 @@ #include "Voice.h" +inline static double min(double x,double y) { return (x<y) ? x : y; } + Voice::Voice(int id, int x, int y){ this->id=id; posx=x; @@ -18,10 +20,9 @@ inTriangle=false; octave=0; highlight=false; + amplitude=0.6; } -Voice::Voice(){} - void Voice::draw(){ ofSetColor(200,0,0); @@ -36,12 +37,6 @@ ofCircle(posx, posy, radius); } -bool Voice::isInVoice(int x, int y){ - if (ofDist(x, y, posx, posy)<=radius){ - return true; - }else { - return false; - } +double Voice::louder() { return amplitude=min(1,amplitude*1.125); } +double Voice::quieter() { return amplitude/=1.125; } -} -