/src/Mouth.cpp
C++ | 64 lines | 18 code | 17 blank | 29 comment | 0 complexity | 354ec3cf1ec458c4c0b9ad06aaa28fcb MD5 | raw file
1/* 2 * Mouth.cpp 3 * mouthsynth 4 * 5 * Created by Marek Bereza on 04/09/2010. 6 * Copyright 2010 Marek Bereza. All rights reserved. 7 * 8 */ 9 10#include "Mouth.h" 11 12 13void Mouth::update(const ofRectangle &rect) { 14 15 16 state = false; 17 filter = 0; 18 19 20 // find x, y, width, height 21 this->x = rect.x; 22 this->y = rect.y; 23 24 this->width = rect.width; 25 this->height = rect.height; 26 27 float pitchInput = y+(height/2); // this is the vertical centre of the mouth 28 pitch = ofMap(pitchInput, 0, 320, 0, 1); 29 pitch = ofMap(pitch, 0.6, 0.1, 0, 1); 30 pan = ofMap(x + width/2, 0, width, 0, 1); 31 32 33 34 pos = ofPoint(x + width/2, y + height/2); 35 36 37 38/* 39 40 41 42 // this is some weird ratio of width to height 43 44 if(state==true) { 45 filter = (rightMost-leftMost)/width; 46 } 47 48 // find filter and whether the state is on or not 49 50 if(state&&!lastState) { 51 justOpened = true; 52 } else { 53 justOpened = false; 54 } 55 56 lastState = state; 57 */ 58} 59 60 61void Mouth::draw() { 62 ofSetHexColor(0xFF0000); 63 ofRect(*this); 64}