Mercurial > hg > screen-ui
view src/Voice.cpp @ 14:578c1acf1cc4
Octave and amplitude now initialised correctly on birth; added binary app.
author | samer |
---|---|
date | Mon, 30 Jan 2012 23:31:39 +0000 |
parents | 9e31c0507e65 |
children | 9a414ea6880d |
line wrap: on
line source
/* * Voice.cpp * MelodyTriangle * * Created by Henrik Ekeus on 12/01/2012. * Copyright 2012 Queen Mary University of London. All rights reserved. * */ #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; posy=y; isActive=true; radius=12; inTriangle=false; octave=0; highlight=false; amplitude=0.6; } void Voice::draw(){ ofSetColor(200,0,0); if (isActive){ ofFill(); } else { ofNoFill(); } ofCircle(posx, posy, radius); if (highlight) ofSetColor(255, 192, 192); ofNoFill(); ofCircle(posx, posy, radius); } double Voice::louder() { return amplitude=min(1,amplitude*1.125); } double Voice::quieter() { return amplitude/=1.125; }