예제 #1
0
//--------------------------------------------------------------
void testApp::draw(){

    //do some dancing to hide the gui
    bool curvis;
    if (save) {
        curvis = gui->isVisible();
        gui->setVisible(false);
    }
    
    fbo.draw(0, 0);

    //save a single frame
    if (save) {
        stringstream s;
        s << "voronoi_" << ofGetUnixTime() << "_" << npoints << ".png";
        ofSaveScreen(s.str());
        cout << "wrote file to " << s.str() << endl;
        gui->setVisible(curvis);
        save = false;
    }

    //recording save
    if (recording || savelast) {
        stringstream s;
        s << "record/frame_" << ofToString(cur_cnt++, 4, '0') << ".jpg";
        ofSaveScreen(s.str());
        savelast = false;
    }

}
예제 #2
0
void soundMap::drawShortSound(StaticFuzzObject &blob, int note ) {
    if(blob.goTime) {
        if(blob.timePast < blob.duration) {
            if(blob.timePast < 0) {
                startTime = ofGetUnixTime();
                midiOut.sendNoteOn(1,note,50);
            }
            drawFuzzShape(blob);
            int currentTime = ofGetUnixTime();
            blob.timePast= currentTime - startTime;
            ofLog()<<blob.timePast;
        }
        else {
            blob.goTime =false;
            blob.timePast =-1;
        }
    }
}
예제 #3
0
파일: testApp.cpp 프로젝트: hiroyuki/pf-bvh
//--------------------------------------------------------------
void testApp::keyPressed(int key){
    
    if(key == ' ') {
        
        // This is a crazy algorituh to try and fit points in a rectangle
        // that are a set distance away from eachother.
        voronoi.clear();
        int nPts = pointSlider.getValue();
        int minDistToOthes = 10;
        for (int i=0; i<nPts; i++) {
            ofVec2f newPts(ofGetWidth()/2, ofGetHeight()/2);
            newPts.x += ofRandom(-300, 300);
            newPts.y += ofRandom(-300, 300);
            
            if(voronoi.getPoints().size() == 0) {
                voronoi.addPoint(newPts);    
            }
            else {
                bool bFarEnough = false;
                int nCycles = 0;
                while (!bFarEnough) {
                    
                    newPts.set(ofGetWidth()/2, ofGetHeight()/2);
                    newPts.x += ofRandom(-300, 300);
                    newPts.y += ofRandom(-300, 300);
                    bool bNotNearOthers = true;
                    for (int j=0; j<voronoi.getPoints().size(); j++) {
                        float dis = voronoi.getPoints()[j].distance(newPts);
                        if(dis < minDistToOthes) bNotNearOthers = false;
                    }    
                    
                    if(bNotNearOthers) {
                        bFarEnough = true;
                        printf("Found in  %i\n", nCycles);
                    }
                    if(nCycles > 1000) {
                        printf("Tried Hard F**k it! %i\n", nCycles);
                        bFarEnough = true;
                    }
                    nCycles ++;
                }
                voronoi.addPoint(newPts);    
            }            
        }
        
        
    }
    
    if(key == 'f') ofToggleFullscreen();
    if(key == 'g') bHideGUI = !bHideGUI;
    if(key == 'm') bMove    = !bMove;
    
    if(key == 'e') {
        ofSaveScreen(ofToString(ofGetUnixTime())+".png");
    }
}
예제 #4
0
unsigned int ofxGetFileAge(string filename) {
    struct stat fileinfo;
    int rv = stat(filename.c_str(), &fileinfo);
    if (rv < 0 && errno == ENOENT) { //ignore if file does not exist
        return 0;
    } else if (rv < 0) {
        ofLogError() << "could not stat '" << filename << "' (" << strerror(errno) << ")";
        return -1;
    }
    return ofGetUnixTime() - fileinfo.st_mtimespec.tv_sec;
}
예제 #5
0
Touch::Touch(int _port) {
    ofLog() << "Starting Tuio Client";
    tuioClient.start(_port);
    
    ofAddListener(tuioClient.cursorAdded,this,&Touch::tuioAdded);
	ofAddListener(tuioClient.cursorRemoved,this,&Touch::tuioRemoved);
	ofAddListener(tuioClient.cursorUpdated,this,&Touch::tuioUpdated);
    
  //  ofRegisterTouchEvents(this);
    lastMoved = ofGetUnixTime();
}
예제 #6
0
//--------------------------------------------------------------
void testApp::keyPressed (int key) {
	switch (key) {
		
        // example of how to create a keyboard event
            
		case 'A':
        case 'a':
            
            break ; 
			
	}
    
    ofSaveScreen( ofToDataPath( ofToString( ofGetUnixTime() )  + ".jpg" ) ) ;
}
예제 #7
0
파일: ofApp.cpp 프로젝트: marcpadro/poe
//--------------------------------------------------------------
void ofApp::update(){
    
    if ( ! (++count %= UPDATE_TEMPLATE) ) updateTemplate();
    
    unsigned char* result = resultImage.getPixels();
    
    const int size = resultImage.getPixelsRef().size();
    
    //count = ++count % 200;
    //if (!count) fade(result, resultImage.getPixelsRef().size());
    //resultImage.update();
    
    there_was_buffer = there_is_buffer;
    
    to_feed = MAX_TO_FEED;
    while (to_feed && ( (remaining > 0) || (there_is_buffer = remaining = getBuffer()) ) )
    {
        if (to_feed == MAX_TO_FEED && !is_random ) fade(result, size);
        feed(result);
    }
    
    if (there_is_buffer || there_was_buffer)
    {
        resultImage.update();
        ostringstream stream;
        
        stream << ofGetUnixTime();
        stream << ofGetSystemTimeMicros();
        stream << ".png";
        string filename = stream.str();
        string path = RESULT_DIR + filename;
        resultImage.saveImage(path);
        //cout << "Image Saved: " << path << "\n";
        
#if SAVE_RESULT == 0
        if ( previousResult != "" ) ofFile::removeFile( RESULT_DIR + previousResult );
        
        result_dir.open( RESULT_DIR );
        if (!result_dir.exists()) ofExit();
        
        previousResult = latestResult;
        latestResult = filename;
#endif
    }
    
    
}
예제 #8
0
void WaitTimeBar::loadXML() {
//	XML.loadFile("xml/WaitTime.xml");
    
    string _url = "http://localhost/WaitTime.aspx?loc=" + XMLS.getValue("storeLocation", "04");
    
    ofxHttpResponse resp = web.getUrl(_url);
    if(XML.loadFromBuffer(resp.responseBody)) ofLog() << "Loaded XML";
    else {
        ofLog() << "Couldn't GET xml";
         if(XML.loadFile("xml/WaitTime.xml")) ofLog() << "Loaded file";
    }
    lastCheck = ofGetUnixTime();
    //ofLog() << (XML.tagExists("WaitTime",0) ? "WaitTime Works!" : "Waittime ain't there homie");
    XML.pushTag("WaitTime",0);
    XML.pushTag("module",0);
//    ofLog() << XML.doc;
}
예제 #9
0
void taskBroker::saveResults()
{
	string filename = ofToString(ofGetUnixTime());
	ofLogToFile(filename);
	std::vector<blenderTask*>::iterator it = measuredTasks.begin();
	while (it != measuredTasks.end())
	{
		float tactiv = (*it)->windowActiveTime - (*it)->startTime;
		float ttotal = (*it)->endTime - (*it)->startTime;
		ofLog() << ";" <<
				(*it)->countId << ";" <<
				(*it)->identifier << ";" <<
				(*it)->startTime << ";" <<
				tactiv << ";" <<
				ttotal << ";" <<
				(*it)->result;
		++it;
	}
	ofLogToConsole();
}
예제 #10
0
void ThemeSwirley::setup() {
    countX.setup("countX", 35, 0, 200);
    stepX.setup("stepX", 58, 0, 200);
    twistX.setup("twistX", -7.65, -45, 45);
    countY.setup("countY", 25, 0, 50);
    stepY.setup("stepY", 0, 0, 200);
    twistY.setup("twistY", 13.8, -30, 30);
    pinchY.setup("pinchY", 0, 0, 1);
    Scale.setup("Scale", 0.770408, 0.0, 1);
    Background.setup("Background", 0, 0, 255);
    shiftY.setup("shiftY", -234.694, -1000.0, 1000.0);
    rotate.setup("rotate", -134.082, -180.0, 180.0);
    size.setup("size", ofVec2f(1.04956,0), ofVec2f(0,0), ofVec2f(20,20));
    filled.setup("filled", false);
    type.setup("type", false);
    
    for (int i = 0; i < 200; i++) {
        rColor[i] = -1;
        bColor[i] = -1;
        gColor[i] = -1;
    }
    ofSeedRandom(ofGetUnixTime());

    wholeRotate = 0;
    twistXchange = -7.65;
    twistXChanger = 0.0001;
    prevLineLength = 15;
    onsetDecayRate = 200; // # of milliseconds after an onset to respond to it
    timeOfLastOnset = 0;
    ofBackground(Background);

    //TODO Allow user to load settings from XML file

    // Set show GUI to true at the end so senSAE knows that
    // the theme is ready to be displayed
    showTheme = true;
}
예제 #11
0
void WaitTimeBar::update() {
    // Pole the xml side of things every minute
    if(ofGetUnixTime() > lastCheck-checktime) loadXML();
    readXML();

    // Flip them tags every 10 seconds
    flipTag = ofGetSeconds() % 10;
    if(flipTag == 0) flag = true;
    if(flipTag == 1 && flag == true) { tagNum = (tagNum+1) % 4; flag = false; scale = 0.0f; }

    
    
    fbo->begin();
    ofClear(0,0,0,0);
    ofPushMatrix();
    //    if(XMLS.getValue("width", 1920) < XMLS.getValue("height", 1080) ) {
    //        float scale = XMLS.getValue("width", 1920) / XMLS.getValue("height", 1080);
    //        ofScale(scale, scale);
    //    }
    ofTranslate(74,50);
    background->draw(0,0);
    ofPushMatrix();
    ofTranslate(0,30);
    ofTranslate(15,0);
    
    TTF.drawString(carTime > 0 ? "It's your turn!" : ofToString(carTime) + " minutes left!", 158, 35);
    TTF.drawString(houseTime > 0 ? "It's your turn!" : ofToString(houseTime) + " minutes left!", 529,35);
    
    TTF.drawString(travelTime > 0 ? "It's your turn!" : ofToString(travelTime) + " minutes left!", 1048, 35);
    
    TTF.drawString(memberTime > 0 ? "It's your turn!" : ofToString(memberTime) + " minutes left!", 1469, 35);
    ofPopMatrix();
    ofTranslate(0,17);
    drawFlipTag();
    ofPopMatrix();
    fbo->end(); 
}
void GiorgiaStars2::update(const string childName, const string fontName)  {
    ofLog() << "giorgia stars  2 update, load font " << fontName;
    font.load(fontName, 400);
    _childName = childName;
    _drawFontFbo.clear();
    _drawFontFbo.allocate(quadWarper.getWidth(), quadWarper.getHeight(), GL_RGB);
    _drawFontFbo.begin();
    sdfPixels.setColor(ofColor(0));
    ofClear(0, 0, 0);
    ofPushMatrix();
    ofTranslate(400, 1500);//THIS IS JUST A GUESS REALLY
    ofRotateY(40);
    ofRotateZ(-10);
    ofSetColor(255, 255, 255);
    ofSetBackgroundColor(255, 0, 0);
    ofScale(1 / SCREEN_SCALE_FACTOR, 1 / SCREEN_SCALE_FACTOR);
    //TODO -rotate scale, warp etc
    font.drawString(_childName, 0, 100);//TODO - position this properly
    ofPopMatrix();
    _drawFontFbo.end();
    ofxCvGrayscaleImage grayScaleCvImg;
    ofPixels pixels;
    pixels.allocate(_drawFontFbo.getWidth(), _drawFontFbo.getHeight(), OF_PIXELS_RGB);
    _drawFontFbo.readToPixels(pixels);
    ofxCvColorImage colorCvImage;
    colorCvImage.setFromPixels(pixels);
    grayScaleCvImg = colorCvImage;
    
    grayScaleCvImg.threshold(80);
    int minBlobArea = 50 * 50;
    int maxBlobArea = grayScaleCvImg.width * grayScaleCvImg.height;
    int t1 = ofGetUnixTime();
    int result = contourFinder.findContours(grayScaleCvImg, minBlobArea, maxBlobArea, childName.size() * 4, true);
    
    auto iter = contourFinder.blobs.begin();
    int bCount = 0;
    float mDist = 70;
    while(iter != contourFinder.blobs.end())
    {
        ofxCvBlob blob = *iter;
        
        ofRectangle rect = blob.boundingRect;
                
        if(!blob.hole)
        {
            int l = (int)rect.getLeft();
            int r = (int)rect.getRight();
            int t = (int)rect.getTop();
            int b = (int)rect.getBottom();
            ofPoint p;
            ofPolyline polyLine;
            polyLine.addVertices(blob.pts);
            polyLine.close();
            for(int col = l; col<=r; col++)
            {
                for(int row = t; row<=b; row++)
                {
                    if(pixels.getColor(col, row).r > 0)
                    {
                        float minDist = mDist;
                        p.set(col, row);
                        auto closestPoint = polyLine.getClosestPoint(p);
                        minDist = min(p.distance(closestPoint), minDist);
                        
                        int r = (int)(255 * (mDist - minDist) / mDist);
                        ofColor color = sdfPixels.getColor(col, row) + ofColor(r, 0, 255);
                        
                        sdfPixels.setColor(col, row, color);
                    }
                }
            }
        }
        else{
            //TODO : do the same thing for the outside ring of the blob bounding rect
            rect.setFromCenter(blob.centroid.x, blob.centroid.y, rect.width * 2, rect.height * 2);
            ofPoint p;
            ofPolyline polyLine;
            polyLine.addVertices(blob.pts);
            polyLine.close();
            int l = (int)rect.getLeft();
            int r = (int)rect.getRight();
            int t = (int)rect.getTop();
            int b = (int)rect.getBottom();
            
            for(int col = l; col<=r; col++)
            {
                for(int row = t; row<=b; row++)
                {
                    if(pixels.getColor(col, row).r > 0)
                    {
                        float minDist = mDist;
                        p.set(col, row);
                        auto closestPoint = polyLine.getClosestPoint(p);
                        minDist = min(p.distance(closestPoint), minDist);
                        
                        int r = (int)(255 * (mDist - minDist) / mDist);
                        ofColor color = sdfPixels.getColor(col, row) + ofColor(r, 0, 255);
                        sdfPixels.setColor(col, row, color);
                    }
                }
            }
        }
            
        bCount++;
        
        iter++;
    }
    
    ofLog() << " blobs sorted out in " << (ofGetUnixTime() - t1);
    sdfImage.setFromPixels(sdfPixels);
    pixels.clear();
    
}
예제 #13
0
//--------------------------------------------------------------
void App::keyPressed(int key) {
    switch (key) { 
        case 'a': 
			drawAudio = !drawAudio;
			break; 
        case OF_KEY_RIGHT:  //scene changing
			sceneIndex++;
			draw_gui = true;
			break;              
        case OF_KEY_LEFT:
			sceneIndex--;
			draw_gui = true;
			break;              
        case 'e': // for exporting a screen grab
			ofSaveScreen("exports/"+ofToString(ofGetUnixTime())+".png");
			break;            
        case 'f':
			ofToggleFullscreen();
			break;
//		case 'g': {
			//draw_gui = !draw_gui;
//			break;
//		}
        case 'm':{
            if(showMouse){
                ofHideCursor();
            }else{
                ofShowCursor();
            }
            showMouse = !showMouse;
            break;
        }
		
		
#ifdef USE_VEINS		
		case 'v': {
			float cx = ofGetWidth() * 0.5;
			float cy = ofGetHeight() * 0.5;
			for(int i = 0; i < 300; ++i) {
				float l = ofRandom(0,300);
				float a = ofRandom(0,TWO_PI);
				float x = cx + cos(a) * l;
				float y = cy + sin(a) * l;
				rxParticle* p = new rxParticle(ofVec3f(x,y,0),1);
				veins.addSource(p);
			}
			break;
		}
		
		case 'o': {
			float cx = ofGetWidth() * 0.5;
			float cy = ofGetHeight() * 0.5;
			float l = 300;
			float a = ofRandom(0,TWO_PI);
			float x = cx + cos(a) * l;
			float y = cy + sin(a) * l;
			rxParticle* p = new rxParticle(ofVec3f(x,y,0),1);
			veins.addRoot(p);
			break;			
		}
		case 's': {
			veins.step();
			break;
		}
		case 'u': {
			veins.update();
			break;
		}
#endif		
		default:
			break;
	}  
    
    sceneIndex %= (int)scenes.size();
    if(sceneIndex < 0) sceneIndex = scenes.size()-1;
    
    changeScene(sceneIndex);
    
    if(currentScene!=NULL)currentScene->keyPressed(key);
}
예제 #14
0
void testApp::takePicture(){
	unsigned char * greyPixels =  bmp.getPixels();
	
	ofPixels pixels;
	pixels.allocate(bmp.getWidth(), bmp.getHeight(), 3);
	imageSmall.readToPixels(pixels);
	ofPixels channel = pixels.getChannel(0);
	
	for (int i = 0; i < channel.size(); i++) {
		greyPixels[i] = channel[i];
	}
	
	bmp.update();
	string timestamp = ofToString(ofGetUnixTime());
	
	
	string filename = timestamp + ".bmp";
	bmp.saveImage(filename);
	
	
	
	
	/*ofPixels pixelsBig;
	pixelsBig.allocate(image.getWidth(), image.getHeight(), 3);
	image.readToPixels(pixelsBig);
	ofPixels channelBig = pixelsBig.getChannel(0);
	uint8_t * printData = new uint8_t [(int) image.getWidth()* (int)image.getHeight()];
	uint8_t currByte;
	for (int i = 0; i < channelBig.size(); i++) {
		currByte <<= 1;
		currByte |= ((int)channelBig[i] > 100) ? 0 : 1;
		if(i%8 == 7){
			printData[i] = currByte;
		}
	}*/
	//printBitmap(image.getWidth(), image.getHeight(), printData);
	
	
	
	string script = ofFilePath::getEnclosingDirectory(ofFilePath::getCurrentExePath(), false) + "../Resources/Bits2DNA.pl";
	string command = "perl " + script + " \"" + ofToDataPath(filename) + "\" \"" + ofToDataPath(filename)+".dna" + "\"";
	system(command.c_str());
	
	ofBuffer buffer = ofBufferFromFile(filename + ".dna" );
	vector<int> data;
	while (!buffer.isLastLine()) {
		string line = ofToUpper(buffer.getNextLine());
		for (int i = 0; i < line.size(); i++) {
			char letter = line[i];
			switch (letter) {
				case 'A':
					data.push_back(0);
					break;
				case 'G':
					data.push_back(1);
					break;
				case 'T':
					data.push_back(2);
					break;
				case 'C':
					data.push_back(3);
					break;
			}
		}
	}
	printImage.allocate(384, 50 + 384 + (int) (data.size() / (384 / 4)) * 4);
	//printImage.allocate(100, 20 );
	printImage.begin();
	ofClear(255,255,255);
	ofSetColor(0, 0, 0, 255);
	ofDrawBitmapString("ART HACK DAY STOCKHOLM 2013", 0, 14);
	ofDrawBitmapString(timestamp + ".BMP.DNA", 0, 30);
	ofSetColor(255, 255, 255, 255);
	image.draw(20, 60, 344,344);
	//image.draw(0, 0, 344,344);
	
	int row = 0;
	int col = 0;
	int maxCols = 384/4;
	ofPushMatrix();
	ofTranslate(0, 50 + 384);
	
	for (int i = 0; i < data.size(); i++) {
		ofSetColor(255,255,255);
		bases[data[i]].draw(col*4, row*4, 4,4);
		col++;
		if(col >= maxCols){
			col = 0;
			row++;
		}
	}
	ofPopMatrix();
	
	printImage.end();
	
	
	ofImage printBmp;
	printBmp.allocate(printImage.getWidth(), printImage.getHeight(), OF_IMAGE_GRAYSCALE);
	unsigned char * printPixels =  printBmp.getPixels();
	ofPixels printFBOpixels;
	printFBOpixels.allocate(printImage.getWidth(), printImage.getHeight(), 3);
	printImage.readToPixels(printFBOpixels);
	ofPixels printChannel = printFBOpixels.getChannel(0);
	
	
	//uint8_t * printData = new uint8_t [(int) printImage.getWidth()* (int)printImage.getHeight()/8];
	//uint8_t currByte;
	
	for (int i = 0; i < printChannel.size(); i++) {
		printPixels[i] = ((int)printChannel[i] > 100) ? 255 : 0;
		
		//currByte <<= 1;
		//currByte |= ((int)channel[i] > 100) ? 0 : 1;
		//if(i%8 == 7){
			//printData[i] = currByte;
		//}
	}

	
	printBmp.update();
	int width = printImage.getWidth();
	int height = printImage.getHeight();
	//zzprintBitmap(width, height, printData);
	//delete printData;
	
	printBmp.saveImage(filename+".print.bmp");
}
예제 #15
0
void Touch::tuioRemoved(ofxTuioCursor &tuioCursor){
    ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
    ofLog(OF_LOG_VERBOSE) << "Point n" << tuioCursor.getSessionId() << " remove at " << loc << endl;
     ofNotifyMouseReleased(loc.x, loc.y, 0);
   lastMoved = ofGetUnixTime();
}
예제 #16
0
파일: AppCore.cpp 프로젝트: PaMuOS/PMOS_OF
//--------------------------------------------------------------
void AppCore::update() {
    
    kinect.update();
    kinect1.update();
    
    if(kinect.isFrameNew() && kinect1.isFrameNew()){
        
        grayImage.setFromPixels(kinect.getDepthPixels(), kinect.width, kinect.height);
        grayImage1.setFromPixels(kinect1.getDepthPixels(), kinect1.width, kinect1.height);
        
        GrayPixel = grayImage.getPixelsRef();
        GrayPixel.rotate90(3);
        
        GrayPixel1 = grayImage1.getPixelsRef();
        GrayPixel1.rotate90(3);
        
        for(int i=0; i<640; i++){
            memcpy(combinedVideo + (i*960), GrayPixel.getPixels()+(i*480), 480);
            memcpy(combinedVideo + (i*960+480), GrayPixel1.getPixels()+(i*480), 480);
            bothKinects.setFromPixels(combinedVideo, 480*2, 640);
        }
        
        bothKinects.threshold(thresholdVal);
        contourFinder.findContours(bothKinects, 150, 50000, maxInput, false);
        
    }
    
    grayImage.flagImageChanged();
    grayImage1.flagImageChanged();
    
    currentInput = contourFinder.nBlobs;
    
    for(int i = 0; i < currentInput; i++) {
        blobs[i] = contourFinder.blobs.at(i);
        blobCenterX[i] = blobs[i].centroid.x;
        blobCenterY[i] = blobs[i].centroid.y;
        blobCenterXmap[i] = ofMap(blobCenterX[i], 0, kinect.height*2, 0, ofGetWidth());
        blobCenterYmap[i] = ofMap(blobCenterY[i], 0, kinect.width, 0, ofGetHeight());
        
        }
    
    ////////////////////////////////////////////////////////////////////////////////////////
    
    ofxOscBundle b;
    timeStamp = ofGetUnixTime();
    //timeStamp = ofGetSystemTimeMicros()/1000.0;
    //timeStamp = ofGetTimestampString():
    
    if(currentInput>PERSON_NUM){
        currentInput=PERSON_NUM;
    }
    
    // reset the pipes and check the mouse
    mPerson->pipeID = 0;
    mPerson->frequency=0;
    ofxOscMessage m;
    m.setAddress("/mouse");
    m.addIntArg(timeStamp); // timestamp
    m.addFloatArg(0); // userID ???
    m.addFloatArg(mPerson->x); // x
    m.addFloatArg(mPerson->y); // y
    for (int i = 0; i < TUBE_NUM; i++){
        allPipes[i]->isHit=false;
        float mouseDist = ofDist(allPipes[i]->x,allPipes[i]->y,mPerson->x,mPerson->y);
        if(mouseDist<allPipes[i]->radius){
            mPerson->frequency=allPipes[i]->frequency;
            mPerson->diameter=allPipes[i]->radius;
            mPerson->height=allPipes[i]->height;
            mPerson->length=allPipes[i]->length;
            mPerson->openClosed=allPipes[i]->openClosed;
            mPerson->pipeID = allPipes[i]->idNum;
            allPipes[i]->isHit=true;
        }
    }
    m.addFloatArg(mPerson->pipeID);                 // tubeID
    m.addFloatArg(mPerson->frequency);              // frequency
    m.addFloatArg(mPerson->diameter);               // diameter
    m.addFloatArg(mPerson->height-mPerson->length); // leng
    m.addFloatArg(mPerson->openClosed);             // oc
    b.addMessage(m);
    m.clear();
    
    // check if the tracked people are hitting the pipes
    for(int u = 0; u<currentInput; u++){
        
        persons[u]->x=blobCenterXmap[u];
        persons[u]->y=blobCenterYmap[u];
        persons[u]->frequency=0;
        //persons[u]->diameter=0;   //no need to set these to 0
        //persons[u]->height=0;
        //persons[u]->length=0;
        //persons[u]->openClosed=0;
        
        ofxOscMessage oscMessage;
        oscMessage.setAddress("/messages/" + ofToString(u));
        oscMessage.addIntArg(timeStamp); // timestamp
        oscMessage.addFloatArg(u); // userID ???
        oscMessage.addFloatArg(ofMap(persons[u]->x, 0, ofGetWidth(), 0, 1)); // x
        oscMessage.addFloatArg(ofMap(persons[u]->y, 0, ofGetHeight(), 0, 1)); // y
        
        for (int i = 0; i < TUBE_NUM; i++){
            float dist = ofDist(allPipes[i]->x,allPipes[i]->y,persons[u]->x,persons[u]->y);
            if(dist<allPipes[i]->radius){
                persons[u]->frequency=allPipes[i]->frequency;
                persons[u]->diameter=allPipes[i]->radius;
                persons[u]->height=allPipes[i]->height;
                persons[u]->length=allPipes[i]->length;
                persons[u]->openClosed=allPipes[i]->openClosed;
                persons[u]->pipeID=allPipes[i]->idNum;
                allPipes[i]->isHit=true;
            }
        }
        
        oscMessage.addFloatArg(persons[u]->pipeID); // tubeID
        oscMessage.addFloatArg(persons[u]->frequency); // frequency
        b.addMessage(oscMessage);
        oscMessage.clear();
    }
    
    if(currentInput==0){
        for (int i = 0; i < PERSON_NUM; i++){
            persons[i]->frequency = 0;
            persons[i]->diameter=0;
            persons[i]->height=0;
            persons[i]->length=0;
            persons[i]->openClosed=0;
            persons[i]->x=0;
            persons[i]->y=0;
        }
    }
    
    for (int i = 0; i < PERSON_NUM; i++){
        pd.sendFloat(patches[i].dollarZeroStr()+"-frequency",persons[i]->frequency);
        pd.sendFloat(patches[i].dollarZeroStr()+"-openClosed",persons[i]->openClosed);
        pd.sendFloat(patches[i].dollarZeroStr()+"-height",persons[i]->height-persons[i]->length);
        pd.sendFloat(patches[i].dollarZeroStr()+"-diameter",persons[i]->diameter);
        // vbap
        // OF screen bottom-left is top-left for the vbap speaker placement
        pd.sendFloat(patches[i].dollarZeroStr()+"-y",ofMap(persons[i]->x,0,ofGetWidth(),1,0));
        pd.sendFloat(patches[i].dollarZeroStr()+"-x",ofMap(persons[i]->y,0,ofGetHeight(),1,0));
    }
    
    // sending OSC
    sender.sendBundle(b);
    
    // mouse patch
    pd.sendFloat(mousePatch.dollarZeroStr()+"-frequency",mPerson->frequency);
    pd.sendFloat(mousePatch.dollarZeroStr()+"-openClosed",mPerson->openClosed);
    pd.sendFloat(mousePatch.dollarZeroStr()+"-height",mPerson->height-mPerson->length);
    pd.sendFloat(mousePatch.dollarZeroStr()+"-diameter",mPerson->diameter);
    // vbap
    // OF screen bottom-left is top-left for the vbap speaker placement
    pd.sendFloat(mousePatch.dollarZeroStr()+"-y",ofMap(mPerson->x,0,ofGetWidth(),1,0));
    pd.sendFloat(mousePatch.dollarZeroStr()+"-x",ofMap(mPerson->y,0,ofGetHeight(),1,0));
    pd.sendFloat(mousePatch.dollarZeroStr()+"-selectOutput",outputState);
    
	/*
    // this is not doing anything at the moment
    for (int i = 0; i < TUBE_NUM; i++){
        allPipes[i]->update();
    }
    */
}