view src/Voice.cpp @ 16:add71da95cb4

Reduced buffer zone a bit, minor code simplification.
author samer
date Tue, 31 Jan 2012 12:51:35 +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; }