void BlockPixelFactory::setup(int aChannelNumber){ tWidth = settings.OUTPUT_CROP_W; tHeight = settings.OUTPUT_CROP_H; numDivisions = 4; filled = true; factoryName = "Block"+ofToString(aChannelNumber); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 200)); ofxControlPanel::setTextColor(simpleColor(50, 50, 240, 255)); panel.setup("FACTORY "+factoryName, ((settings.GUI_W/4.f) * aChannelNumber) + (aChannelNumber * 20.f) , settings.GUI_H/2.f, 300, 350); panel.addPanel("visuals", 1, false); panel.setWhichPanel("visuals"); PixelFactory::addPixelFactoryStandardGUIElements(); panel.addSlider("divisions", "VIS_DIV", 4, 1, 10, true); panel.addToggle("Filled", "VIS_FILLED", true); panel.loadSettings(factoryName + "Settings.xml"); }
void NoisePixelFactory::setup(int aChannelNumber){ noise = new ofxPerlin(); w = settings.OUTPUT_CROP_W/4; h = settings.OUTPUT_CROP_H/4; texColour.allocate(w,h,GL_RGB); colourPixels = new unsigned char [w*h*3]; factoryName = "NoisePixelFactory"+ofToString(aChannelNumber); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 200)); ofxControlPanel::setTextColor(simpleColor(50, 50, 240, 255)); panel.setup("FACTORY "+factoryName, ((settings.GUI_W/4.f) * aChannelNumber) + (aChannelNumber * 20.f) , settings.GUI_H/2.f, 500,400); panel.addPanel("visuals", 2, false); panel.setWhichPanel("visuals"); PixelFactory::addPixelFactoryStandardGUIElements(); panel.addToggle("monochrome?", "NOISE_MONOCHROME", true); panel.addSlider("red offset", "NOISE_RED_OFFSET", 1, 0.0, 20.0, false); panel.addSlider("green offset", "NOISE_GREEN_OFFSET", 1, 0.0, 20.0, false); panel.addSlider("blue offset", "NOISE_BLUE_OFFSET", 1, 0.0, 20.0, false); panel.setWhichColumn(1); panel.addSlider("ns", "NOISE_NOISE_SCALAR", 0.01, 0.0, 0.2, false); panel.addSlider("number of octaves", "NOISE_NUMBER_OF_OCTAVES", 8, 1,20, true); panel.addSlider("falloff", "NOISE_FALLOFF", 0.5, 0.0, 1.f, false); panel.loadSettings(factoryName + "Settings.xml"); }
void testApp::setupControlPanel() { gui.setup(900, ofGetHeight()); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 200)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); // gui.loadFont("Andale Mono.ttf", 8); gui.bIgnoreLayout = true; // doesn't seem to do anything. // and hungarian notation? Ew! gui.addPanel("Cameras"); cameraManager.initControlPanel(gui); gui.setWhichColumn(1); gui.addPanel("Motion"); motionManager.initControlPanel(gui); gui.loadSettings("controlPanelSettings.xml"); gui.setupEvents(); gui.enableEvents(); ofAddListener(gui.guiEvent, this, &testApp::eventsIn); }
void ofApp::setup() { // setupControlPanel(); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 200)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); gui.loadFont("MONACO.TTF", 8); gui.setup("test cv", 0, 0,50, 100); gui.addPanel("background subtraction example", 4, false); //gui.addButtonSlider("threshold", "BG_THRESHOLD", 29.0, 1.0, 255.0, false); kinect.init(true, true, true); kinect.setDepthClipping(100, 1700); kinect.setRegistration(true); kinect.open(); // ofImage_::ofImage(const ofPixels_< PixelType > &pix) img.allocate(640, 480, OF_IMAGE_COLOR_ALPHA); }
void StringPixelFactory::setup(int aChannelNumber){ factoryName = "StringPixelFactory"+ofToString(aChannelNumber); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 200)); ofxControlPanel::setTextColor(simpleColor(50, 50, 240, 255)); panel.setup("FACTORY "+factoryName, ((settings.GUI_W/4.f) * aChannelNumber) + (aChannelNumber * 20.f) , settings.GUI_H/2.f, 300, 400); panel.addPanel("visuals", 1, false); panel.setWhichPanel("visuals"); PixelFactory::addPixelFactoryStandardGUIElements(); panel.addSlider("level input", "VIS_LEVEL_INPUT", 0.3, 0, 1.0f, false); panel.addSlider("level dropoff", "VIS_LEVEL_DROPOFF", 0.8, 0, 1, false); panel.addToggle("colored bg", "VIS_COLORED_BACKGROUND", false); panel.addToggle("invert bg/fg", "VIS_INVERT", false); panel.loadSettings(factoryName + "Settings.xml"); for (int i = 0; i < 40; i++){ particle myParticle; myParticle.setInitialCondition(settings.OUTPUT_CROP_W/40 * i, settings.OUTPUT_CROP_H*0.75f,0,0); particles.push_back(myParticle); if (i == 0 || i == 39){ particles[i].bFixed = true; if (i == 0) particles[i].pos.set(0,settings.OUTPUT_CROP_H); if (i == 39) particles[i].pos.set(settings.OUTPUT_CROP_W,settings.OUTPUT_CROP_H); } } // change this to // for (int i = 0; i < 10; i++){ // to see a chain for (int i = 0; i < particles.size()-1; i++){ spring mySpring; mySpring.distance = 30; mySpring.springiness = 0.2f; mySpring.particleA = & (particles[i ]); mySpring.particleB = & (particles[(i+1) % particles.size()]); springs.push_back(mySpring); } happiness = 0; }
void ImagePixelFactory::setup(int aChannelNumber){ images.resize(0); imageIndexToUse = 0; factoryName = "ImagePixelFactory"+ofToString(aChannelNumber); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 200)); ofxControlPanel::setTextColor(simpleColor(50, 50, 240, 255)); panel.setup("FACTORY"+factoryName, ((settings.GUI_W/4.f) * aChannelNumber) + (aChannelNumber * 20.f) , settings.GUI_H/2.f, 500, 400); panel.addPanel("visuals", 2, false); panel.setWhichPanel("visuals"); panel.setWhichPanel(0); panel.setWhichColumn(0); PixelFactory::addPixelFactoryStandardGUIElements(); vector <string> drawModeNames; drawModeNames.push_back("select on level"); drawModeNames.push_back("next image on peak"); drawModeNames.push_back("next image unless peak"); drawModeNames.push_back("next image on space"); drawModeNames.push_back("manual select"); panel.addTextDropDown("draw mode", "DRAW_MODE", 0, drawModeNames); panel.addSlider("Manual Select", "MANUAL", 0.f, 0.f, 1.f, false); panel.setWhichColumn(1); lister.listDir("images/"); panel.addFileLister("Images", &lister, 200, 300); panel.loadSettings(factoryName + "Settings.xml"); panel.setupEvents(); panel.enableEvents(); ofAddListener(panel.guiEvent, this, &ImagePixelFactory::eventsIn); }
void SlitStretchFactory::setup(int aChannelNumber){ factoryName = "SlitStretchFactory"+ofToString(aChannelNumber); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 200)); ofxControlPanel::setTextColor(simpleColor(50, 50, 240, 255)); panel.setup("FACTORY"+factoryName, ((settings.GUI_W/4.f) * aChannelNumber) + (aChannelNumber * 20.f) , settings.GUI_H/2.f, 500, 400); panel.addPanel("visuals", 2, false); panel.setWhichPanel("visuals"); PixelFactory::addPixelFactoryStandardGUIElements(); panel.addToggle("Vertical? Else Horizontal", "SLIT_VERTICAL", true); panel.setWhichColumn(1); lister.listDir("imagesToSlitAndStretch/"); panel.addFileLister("Images", &lister, 200, 300); panel.loadSettings(factoryName + "Settings.xml"); panel.setupEvents(); panel.enableEvents(); ofAddListener(panel.guiEvent, this, &SlitStretchFactory::eventsIn); inited = false; textureToStretchVertically.allocate(settings.OUTPUT_CROP_W, 1, GL_RGB); textureToStretchHorizontally.allocate(1, settings.OUTPUT_CROP_H, GL_RGB); pixelsHorizontalStretchVertically = new unsigned char [settings.OUTPUT_CROP_W * 3]; pixelsVerticalStretchHorizontally = new unsigned char [settings.OUTPUT_CROP_H * 3]; currentContentPath = ""; currentImageMode = 0; }
//-------------------------------------------------------------- void testApp::setup() { ofSetFrameRate(60); ofSetVerticalSync(true); ofBackground(0); ramInitialize(10000); // gui setup ofxControlPanel::setTextColor(simpleColor(255,255,255,255)); ofxControlPanel::setBackgroundColor(simpleColor(0,0,0,127)); ragdollScene.setup(); ofEasyCam *cam = (ofEasyCam *)&ramCameraManager::instance().getActiveCamera(); cam->setDistance(500); for (int i=0; i<COUNT; i++) m_pickConstraint[i] = NULL; keyPressed(' '); }
//-------------------------------------------------------------- void guiManager::setup(){ ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 200)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); gui.loadFont("fonts/MONACO.TTF", 8); gui.setup("test cv", 0, 0, ofGetWidth(), 700); gui.addPanel("background subtraction example", 4, false); //--------- PANEL 1 gui.setWhichPanel(0); gui.setWhichColumn(0); lister.listDir("videos/"); gui.addFileLister("image lister", &lister, 200, 300); gui.addButtonSlider("Voting time(seconds)", "VOTING_TIME", 30.0, 1.0, 300.0, false); // SETTINGS AND EVENTS // Load from xml! gui.loadSettings("controlPanelSettings.xml"); visible = false; }
//-------------------------------------------------------------- void Therenect::setup() { ofSetWindowTitle("Therenect 0.9.2"); ofSetVerticalSync(true); kinect.init(); kinect.setVerbose(true); kinect.enableDepthNearValueWhite(true); kinect.open(); paused = false; //testImage.loadImage("test2.png"); //testImage.setImageType(OF_IMAGE_GRAYSCALE); depthImage.allocate(kinect.width, kinect.height); controlImage.allocate(kinect.width, kinect.height); position = 165; tiltAngle = 15; kinect.setCameraTiltAngle(tiltAngle); rotX = -5; rotY = -30; sampleRate = 44100; bufferSize = 400; frequency = 0.0f; amplitude = 0.0f; amplset = amplitude; freqset = frequency; range = 75; volumePoint.x = kinect.width/4; volumePoint.y = 4*kinect.height/5; volumePoint.z = position; pitchPoint.x = 2*kinect.width/3; pitchPoint.y = kinect.height/2; pitchPoint.z = position; for (int i=0;i<3;i++) vPointSmoothed[i] = NULL; for (int i=0;i<3;i++) pPointSmoothed[i] = NULL; ofSoundStreamSetup(1,0,this, sampleRate, bufferSize, 2); sound_data = new float[bufferSize]; manually = false; scale = 0; midi_note = 0; midi_on = false; midi_channel = 1; midi.listPorts(); oscmode = 0; drawing = false; ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 200)); gui.setup("Settings", 840, 15, 265, 545); gui.loadSettings("TherenectSettings.xml"); gui.addPanel("", 4, false); gui.setWhichPanel(0); vector <string> wave_names; wave_names.push_back("Theremin"); wave_names.push_back("Sinewave"); wave_names.push_back("Sawtooth"); wave_names.push_back("Squarewave"); gui.addTextDropDown("Waveform", "WAVE", 0, wave_names); gui.addSlider("Frequency Range", "FREQ_RANGE",(range-50)*2, 0.0, 100.0, false); vector <string> scale_names; scale_names.push_back("Continuous"); scale_names.push_back("Chromatic"); scale_names.push_back("Ionian/Major"); scale_names.push_back("Pentatonic"); gui.addTextDropDown("Musical Scale", "SCALE", 0, scale_names); gui.addSlider("Antenna distance", "ANTENNA_DISTANCE", 255-position, 0.0, 255.0, true); gui.addSlider("Kinect angle", "KINECT_ANGLE", 15.0, -32.0, 32.0, true); if (midi.portNames.size()>0) { gui.addToggle("MIDI enabled", "MIDI_ENABLED", midi_on); gui.addTextDropDown("MIDI device", "MIDI_DEVICE", 0, midi.portNames); gui.addSlider("MIDI channel", "MIDI_CHANNEL", 1.0, 1.0, 16.0, true); } else midi_on = false; gui.setupEvents(); gui.enableEvents(); ofAddListener(gui.guiEvent, this, &Therenect::eventsIn); ofSetFrameRate(30); }
void testApp::setupGUI(){ ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 200)); ofxControlPanel::setTextColor(simpleColor(240, 240, 240, 255)); int guiWidth = 800; int guiHeight = 800; gui.setup("Sync", 0, 0, guiWidth, guiHeight, true); // string controlPanelName, float panelX, float panelY, float width, float height, bool doSaveRestore gui.addPanel("Line", 3, false); // name, number of columns, locked gui.addPanel("Tracking", 3, false); // name, number of columns, locked gui.addPanel("App", 3, false); //just doing playback/recording on keyboard for now..... //--------- PANEL 0, Line Variables gui.setWhichPanel("Line"); gui.setWhichColumn(0); gui.addSlider("Length of History", "HISTORY_LENGTH", 100, 2, 200, true); gui.addToggle("Fade History?", "DO_HISTORY_FADE", 1); gui.addSlider("Line scale", "LINE_SCALE", 1.f, 1.f, 1000.f, false); gui.addSlider("Line width", "LINE_WIDTH", 1.f, 1.f, 20.f, false); gui.addSlider("Line alpha", "LINE_ALPHA", 128, 1, 255, true); //--------- PANEL 1, Tracking Variables gui.setWhichPanel("Tracking"); gui.setWhichColumn(0); skeletonDrawer.setTheOpenNI(theOpenNI); //gui.addDrawableRect("Video Image", &theOpenNI->getimageTextureReference(), 320, 240); gui.addCustomRect("Video and skeleton", &skeletonDrawer, 320, 240); gui.addDrawableRect("Depth Image", &theOpenNI->getDepthTextureReference(), 320, 240); gui.setWhichColumn(2); gui.addToggle("All points tracking?", "DISPLAY_ALL_POINTS", 1); gui.addToggle("Hip Line?", "HIP_LINE", 0); gui.addToggle("Shoulder Line?", "SHOULDER_LINE", 0); gui.addToggle("Hands Line", "HANDS_LINE", 0); gui.addToggle("Hip Line to edge?", "HIP_LINE_EDGE", 0); gui.addToggle("Shoulder Line to edge?", "SHOULDER_LINE_EDGE", 0); gui.addToggle("Hands Line to edge", "HANDS_LINE_EDGE", 0); gui.addToggle("All points: vertical lines", "DRAW_VERTICAL_LINES", 0); gui.addToggle("All points: horizontal lines", "DRAW_HORIZONTAL_LINES", 0); gui.addToggle("All points: circles", "DRAW_CIRCLES", 0); gui.addToggle("All points: ribbon ", "DRAW_RIBBON", 0); //--------- PANEL 2, App Variables gui.setWhichPanel("App"); gui.setWhichColumn(0); // gui.addToggle("Live?", "SHOULD_BE_LIVE", 1); // gui.addToggle("Record?", "SHOULD_BE_RECORDING", 0); //some dummy vars we will update to show the variable lister object elapsedTime = ofGetElapsedTimef(); appFrameCount = ofGetFrameNum(); appFrameRate = ofGetFrameRate(); vector <guiVariablePointer> vars; vars.push_back( guiVariablePointer("elapsed time", &elapsedTime, GUI_VAR_FLOAT, 2) ); vars.push_back( guiVariablePointer("elapsed frames", &appFrameCount, GUI_VAR_INT) ); vars.push_back( guiVariablePointer("app fps", &appFrameRate, GUI_VAR_FLOAT, 2) ); vars.push_back( guiVariablePointer("mouse x", &mouseX, GUI_VAR_INT) ); vars.push_back( guiVariablePointer("mouse y", &mouseY, GUI_VAR_INT) ); gui.addVariableLister("app vars", vars); gui.addChartPlotter("App FPS", guiStatVarPointer("app fps", &appFrameRate, GUI_VAR_FLOAT, true, 2), 200, 100, 200, 10, 50); //SETTINGS AND EVENTS //load from xml! gui.loadSettings("controlPanelSettings.xml"); //if you want to use events call this after you have added all your gui elements gui.setupEvents(); gui.enableEvents(); bShowMouse = true; //gui.toggleView(); //show it by default }
//#define TEST_COUNTER //-------------------------------------------------------------- void testApp::setup(){ #ifdef TEST_COUNTER ofSetLogLevel(OF_LOG_SILENT); cout << "Start test Count 10000" << endl; cout << "--------------------------------------------------------------" << endl; for(int i = 0 ; i < 10000 ; i++) { stateMachine.getSharedData().load(); cout << "Count = "<< stateMachine.getSharedData().counter <<endl; stateMachine.getSharedData().counter+=1; stateMachine.getSharedData().save(); } cout << "End test Count 10000" << endl; cout << "--------------------------------------------------------------" << endl; std::exit(0); #endif ofEnableSmoothing(); ofEnableAlphaBlending(); ofSetVerticalSync(true); glDisable(GL_DEPTH_TEST); ofxXmlSettings xml = stateMachine.getSharedData().xml; if(xml.loadFile(settingFileName)) { if(xml.pushTag("DATA")) { stateMachine.getSharedData().bDebug = xml.getValue("DEBUG", true); float width = xml.getValue("WIDTH", 1280); float height = xml.getValue("HEIGHT", 720); sndPlayer.loadSound(xml.getValue("SOUND_PATH", "sounds/Zone 5 - Door Creak, scream and witchly laugh.wav")); sndPlayer.setLoop(true); sndPlayer.play(); stateMachine.getSharedData(). wRatio = width/1920; stateMachine.getSharedData(). hRatio = height/1080; ofSetFullscreen(xml.getValue("FULLSCREEN", 0)); ofSetWindowShape(width, height); stateMachine.getSharedData().path_to_save = xml.getValue("CAPTURE_PATH", "./captures"); stateMachine.getSharedData().filesXml.loadFile(stateMachine.getSharedData().path_to_save+"/files.xml"); if(!stateMachine.getSharedData().filesXml.pushTag("XML")) { stateMachine.getSharedData().filesXml.addTag("XML"); stateMachine.getSharedData().filesXml.pushTag("XML"); } stateMachine.getSharedData().numDigi = xml.getValue("DIGI", 5); stateMachine.getSharedData().font.loadFont(xml.getValue("FONT_PATH", "fonts/LunacyMore.ttf"),xml.getValue("FONT_SIZE", 128)); ofDirectory dir; if(dir.listDir(stateMachine.getSharedData().path_to_save)<1) { dir.createDirectory(stateMachine.getSharedData().path_to_save); } xml.popTag(); } } else { ofLog(OF_LOG_ERROR,"Faile to load "+ settingFileName); } // // setup shared data ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 100)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); stateMachine.getSharedData().panel.setup(ofGetWidth(),ofGetHeight()); stateMachine.getSharedData().panel.loadFont("MONACO.TTF", 8); stateMachine.getSharedData().panel.addPanel("General", 4,false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking", 5, false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking0", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking1", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(70, 70, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceMapEdit", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 100)); //some dummy vars we will update to show the variable lister object appFrameRate = ofGetFrameRate(); stateMachine.getSharedData().panel.setWhichPanel("General"); stateMachine.getSharedData().panel.setWhichColumn(0); stateMachine.getSharedData().panel.addChartPlotter("some chart", guiStatVarPointer("app fps", &appFrameRate, GUI_VAR_FLOAT, true, 2), 200, 50, 200, 5, 80); vector<string> loglevel; loglevel.push_back("OF_LOG_VERBOSE"); loglevel.push_back("OF_LOG_NOTICE"); loglevel.push_back("OF_LOG_WARNING"); loglevel.push_back("OF_LOG_ERROR"); loglevel.push_back("OF_LOG_FATAL_ERROR"); loglevel.push_back("OF_LOG_SILENT"); stateMachine.getSharedData().panel.addTextDropDown("LogLevel","LogLevel", 0, loglevel); // initialise state machine stateMachine.addState(new IndexState()); stateMachine.addState(new SelectPlayerState()); stateMachine.addState(new CaptureState()); stateMachine.addState(new EditState()); stateMachine.addState(new EndState()); stateMachine.addState(new LicenseState()); stateMachine.changeState(xml.getValue("DATA:INIT_STATE", "IndexState")); stateMachine.getSharedData().panel.loadSettings("settings.xml"); stateMachine.getSharedData().panel.hide(); // if(!stateMachine.getSharedData().bDebug) // { //// stateMachine.getSharedData().panel.unregisterKeyboardEvent(); // } stateMachine.getSharedData().numPlayer = 1; for(int i = 0 ; i < NUM_SEQ ;i++) { image[i].loadSequence("images/bat/bat_", "png", 0, 154, 5); image[i].setFrameRate(60); } int num = 3000; stateMachine.getSharedData().p.assign(num, Particle()); resetParticles(); }
//-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(true); ofBackground(0, 0, 0); //audio // 0 output channels, // 2 input channels // 22050 samples per second // 256 samples per buffer // 4 num buffers (latency) ofSoundStreamSetup(0,2,this, 44100, 256, 4); left = new float[256]; right = new float[256]; audioLevel = 0.f; //box2d box2d.init(); box2d.setGravity(0,0); box2d.createBounds(); box2d.setFPS(30); box2d.registerGrabbing(); box2d.createGround();//defaults to the bottom of the screen, nice ofEnableSmoothing(); ofSetFrameRate(30); clearBack = true; ofSetBackgroundAuto(clearBack); // shapeDirLister.setVerbose(false); // shapeDirLister.allowExt("xml"); // int nShapes = shapeDirLister.listDir("shapes"); // // cout << nShapes << " found." << endl; ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 200)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); gui.loadFont("MONACO.TTF", 8); gui.setup("Hellicar&Lewis Norwegian Wood Audio Reactive Projection", 0, 0, ofGetWidth(), 700); gui.addPanel("Basic Settings", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 200)); //--------- PANEL 1 gui.setWhichPanel(0); gui.setWhichColumn(0); //some dummy vars we will update to show the variable lister object elapsedTime = ofGetElapsedTimef(); appFrameCount = ofGetFrameNum(); appFrameRate = ofGetFrameRate(); vector <guiVariablePointer> vars; vars.push_back( guiVariablePointer("ellapsed time", &elapsedTime, GUI_VAR_FLOAT, 2) ); vars.push_back( guiVariablePointer("ellapsed frames", &appFrameCount, GUI_VAR_INT) ); vars.push_back( guiVariablePointer("app fps", &appFrameRate, GUI_VAR_FLOAT, 2) ); vars.push_back( guiVariablePointer("mouse x", &mouseX, GUI_VAR_INT) ); vars.push_back( guiVariablePointer("mouse y", &mouseY, GUI_VAR_INT) ); gui.addVariableLister("app vars", vars); gui.addChartPlotter("Audio level", guiStatVarPointer("Audio Level", &audioLevel, GUI_VAR_FLOAT, true, 2), 200, 100, 200, 0.f, 1.f); gui.addSlider("Audio Cut Down", "AUDIO_CUT_DOWN", 0.1f, 0.f,1.f, false); gui.addSlider("Audio Cut Up", "AUDIO_CUT_UP", 0.9f, 0.f,1.f, false); gui.addSlider("Audio Boost ", "AUDIO_BOOST", 0.0f, 0.f,1.f, false); timeOfLastFrame = ofGetElapsedTimef(); bShowMouse = false; ofHideCursor(); loadPolyShapeFromXML("shapes/blossom.xml"); loadPolyShapeFromXML("shapes/leaf.xml"); //now the scenes spring.setup("Spring", &gui, &box2d, polyShapes[0]); summer.setup("Summer", &gui, &box2d); autumn.setup("Autumn", &gui, &box2d, polyShapes[1]); winter.setup("Winter", &gui, &box2d); currentScene = &spring; spring.init(); //SETTINGS AND EVENTS //load from xml! gui.loadSettings("controlPanelSettings.xml"); //if you want to use events call this after you have added all your gui elements gui.setupEvents(); gui.enableEvents(); gui.hide(); }
//-------------------------------------------------------------- void testApp::setup(){ //changed for version control test camHeight=48023434; showGraphLine=false; //switch for controlling all analysis etc V important variable menuState=0; //some change camWidth=640; camHeight=480; desFrameRate=-111;// the camera framerate //set gui defaults moved to start of setup because we need these values to set sliders in gui masterAnalysis.setGUIDefaults(); //ofSetFrameRate(60); // this produces 10 or 11 frames of latency frames in the camera feed //30/12/11 added this as a variable becuase we will need it to calculate maxNumberOfFramesForSynthesis from guiSecs later frameRateWeSet=30; ofSetFrameRate(frameRateWeSet); // this produces 5 or 6 frames of latency frames in the camera feed //ofSetFrameRate(15); // this produces 2 or 3 frames of latency frames in the camera feed //ofSetFrameRate(5); // this produces or 1 or 2 frames of latency //ofSetFrameRate(1); // this produces? i'm not patient enough to figure this out... // i.e.: the frame lag seems to be ofGetFrameRate()/6 or thereabouts. ofEnableSmoothing(); ofSetVerticalSync(TRUE); //set default codec codecChooser=0; if (!mainFileHelper.doesDirectoryExist("IMAGES/")){ mainFileHelper.makeDirectory("IMAGES/"); } //default location locationChooser="MIDDLESBROUGH"; // //default analysis analysisChooser="H_SHADOWSCAPES"; //its easier to initialise the camera with default settings than mess around with bad access errors when you try and draw it;( setupCamera(camWidth, camHeight, 2, 120,true); //set initial report camStatus="Camera not setup"; // //WHY say this if we've just set up the camera? keyControlMessage1="Use 1-9 & q+w+e+r to launch the analyses"; keyControlMessage2="'c'-cursor 'v'-video input\n'f'-fullscreen 'g'-gui 'z'-to start"; font.loadFont("MONACO.TTF", 10); //AT the moment - this WILL COMPILE for 10.5 if we remove the below image loaders - problem with POCO library - see here: // http://forum.openframeworks.cc/index.php?topic=6351.0 startImage.loadImage("resourceimages/refractiveindexstart.jpg"); endImage.loadImage("resourceimages/refractiveindexend.jpg"); /* compiling for 10.5 - we get a bunch of POCO errors SOLUTION: http://forum.openframeworks.cc/index.php?topic=6351.0 https://github.com/openframeworks/openFrameworks/issues/387 http://forum.openframeworks.cc/index.php?topic=7549.0 following error appears when i try to load an image; commenting out the call to loadImage("...") makes the error go away. Undefined symbols: "std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)", referenced from: Poco::Net::HTTPClientSession::proxyAuthenticateImpl(Poco::Net::HTTPRequest&)in PocoNet.a(HTTPClientSession.o) Poco::Net::HTTPClientSession::proxyAuthenticateImpl(Poco::Net::HTTPRequest&)in PocoNet.a(HTTPClientSession.o) Poco::Net::HTTPRequest::write(std::basic_ostream<char, std::char_traits<char> >&) constin PocoNet.a(HTTPRequest.o) Poco::Net::HTTPRequest::write(std::basic_ostream<char, std::char_traits<char> >&) constin PocoNet.a(HTTPRequest.o) Poco::Net::HTTPRequest::write(std::basic_ostream<char, std::char_traits<char> >&) constin PocoNet.a(HTTPRequest.o) Poco::Net::MessageHeader::write(std::basic_ostream<char, std::char_traits<char> >&) constin PocoNet.a(MessageHeader.o) Poco::Net::MessageHeader::write(std::basic_ostream<char, std::char_traits<char> >&) constin PocoNet.a(MessageHeader.o) Poco::Net::HTTPResponse::write(std::basic_ostream<char, std::char_traits<char> >&) constin PocoNet.a(HTTPResponse.o) Poco::Net::HTTPResponse::write(std::basic_ostream<char, std::char_traits<char> >&) constin PocoNet.a(HTTPResponse.o) ld: symbol(s) not found */ showGui=FALSE; showCursor=FALSE; showCameraInput=FALSE; //talk to me about your troubles openframeworks ofSetLogLevel(OF_LOG_VERBOSE); ////////////GUI SETUP STUFF//////////////// // RI PURPLE #716e88 = 113, 110, 136 ofxControlPanel::setBackgroundColor(simpleColor(113, 110, 136, 200)); ofxControlPanel::setTextColor(simpleColor(255, 255, 255, 255)); ofxControlPanel::setOutlineColor(simpleColor(255, 255, 255, 255)); ofxControlPanel::setForegroundColor(simpleColor(50, 50, 50, 255)); // gui.loadFont("MONACO.TTF", 8); gui.setup("Refractive Index", 0, 0, ofGetWidth(), ofGetHeight()); //FIRST PANEL HOLDS CAMERA CONTROLS gui.addPanel("Camera Settings", 4, false); gui.setWhichPanel(0); gui.setWhichColumn(0); gui.addToggle("set up camera input", "CAM_IS_GO", 0); gui.addButtonSlider("camera width", "CAM_WIDTH", camWidth, 1.0, 1920, true); gui.addButtonSlider("camera height", "CAM_HEIGHT", camHeight, 1.0, 1080, true); gui.addButtonSlider("desired frame rate", "FRAME_RATE", 1., 1.0, 30, true); gui.setWhichColumn(1); gui.addTextInput("text message", "input text here", 250 ); //GET THE INPUT NAMES FROM THE QT VIDEO GRABBER vidGrabber.listDevices(); gui.addToggle("more cam settings", "SETTINGS", 0); //A NEW PANEL //removed by Tom 27/12/11 // gui.addPanel("Analyses", 4, false); gui.setWhichPanel(0); gui.setWhichColumn(1); vector<string>locationNames; locationNames.push_back("MIDDLESBROUGH"); locationNames.push_back("BRADFORD"); locationNames.push_back("BIRMINGHAM"); locationNames.push_back("SWANSEA"); locationNames.push_back("BRISTOL"); locationNames.push_back("WOOLWICH"); locationNames.push_back("DOVER"); locationNames.push_back("BELFAST"); locationNames.push_back("EDINRBURGH"); locationNames.push_back("MANCHESTER"); locationNames.push_back("LIVERPOOL"); gui.addTextDropDown("location", "LOCATION", 130, locationNames); gui.setWhichColumn(2); //will handle which analysis we are doing this time //TomS 22.11.11 vector<string>analysisNames; moved to h file - this needs to be global as its now used to get the panel number when switching panel in the gui event analysisNames.push_back("H_SHADOWSCAPES"); analysisNames.push_back("V_SHADOWSCAPES"); analysisNames.push_back("D_SHADOWSCAPES"); analysisNames.push_back("RELAXRATE"); analysisNames.push_back("I_RESPONSE"); analysisNames.push_back("SHAPE_SHADING"); analysisNames.push_back("M_CODE"); analysisNames.push_back("CAM_FRAMERATE"); analysisNames.push_back("CAM_NOISE"); analysisNames.push_back("COLOR_SINGLE"); analysisNames.push_back("LATENCY_TEST"); analysisNames.push_back("COLOR_MULTI"); analysisNames.push_back("DIFF_NOISE"); gui.addTextDropDown("choose analysis", "ANALYSIS_TYPE", 130, analysisNames); gui.setWhichColumn(3); /* float maxResultA; float maxNumberOfFramesForSynthesis; float divisionsA; bool showGraphA;*/ //////ADD ONE PANEL FOR EACH ANALYSIS///// --> why did you do this again? i.e.: why not have one Panel with a row of parameters for each analysis? so much clicking :P JA for(int i = 0;i< analysisNames.size();i++){ gui.addPanel(analysisNames[i], 4, false); } ///TOM 21/11/11 NOW SETTING THE CORRECT GUI ELEMENTS FOR EACH ANALYSIS, PAINFULLY, ONE BY ONE ///Note counterMax in the analysis class seem to do exactly the same job as maxNumberOfFramesForSynthesis which is currently connected to gui, show we merge these variables? //This is a good effeciency, but there's a need for the default values for each of these to be different, and if one gets changed, we don't want the rest of them to have the value of that one... so is there another way to deal with it that is both efficient and allows each analysis to 'keep its state'? - JA 11 Dec //local variable for setting gui from numberofframestolastfor float maxFramesDividedByFrameRate = masterAnalysis.maxNumberOfFramesForSynthesis/frameRateWeSet; //addButtonSlider(string sliderName, string xmlName, float value , float min, float max, bool isInt); //H_SHADOWSCAPES GUI OPTIONS gui.setWhichPanel(1); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); gui.addButtonSlider("scan line width", "SCAN_LINE_WIDTH", masterAnalysis.scanLineWidth, 1, ofGetWidth(), TRUE); gui.addButtonSlider("scan line speed", "SCAN_LINE_SPEED", masterAnalysis.scanLineSpeed, 1, 100, TRUE); //V_SHADOWSCAPES GUI OPTIONS gui.setWhichPanel(2); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); gui.addButtonSlider("scan line width", "SCAN_LINE_WIDTH", masterAnalysis.scanLineWidth, 1, ofGetHeight(), TRUE); gui.addButtonSlider("scan line speed", "SCAN_LINE_SPEED", masterAnalysis.scanLineSpeed, 1, 100, TRUE); //D_SHADOWSCAPES GUI OPTIONS gui.setWhichPanel(3); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); gui.addButtonSlider("scan line width", "SCAN_LINE_WIDTH", masterAnalysis.scanLineWidth, 1, 200, TRUE); gui.addButtonSlider("scan line speed", "SCAN_LINE_SPEED", masterAnalysis.scanLineSpeed, 1, 100, TRUE); //RELAXRATE GUI OPTIONS gui.setWhichPanel(4); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); gui.addButtonSlider("max white level to ramp to", "GRAPH_MAX_RESULT", masterAnalysis.maxResultA, 1, 255, TRUE); gui.addButtonSlider("num of seconds to last for", "GRAPH_MAX_TIME", maxFramesDividedByFrameRate, 1, 50, TRUE); gui.addButtonSlider("num of impulses", "GRAPH_NUM_DIVISIONS", masterAnalysis.divisionsA, 1, 10, TRUE); gui.addToggle("show graph outlines", "SHOW_GRAPH_OUTLINE", masterAnalysis.showGraphA); vector<string>graphNames; graphNames.push_back("LINEAR"); graphNames.push_back("EXPONENTIAL"); graphNames.push_back("SQUARE_WAVE"); graphNames.push_back("QUADRATIC"); gui.addTextDropDown("RELAXRATE response curve", "GRAPH_TYPE", 130, graphNames); /* //for colour multi fadeTime = 20; everyNthFrameCaptureImage = 20; //the lower this number the more camera images we get per white level shown numberOfGreyLevels = 10; //the number of grey levels we want to look at currentGreyLevel = numberOfGreyLevels;*/ //I_RESPONSE GUI OPTIONS gui.setWhichPanel(5); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); gui.addButtonSlider("num of seconds to last for", "GRAPH_MAX_TIME", maxFramesDividedByFrameRate, 1, 50, TRUE); gui.addButtonSlider("number of grey levels", "ANIMATION_TIME_LIMIT", masterAnalysis.numberOfGreyLevels, 1, 20, TRUE); gui.addButtonSlider("fadeTime", "ANIMATION_TIME_LIMIT", masterAnalysis.fadeTime, 1, 30, TRUE); gui.addButtonSlider("number of frames to grab", "ANIMATION_TIME_LIMIT", masterAnalysis.numOfFramesToGrab, 1, 500, TRUE); //SHAPE_SHADING GUI OPTIONS gui.setWhichPanel(6); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); gui.addButtonSlider("num of seconds to last for", "GRAPH_MAX_TIME", maxFramesDividedByFrameRate, 1, 50, TRUE); gui.addButtonSlider("num of frames to grab per quadrant", "fpq", masterAnalysis.framesPerQuadrant , 1, 150, TRUE); //M_CODE GUI OPTIONS gui.setWhichPanel(7); gui.setWhichColumn(0); gui.addButtonSlider("morse pause time", "MORSE_SPEED", masterAnalysis.speed, 1, 25, TRUE); //gui.addTextInput("morse output", "input morse here", 250 ); //nasty hack for getting text back tl=gui.addTextInput("morse output", "USE_UNDERSCORES_AND_CAPS", 250 ); gui.addToggle("GO", "GO", 0); //CAM_FRAMERATE GUI OPTIONS gui.setWhichPanel(8); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); //CAM_NOISE GUI OPTIONS gui.setWhichPanel(9); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); //COLOR_SINGLE GUI OPTIONS gui.setWhichPanel(10); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); //LATENCY_TEST GUI OPTIONS gui.setWhichPanel(11); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); //COLOR_MULTI GUI OPTIONS gui.setWhichPanel(12); cout<<gui.getWhichPanel()<<" whichPanel \n"; gui.setWhichColumn(0); gui.addButtonSlider("color multi overall length", "COLORMULTI_SPEED", masterAnalysis.counterMaxColorMulti, 1, 2000, TRUE); gui.addToggle("GO", "GO", 0); //Tom S 21.11.11 colour multi now fades through the whole spectrum so doesn't need these any more //gui.addButtonSlider("red level", "RED_LEVEL", 10, 1, 255, TRUE); //gui.addButtonSlider("green level", "GREEN_LEVEL", 10, 1, 255, TRUE); //gui.addButtonSlider("blue level", "BLUE_LEVEL", 10, 1, 255, TRUE); //DIFF_NOISE GUI OPTIONS gui.setWhichPanel(13); gui.setWhichColumn(0); gui.addToggle("GO", "GO", 0); gui.setWhichPanel(0); gui.setWhichColumn(1); vector<string> names=vidGrabber.returnDeviceNames(); cout<<names.size()<<" number of inputs found\n"; // masterAnalysis.setupAnalysis(camWidth, camHeight, 100, analysisChooser, locationChooser, codecChooser);//, vidGrabber); //get list of codecs from movie object in analysis class returnedCodecNames=masterAnalysis.movieFromCamera.returnCodecNames(); //CURRENTLY UNUSED cout<<names[names.size()-1]<<" names at 2\n"; gui.addTextDropDown("inputs", "INPUTS", 130, names); gui.setWhichColumn(2); gui.addTextDropDown("codecs", "CODECS", 130, returnedCodecNames); //dont forget to actually set this stuff in action! gui.setupEvents(); gui.enableEvents(); // -- this gives you back an ofEvent for all events in this control panel object ofAddListener(gui.guiEvent, this, &testApp::eventsIn); ////////////END OF GUI SETUP STUFF//////////////// currentPanel=gui.getSelectedPanel(); /* */ }
* Copyright (c) 2012-2013 Agnes Chavez and Alessandro Saccoia * Written by Alessandro Saccoia, <*****@*****.**> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Sotware. */ ofxControlPanel::setBackgroundColor(simpleColor(0, 0, 0, 255)); ofxControlPanel::setTextColor(simpleColor(255, 255, 255, 255)); controlPanel.defaultConfigurationDirectory = "configurations/"; int panelNr = 0; controlPanel.addPanel("General settings", 4, false); controlPanel.setWhichPanel(panelNr++); /* controlPanel.setWhichColumn(0); controlPanel.addLabel("Configuration file"); m_configurationLister.listDir("configurations/");
//-------------------------------------------------------------- void testApp::setup(){ ofEnableAlphaBlending(); ofxXmlSettings xml = stateMachine.getSharedData().xml; if(xml.loadFile(settingFileName)) { if(xml.pushTag("DATA")) { stateMachine.getSharedData().counter = xml.getValue("COUNTER", 0); stateMachine.getSharedData().path_to_save = xml.getValue("CAPTURE_PATH", "./captures"); stateMachine.getSharedData().numDigi = xml.getValue("DIGI", 5); ofDirectory dir; if(dir.listDir(stateMachine.getSharedData().path_to_save)<1) { dir.createDirectory(stateMachine.getSharedData().path_to_save); } xml.popTag(); } } else { ofLog(OF_LOG_ERROR,"Faile to load "+ settingFileName); } // // setup shared data ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 100)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); stateMachine.getSharedData().panel.setup(ofGetWidth(),ofGetHeight()); stateMachine.getSharedData().panel.loadFont("MONACO.TTF", 8); stateMachine.getSharedData().panel.addPanel("General", 4,false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking", 5, false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking0", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceTracking1", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(70, 70, 30, 100)); stateMachine.getSharedData().panel.addPanel("FaceMapEdit", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 100)); //some dummy vars we will update to show the variable lister object appFrameRate = ofGetFrameRate(); stateMachine.getSharedData().panel.setWhichPanel("General"); stateMachine.getSharedData().panel.setWhichColumn(0); stateMachine.getSharedData().panel.addChartPlotter("some chart", guiStatVarPointer("app fps", &appFrameRate, GUI_VAR_FLOAT, true, 2), 200, 50, 200, 5, 80); vector<string> loglevel; loglevel.push_back("OF_LOG_VERBOSE"); loglevel.push_back("OF_LOG_NOTICE"); loglevel.push_back("OF_LOG_WARNING"); loglevel.push_back("OF_LOG_ERROR"); loglevel.push_back("OF_LOG_FATAL_ERROR"); loglevel.push_back("OF_LOG_SILENT"); stateMachine.getSharedData().panel.addTextDropDown("LogLevel","LogLevel", 0, loglevel); // initialise state machine stateMachine.addState(new IndexState()); stateMachine.addState(new SelectPlayerState()); stateMachine.addState(new PlayState()); stateMachine.addState(new EditState()); stateMachine.changeState("PlayState"); stateMachine.getSharedData().panel.loadSettings("settings.xml"); stateMachine.getSharedData().panel.hide(); stateMachine.getSharedData().numPlayer = 2; }
//-------------------------------------------------------- void captureApp::setup(){ ofSetLogLevel(OF_LOG_NOTICE); serial.enumerateDevices(); ofxXmlSettings serialSetup; serialSetup.loadFile("serialSettings.xml"); string serialPort = serialSetup.getValue("serialPort", ""); serial.setup(serialPort, 9600); // < this should be set // to whatever com port // your serial device is // connected to. // (ie, COM4 on a pc, dev/tty.... on a mac) // arduino users check in arduino app.... serial.flush(); state = CAP_STATE_WAITING; debugState = CAP_NORMAL; camState = CAMERA_CLOSED; prevCamState = CAMERA_CLOSED; preCamMode = 0; cameraFrameNum = 0; sdk = NULL; settings = NULL; timeToEndCapture = 0.0; bNeedsToLeaveFrame = false; bOscSetup = false; fadeInStartTime = 0.0; spotLightAlpha = 1.0; bDoThreadedRSync = false; bDoThreadedFrameSave = false; camera3D.disableMouseEvents(); if( !ofxFileHelper::doesFileExist(CAPTURE_MAIN_FOLDER) ){ printf("making folder %s\n", CAPTURE_MAIN_FOLDER.c_str()); ofxFileHelper::makeDirectory(CAPTURE_MAIN_FOLDER); } if( !ofxFileHelper::doesFileExist(EXPORT_FOLDER) ){ printf("making folder %s\n", EXPORT_FOLDER.c_str()); ofxFileHelper::makeDirectory(EXPORT_FOLDER); if( !ofxFileHelper::doesFileExist(DECODE_FOLDER) ){ ofxFileHelper::makeDirectory(DECODE_FOLDER); } } ofxXmlSettings xml; xml.loadFile("locationSettings.xml"); currentCity = xml.getValue("city_name", "NYC"); transformSpaces(currentCity); //remove space and add underscores currentDecodePath = DECODE_FOLDER; currentCaptureFolder = string(CAPTURE_MAIN_FOLDER) + FRAME_CAPTURE_FOLDER; currentTimestamp = (ofxTimeStamp()).getUnixTimeAsString(); // setup panel panel.setup("control", 0, 0, 300, 768); panel.setBackgroundColor(simpleColor(10, 10, 10, 0)); //panel.loadFont("resources/myFont.ttf", 9); panel.addPanel("app/capture settings", 1); panel.addPanel("app settings", 1); panel.addPanel("face trigger settings", 1); panel.addPanel("pattern settings", 1); panel.addPanel("misc settings", 1); panel.setWhichPanel("app/capture settings"); panel.addToggle("use face trigger", "B_FACE_TRIGGER", false); vector <string> camModes; camModes.push_back("camera off"); camModes.push_back("camera qt"); camModes.push_back("camera dc1394"); panel.addMultiToggle("camera mode", "camMode", 0, camModes); panel.addToggle("camera settings", "cameraSettings", false); panel.addToggle("overide light", "bOverideLight", true); panel.addToggle("show red clipping", "SHOW_RED", true); panel.addToggle("fullscreen", "fullscreen", false); panel.addToggle("spot light image", "bSpotLight", true); panel.addSlider("spotlight %", "spotLightBrightness", 1.0, 0.0, 1.0, false); panel.addToggle("frame by frame", "frameByFrame", false); panel.addToggle("large video", "largeVideo", false); panel.addSlider("min brightness", "minBrightness", 0, 0, 255, true); panel.addSlider("max brightness", "maxBrightness", 255, 0, 255, true); panel.addSlider("3 phase - wavelength", "wavelength", 64, 8, 512, true); panel.addToggle("use projector lut", "projectorLut", false); panel.setWhichPanel("app settings"); panel.addSlider("fade in time", "fadeInTime", 2.0, 0.0, 5.0, false); vector<string> postCapModes; postCapModes.push_back("save frames"); postCapModes.push_back("decode and frames"); postCapModes.push_back("decode, export and frames"); postCapModes.push_back("all above + notify"); panel.addMultiToggle("post capture:", "postCapture", 2, postCapModes); panel.addToggle("notify with osc", "use_osc", false); panel.addSlider("decode skip frames", "decodeSkipFrame", 2, 0, 5, true); panel.addSlider("capture time f", "CAPTURE_TIME_F", 4.0, 2.0, 15.0, false); panel.setWhichPanel("pattern settings"); panel.addSlider("pattern rate", "patternRate", 1, 1, 6, true); panel.addSlider("camera rate", "cameraRate", 1, 1, 6, true); panel.addSlider("camera offset", "cameraOffset", 0, 0, 5, true); panel.addToggle("reverse", "reverse", false); vector<string> orientations; orientations.push_back("vertical"); orientations.push_back("horizonal"); panel.addMultiToggle("orientation", "orientation", 0, orientations); panel.setWhichPanel("face trigger settings"); panel.addSlider("face trigger fps", "FACE_FPS", 10, 3, 30, false); panel.addSlider("face detected time", "FACE_DETECT_TIME", 2.0, 0.1, 10.0, false); panel.addSlider("face forget time", "FACE_FORGET_TIME", 2.0, 0.1, 10.0, false); guiStatVarPointer varPtr; varPtr.setup("num faces", &face.numFaces, GUI_VAR_INT, true); panel.addChartPlotter("num faces", varPtr, 240, 60, 240, -1, 3); panel.addChartPlotter("face confidence", guiStatVarPointer("confidence", &face.confidence, GUI_VAR_FLOAT, true, 2), 240, 70, 240, -0.2, 1.2); panel.addDrawableRect("state", &face, 240, 40); panel.addSlider("confidence add amnt", "confidence_add", 0.1, 0.05, 1.0, false); panel.addSlider("confidence fade amnt", "confidence_fade", 0.95, 0.8, 0.995, false); panel.addSlider("confidence gate start val", "confidence_gate_start", 0.65, 0.15, 1.0, false); panel.addSlider("confidence gate stop val", "confidence_gate_stop", 0.4, 0.0, 1.0, false); panel.setWhichPanel("misc settings"); panel.addToggle("brightness setting", "brightnessSetting", false); panel.addSlider("check brigheness", "checkBrightness", 0, 0, 255, true); panel.addToggle("delete after transfer", "bDeleteAfterSend", false); panel.addToggle("restart at 3.00am", "bRestart", false); panel.addSlider("restart hour", "restartHour", 3, 1, 23, true); panel.addSlider("restart minute", "restartMinute", 0, 0, 59, true); panel.loadSettings("controlCapture.xml"); if( panel.getValueB("use_osc") ){ setupOsc(); } //overides //panel.setValueI("camMode", 0); panel.setValueI("fullscreen", 1); panel.setValueI("cameraSettings", 0); panel.setValueI("frameByFrame", 0); panel.setValueI("largeVideo", 0); panel.setValueI("brightnessSetting",0); panel.setValueI("bOverideLight",0); panel.setValueI("bSpotLight", 1); cameraWidth = 640; cameraHeight = 480; int n = 3; // no patterns have more than 3 frames for(int i = 0; i < n; i++) { recent.push_back(ofImage()); recent.back().allocate( cameraWidth, cameraHeight, OF_IMAGE_COLOR); needsUpdate.push_back(false); } curGenerator = &threePhase; int captureTime = 15; imageSaver.setup(cameraWidth, cameraHeight, captureTime * 60); ofSetVerticalSync(true); ofSetFrameRate(60); ofBackground(0, 0, 0); scanningSound.loadSound("resources/scanningPlaceholder.mp3"); scanningSound.setLoop(true); spotLightImage.loadImage("resources/captureMask.jpg"); generateSpotlight(spotLightImage); spotLightImage.setAnchorPercent(0.5, 0.5); face.setup("faceHaar/haarcascade_frontalface_alt.xml", 320, 240, 2.0, 2.0); prevFaceCheckTimeF = ofGetElapsedTimef(); threePhase.setSize(1024, 768); updateGenerator(); light.setup(0); }
//-------------------------------------------------------------- void testApp::setup(){ // load the settings settings.loadSettings("AppSettings.xml"); ofBackground(255,255,255); // 0 output channels, // 2 input channels // 22050 samples per second // 256 samples per buffer // 4 num buffers (latency) // ofSoundStreamSetup(0,2,this, 44100, 256, 4); // left = new float[256]; // right = new float[256]; // // // bufferCounter = 0; // drawCounter = 0; channelAIcon.allocate(640, 480, OF_IMAGE_COLOR); channelBIcon.allocate(640, 480, OF_IMAGE_COLOR); channelASource.allocate(640, 480, OF_IMAGE_COLOR); channelBSource.allocate(640, 480, OF_IMAGE_COLOR); mixResult.allocate(640, 480, OF_IMAGE_COLOR); channelAImages.resize(0); channelBImages.resize(0); //control panel // grabber.initGrabber(320, 240); // // motion.setup(grabber.width, grabber.height); // bgExample.setup(grabber.width, grabber.height); // w // camDraw.setup(&motion.gray, &motion.motionField); // threshDraw.setup(&motion.motion, &motion.motionField); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 200)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); gui.loadFont("MONACO.TTF", 8); gui.setup("LOUD TATE 2010 - Jammer vs. Hellicar&Lewis vs. Workshop Team", 0, 0, 900, 800); gui.addPanel("Select Image Folders and Mix", 4, false); // ofxControlPanel::setBackgroundColor(simpleColor(60, 30, 30, 200)); // gui.addPanel("Camera Background", 4, false); // // ofxControlPanel::setBackgroundColor(simpleColor(70, 70, 30, 200)); // gui.addPanel("Camera Average Motion", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 200)); //--------- PANEL 1 gui.setWhichPanel(0); gui.setWhichColumn(0); gui.addDrawableRect("Channel A", &channelASource, 200, 150); listerChannelA.listDir("images/"); gui.addFileLister("Channel A Images", &listerChannelA, 200, 300); vector <string> drawModeNames; drawModeNames.push_back("select on level"); drawModeNames.push_back("next image on peak"); drawModeNames.push_back("next image unless peak"); drawModeNames.push_back("next image on space"); gui.addTextDropDown("draw mode", "DRAW_MODE_A", 0, drawModeNames); gui.setWhichColumn(1); gui.addSlider("Mix", "MIX", 0.f, 0.f, 1.f, false); gui.addDrawableRect("Output", &mixResult, 200, 150); gui.setWhichColumn(2); gui.addDrawableRect("Channel B", &channelBSource, 200, 150); listerChannelB.listDir("images/"); gui.addFileLister("Channel B Images", &listerChannelB, 200, 300); gui.addTextDropDown("draw mode", "DRAW_MODE_B", 0, drawModeNames); gui.setWhichColumn(3); gui.addSlider("minium audio level", "AUDIO_MIN", 0.01f, 0.f, 0.1f, false); gui.addSlider("maximum audio level", "AUDIO_MAX", 0.05f, 0.f, 0.3f, false); gui.addSlider("audio decay rate", "AUDIO_DECAY", 0.95f, 0.7f, 1.f, false); gui.addSlider("manual audio level", "AUDIO_MANUAL_LEVEL", 0.f, 0.f, 1.f, false); gui.addSlider("trigger audio level", "AUDIO_TRIGGER_LEVEL", 0.5f, 0.f, 1.f, false); gui.addToggle("Brightness on Audio?", "AUDIO_BRIGHTNESS_ON_LEVEL", 0); gui.addToggle("Scale on Audio?", "AUDIO_SCALE_ON_LEVEL", 0); vector <string> audioModeNames; audioModeNames.push_back("normal audio"); audioModeNames.push_back("decay audio"); audioModeNames.push_back("manual audio"); gui.addTextDropDown("audio mode", "AUDIO_MODE", 0, audioModeNames); // //--------- PANEL 2 // gui.setWhichPanel(1); // // gui.setWhichColumn(0); // gui.addDrawableRect("video", &bgExample.gray, 200, 150); // // gui.setWhichColumn(1); // gui.addDrawableRect("background", &bgExample.background, 200, 150); // // gui.setWhichColumn(2); // gui.addDrawableRect("thresholded image", &bgExample.thresh, 200, 150); // // gui.setWhichColumn(3); // gui.addToggle("grab background", "GRAB_BACKGROUND", 0); // // gui.addButtonSlider("threshold", "BG_THRESHOLD", 29.0, 1.0, 255.0, false); // // //some dummy vars we will update to show the variable lister object // elapsedTime = ofGetElapsedTimef(); // appFrameCount = ofGetFrameNum(); // appFrameRate = ofGetFrameRate(); // // vector <guiVariablePointer> vars; // vars.push_back( guiVariablePointer("elapsed time", &elapsedTime, GUI_VAR_FLOAT, 2) ); // vars.push_back( guiVariablePointer("elapsed frames", &appFrameCount, GUI_VAR_INT) ); // vars.push_back( guiVariablePointer("app fps", &appFrameRate, GUI_VAR_FLOAT, 2) ); // // vars.push_back( guiVariablePointer("mouse x", &mouseX, GUI_VAR_INT) ); // vars.push_back( guiVariablePointer("mouse y", &mouseY, GUI_VAR_INT) ); // // gui.addVariableLister("app vars", vars); // // gui.addChartPlotter("some chart", guiStatVarPointer("app fps", &appFrameRate, GUI_VAR_FLOAT, true, 2), 200, 100, 200, 40, 80); // // vector <string> names; // names.push_back("abs diff"); // names.push_back("greater than"); // names.push_back("less than"); // gui.addTextDropDown("difference mode", "DIFF_MODE", 0, names); //--------- PANEL 3 // gui.setWhichPanel(2); // // gui.setWhichColumn(0); // gui.addDrawableRect("video and motion", &camDraw, 200, 150); // // gui.setWhichColumn(1); // gui.addDrawableRect("motion diff", &threshDraw, 200, 150); // // gui.setWhichColumn(2); // stats.setDrawScale(2000.0); // gui.addDrawableRect("average motion", &stats, 200, 150); // // gui.setWhichColumn(3); // gui.addSlider("motion threshold", "MOTION_THRESHOLD", 29.0, 1.0, 255.0, false); // gui.addSlider("motion fade amnt", "MOTION_FADE", 0.67, 0.0, 1.0, false); // gui.addSlider("field draw scale", "FIELD_DRAW_SCALE", 1.0, 1.0, 10.0, false); //SETTINGS AND EVENTS //load from xml! gui.loadSettings("controlPanelSettings.xml"); //if you want to use events call this after you have added all your gui elements gui.setupEvents(); gui.enableEvents(); // -- SPECIFIC EVENTS -- this approach creates an event group and only sends you events for the elements you describe. // vector <string> list; // list.push_back("FIELD_DRAW_SCALE"); // list.push_back("DIFF_MODE"); // gui.createEventGroup("TEST_GROUP", list); // ofAddListener(gui.getEventGroup("TEST_GROUP"), this, &testApp::eventsIn); // -- PANEL EVENTS -- this approach gives you back an ofEvent for only the events from panel 0 // ofAddListener(gui.getEventsForPanel(0), this, &testApp::eventsIn); // -- this gives you back an ofEvent for all events in this control panel object ofAddListener(gui.guiEvent, this, &testApp::eventsIn); // --EVENT FOR SINGLE GUI OBJECT // ofAddListener(gui.createEventGroup("GRAB_BACKGROUND"), this, &testApp::grabBackgroundEvent); //from avsys/analysis2/aubioExample // 0 output channels, // 2 input channels // 44100 samples per second // 256 samples per buffer // 4 num buffers (latency) //setup of sound input ofSoundStreamSetup(0, 2, this, 44100, BUFFER_SIZE, 4); pitchAmplitudeLeft = new float[BUFFER_SIZE]; pitchAmplitudeRight = new float[BUFFER_SIZE]; FFTLeft = new float[BUFFER_SIZE]; FFTRight = new float[BUFFER_SIZE]; AA.setup(); // dinFont.loadFont("DIN.otf", 50); //from avsys/analysis2/fft // 0 output channels, // 2 input channels // 44100 samples per second // BUFFER_SIZE samples per buffer // 4 num buffers (latency) // ofSoundStreamSetup(0,2,this, 44100, BUFFER_SIZE, 4); // // left = new float[BUFFER_SIZE]; // right = new float[BUFFER_SIZE]; ofSetColor(0x666666); FFTanalyzer.setup(44100, BUFFER_SIZE/2, 2); FFTanalyzer.peakHoldTime = 15; // hold longer FFTanalyzer.peakDecayRate = 0.95f; // decay slower FFTanalyzer.linearEQIntercept = 0.9f; // reduced gain at lowest frequency FFTanalyzer.linearEQSlope = 0.01f; // increasing gain at higher frequencies //ofSetFrameRate(60); decayedAudioLevel = 0.f; loudestAudioLevelRecieved = 0.f; currentChannelAIndex = 0; currentChannelBIndex = 0; spaceDown = false; }
//-------------------------------------------------------------------------- void testApp::setupControlPanel(){ ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 200)); ofxControlPanel::setTextColor(simpleColor(80, 240, 240, 255)); panel.setup("controls", 0, 0, 300, 750); panel.addPanel("general controls", 4, false); panel.addPanel("animation controls", 4, false); panel.addPanel("render controls", 4, false); panel.addPanel("camera params", 4, false); panel.addPanel("debug params", 4, false); //--------- general params panel.setWhichPanel("general controls"); panel.setWhichColumn(0); panel.addToggle("export screenshots", "exportScreenshots", false); panel.addToggle("convert to png after load", "bConvertToPng", false); panel.addToggle("auto change face", "bAutoChange", false); panel.addSlider("change face time", "changeTime", 28.2, 8.0, 60.0, false); panel.addChartPlotter("fps", guiStatVarPointer("app fps", &appFps, GUI_VAR_FLOAT, true, 2), 200, 80, 200, 8, 100); panel.addToggle("restart at 3.00am", "bRestart", false); panel.addSlider("restart hour", "restartHour", 3, 1, 23, true); panel.addSlider("restart minute", "restartMinute", 0, 0, 59, true); panel.addToggle("player mode", "toggle_mode", false); //--------- animation params panel.setWhichPanel("animation controls"); panel.setWhichColumn(0); panel.addSlider("particle targetForce", "particle_targetForce", 1.0, 0.0, 1.0, false); panel.addSlider("noise scale in", "noise_scale_input", 0.57, 0.0, 1.0, false); panel.addSlider("noise scale out", "noise_scale_output", 0.5, 0.0, 1.0, false); panel.addChartPlotter("fps", guiStatVarPointer("app fps", &appFps, GUI_VAR_FLOAT, true, 2), 200, 80, 200, 8, 100); panel.addSlider("random offset", "randomOffset", 0, 0, 10, false); panel.addSlider("slow momentum", "slowMomentum", .3, 0, 1, false); panel.addSlider("particle speed", "particle_speed", 24.7, 0, 50, false); panel.addSlider("particle spread", "particle_spread", 100, 2, 100, false); panel.addSlider("particle viscosity", "particle_viscosity", 0.167, 0.0, 0.5, false); panel.addSlider("particle independence", "particle_independence", 0.178, 0.0, 0.8, false); panel.addSlider("particle neighborhood", "particle_neighborhood", 1292, 100, 2000, false); //--------- render params panel.setWhichPanel("render controls"); panel.setWhichColumn(0); panel.addToggle("do ghetto fbo trails", "do_trails", false); panel.addSlider("fboTrails scale", "fboScale", 0.04, 0.001, 0.5, false); panel.addChartPlotter("fps", guiStatVarPointer("app fps", &appFps, GUI_VAR_FLOAT, true, 2), 200, 80, 200, 8, 100); panel.addSlider("max brightness", "maxBrightness", 0, 0, 255, true); panel.addSlider("rgb brightness", "rgbBrightness", 3, 0, 10, false); panel.addSlider("point brightness", "point_brightness", 10, 0, 20.0, false); panel.addSlider("dof focus offset", "focus_offset", 0, -1000, 1000, false); panel.addSlider("aberration", "aberration", 0.021, 0.005, 0.2, false); panel.addSlider("aperture", "aperture", 0.025, 0.001, 0.2, false); panel.addSlider("max point size", "maxPointSize", 21.3, 5, 40, false); panel.addSlider("sphere alpha", "sphere_alpha", 0.66, 0.0, 1.0, false); panel.addSlider("sphere red", "sphere_red", 0, 0.0, 1.0, false); panel.addSlider("sphere green", "sphere_green", 0.35, 0.0, 1.0, false); panel.addSlider("sphere blue", "sphere_blue", 0.47, 0.0, 1.0, false); // - - -- - --- - camera param eters panel.setWhichPanel("camera params"); panel.setWhichColumn(0); panel.addToggle("persistent mode", "persistentMode", true); panel.addSlider("rotation momentum", "rotationMomentum", .9, .5, 1, false); panel.addSlider("position momentum", "positionMomentum", .99, .5, 1, false); panel.addSlider("zoom momentum", "zoomMomentum", .99, .5, 1, false); panel.addSlider("fov", "fov", 60, 1, 180, false); panel.addSlider("min zoom", "minZoom", 400, 0, 400, false); panel.addSlider("max zoom", "maxZoom", 10000, 400, 20000, false); panel.addSlider("reset delay", "resetDelay", 4, 0, 10, false); panel.addSlider("reset length", "resetLength", 2, 0, 10, false); panel.addSlider("rotation speed", "rotationSpeed", .0005, 0, .001, false); panel.addSlider("zoom speed", "zoomSpeed", 1, 0, 4, false); panel.addSlider("zoom scale factor", "zoomScaleFactor", .005, 0, .01, false); panel.addToggle("smart focal plane", "smartFocalPlane", true); //--------- general params panel.setWhichPanel("debug params"); panel.setWhichColumn(0); panel.addToggle("draw particles", "bDrawParticles", true); panel.addToggle("freeze particles", "bFreezeParticles", false); panel.addToggle("draw white", "drawWhite", false); panel.selectedPanel = 0; panel.loadSettings("appSettings.xml"); panel.setValueB("toggle_mode", false); panel.setValueB("bAutoChange", ofDirectory(scanFolder).exists()); //Particle::globalOffset.set(0, 1. / 3, 2. / 3); }