From ba37049c44ff64b3c6482a5e2f199f178351a69f Mon Sep 17 00:00:00 2001 From: Comment Date: Tue, 29 Jan 2013 01:52:00 +0000 Subject: mostly working --- src/testApp.cpp | 134 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 79 insertions(+), 55 deletions(-) (limited to 'src/testApp.cpp') diff --git a/src/testApp.cpp b/src/testApp.cpp index 1ca45e4..0392c92 100755 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -1,19 +1,24 @@ #include "testApp.h" //-------------------------------------------------------------- +guiWindow::~guiWindow(){ + cout << "gui window destroyed" << endl; +} +void guiWindow::setup(){} +void guiWindow::setParent(testApp *p){ + parent=p; +} +void guiWindow::draw(){ + parent->gui.draw(); +} +//-------------------------------------------------------------- void testApp::setup(){ loadSettings("settings.xml"); - //sender.setup(host.c_str(),port); - sender.setup("169.254.113.20",57117); - - bInvert=true; - threshold = 80; - // gw=720; gh=576; vidGrabber.setVerbose(true); - bool bGrab=false; + bGrab=false; //vidGrabber.initGrabber(gw,gh); //base grab size colorImg.allocate(gw,gh); @@ -25,33 +30,35 @@ void testApp::setup(){ bLearnBakground = true; - - bFlip=true; - if (boundaries.size()==0) { boundaries.push_back(boundary()); } selectedBoundary=0; -// ofAddListener(ofEvents().fileDragEvent, this, &testApp::fileDragEvent); - /* guiWin=new guiWindow(); - //gui window stuff - ofxFenster* win2=ofxFensterManager::get()->createFenster(0, 0, 200, 400, OF_WINDOW); + ofxFenster* win=ofxFensterManager::get()->createFenster(0, 0, 200, 200, OF_WINDOW); //ofAddListener(win2->events.windowResized, this, &testApp::windowEvent); - win2->setWindowTitle("config"); - win2->addListener(guiWin); + //volume is set in loadSettings + gui.setup("","panel.xml",0,0); + gui.add(vol.setup("volume",volume,0,1.0,255)); + vol.addListener(this,&testApp::volumeChanged); + gui.add(bFlip.setup("flip grab", flip)); + gui.add(bInvert.setup("invert grab", invert)); + gui.add(thresh.setup("threshold",threshold,0,255,255)); + win->setWindowTitle("config"); + win->addListener(guiWin); guiWin->setup(); guiWin->setParent(this); -*/ + } //-------------------------------------------------------------- void testApp::update(){ - if (bGrab) { vidGrabber.grabFrame(); + if (bGrab) { + vidGrabber.grabFrame(); bool bNewFrame = vidGrabber.isFrameNew(); if (bNewFrame){ colorImg.setFromPixels(vidGrabber.getPixels(), gw,gh); @@ -67,34 +74,35 @@ void testApp::update(){ contourFinder.findContours(grayDiff, 20, (gw*gh)/3, 10, true); // find holes } - //generate midi -/* + //generate events + for (int i = 0; i < contourFinder.nBlobs; i++){ for (int j=0;j