コード例 #1
0
void THISTimeline::setWorkingFolder(string compFolder)
{
	currentCompFolder = compFolder;
	
	ofEnableDataPath();
	defaults.setValue("defaults:comp", compFolder);
	defaults.saveFile("defaults.xml");
	ofDisableDataPath();
	
	maxwidthkeys->setXMLFileName(compFolder+"/max_width_keys.xml");
	maxwidthkeys->clear();
	maxwidthkeys->loadFromXML();
	
	minwidthkeys->setXMLFileName(compFolder+"/min_width_keys.xml");
	minwidthkeys->loadFromXML();
	
	sourcekeys->setXMLFileName(compFolder+"/source_keys.xml");
	sourcekeys->loadFromXML();
	
	blendkeys->setXMLFileName(compFolder+"/blend_keys.xml");
	blendkeys->loadFromXML();
	
	zoomer->setXmlFileName(compFolder+"/zoom_window.xml");
	zoomer->loadFromXML();
	
	settingsFileName = compFolder+"/sequence_settings.xml";	
}
コード例 #2
0
void ofApp::setup(){
    ofEnableDataPath();

    setupConstants();

    setupGlobals();

    setupGL();

    setupGraph(forward_graph, forward_graph_path);

    setupParameters();

    cout<<params<<endl;

    forward_graph->initFbos();

    setupAudio();

    // if(use_camera){
    //     camera.setVerbose(true);
    //     camera.listDevices();
    //     camera.initGrabber(render_width, render_height);
    // }

    cout<<"setup complete"<<endl;
}
コード例 #3
0
ファイル: testApp.cpp プロジェクト: ofZach/hwTTStoColor
//--------------------------------------------------------------
void testApp::guiEvent(nativeWidget & widget){
    
    ofDisableDataPath();
    ofEnableDataPath();
    
    if (widget.name == "newColor"){
        
        float hue = ofRandom(0,255);
        float sat = ofRandom(190,230);
        float bri = ofRandom(220,238);
        color.setHsb(hue, sat, bri);
        
        
    }
    
    if (widget.name == "repeatSound"){
        if (audioSamples.size() > 0){
            counter = 0;
            bPlaying = true;
        }
        
    }
    
    if (widget.name == "textBox" || widget.name == "textBox2" || widget.name == "textBox3"
        ){
        
        string time = ofGetTimestampString();
        string fileName = time + ".aiff";
        string fileNameMp3 = time + ".mp3";
        string toSay = *((string *)widget.variablePtr);
        string command = "say -o " + ofToDataPath(fileName) + " " + "\"" + toSay + "\"" + " --data-format=BEI32@44100";
            
        // big endian int 32 bit samples 44100 sample rate
        
        system(command.c_str());
        
        ofSleepMillis(100);         // sometimes really long files need time to save out. 
        
        SndfileHandle myf = SndfileHandle(ofToDataPath(fileName).c_str());
        
        float * data = new float[int(myf.frames())];
        myf.read (data, int(myf.frames()));                          
        audioSamples.clear();
        audioSamples.reserve(int(myf.frames()));
        for (int i = 0; i < int(myf.frames()); i++){
            audioSamples.push_back(data[i]);
        }
        delete [] data;
        
        bPlaying = true;
        counter = 0;
         
    }
    
    computeMessageColors();
}
コード例 #4
0
ファイル: main.cpp プロジェクト: TimByB/HackerHand-Control
int main( ) {
#ifdef TARGET_OSX
    //this allows to embed all the data folder inside the app bundle.
    string newRoot = "../Resources/data/";
    ofEnableDataPath();
    ofSetDataPathRoot(newRoot);
#endif

    ofSetupOpenGL(1024,768,OF_WINDOW);

    shared_ptr<mainAppController> mainApp (new mainAppController);
    shared_ptr<BYBGui> gui (new BYBGui);
    mainApp->gui = gui;
    gui->controllerPtr = mainApp;

    ofDirectory dir;
    dir.allowExt("ttf");
    dir.allowExt("otf");
    dir.listDir("fonts");
    for (int i = 0; i < dir.size(); i++ ) {
        ofTrueTypeFont f;
        if(f.load(dir.getPath(i),12, true, true)) {
            gui->fonts[ofFilePath::removeExt(dir.getName(i))] = f;
            cout << "added Font: " << ofFilePath::removeExt(dir.getName(i)) << endl;
        }
        if(f.load(dir.getPath(i),25, true, true)) {
            gui->fonts[ofFilePath::removeExt(dir.getName(i)) + "_25"] = f;
        }
    }

    try {
        ofRunApp(mainApp);
    } catch(exception& e) {
        cout << e.what() << '\n';
    }
    catch (int param) {
        cout << "int exception";
    }
    catch (char param) {
        cout << "char exception";
    }
    catch (...) {
        cout << "default exception";
    }
}
コード例 #5
0
void THISTimeline::setup()
{
	sourceA = new THISSequence();
	sourceA->setDrawWidth(1024);

	sourceB = new THISSequence();
	sourceB->setDrawWidth(1024);

	distortion = new THISSequence();
	distortion->setImageType(OF_IMAGE_GRAYSCALE);
	distortion->setDrawWidth(1024);

	output = new THISOutputTimeline();
	output->inputTimeline = this;

	maxwidthkeys = new THISKeyframeEditor();
	minwidthkeys = new THISKeyframeEditor();
	sourcekeys = new THISKeyframeEditor();
	blendkeys = new THISKeyframeEditor();
	zoomer = new THISTimelineZoom();
	
	maxwidthkeys->snapToFrame = true;
	minwidthkeys->snapToFrame = true;
	sourcekeys->snapToFrame = true;
	blendkeys->snapToFrame = true;
	
	//TODO: make many and multithreaded...
	exporter = new THISExporter();
	exporter->inputTimeline = this;
	exporter->outputTimeline = output;

	newCompButton = new ofxMSAInteractiveObjectWithDelegate();
	newCompButton->setup();
	newCompButton->setDelegate(this);
	newCompButton->disableAppEvents();

	loadCompButton = new ofxMSAInteractiveObjectWithDelegate();
	loadCompButton->setup();
	loadCompButton->setDelegate(this);
	loadCompButton->disableAppEvents();

	/*
	loadSourceBButton = new ofxMSAInteractiveObjectWithDelegate();
	loadSourceBButton->setup();
	loadSourceBButton->setDelegate(this);
	loadSourceBButton->disableAppEvents();

	loadDistortionButton = new ofxMSAInteractiveObjectWithDelegate();
	loadDistortionButton->setup();
	loadDistortionButton->setDelegate(this);
	loadDistortionButton->disableAppEvents();

	setOutputDirectoryButton = new ofxMSAInteractiveObjectWithDelegate();
	setOutputDirectoryButton->setup();
	setOutputDirectoryButton->setDelegate(this);
	setOutputDirectoryButton->disableAppEvents();
	 */
	
	playheadBar = new ofxMSAInteractiveObjectWithDelegate();
    playheadBar->setup();
    playheadBar->setDelegate(this);
    playheadBar->disableAppEvents();

	exportCurrentViewButton = new ofxMSAInteractiveObjectWithDelegate();
	exportCurrentViewButton->setup();
	exportCurrentViewButton->setDelegate(this);
    exportCurrentViewButton->disableAppEvents();

	exportEntireSequenceButton = new ofxMSAInteractiveObjectWithDelegate();
	exportEntireSequenceButton->setup();
	exportEntireSequenceButton->setDelegate(this);
    exportEntireSequenceButton->disableAppEvents();

	cancelExportButton = new ofxMSAInteractiveObjectWithDelegate();
	cancelExportButton->setup();
	cancelExportButton->setDelegate(this);
    cancelExportButton->disableAppEvents();

	string defaultComp = "";
	if(defaults.loadFile("defaults.xml")){
		defaultComp = defaults.getValue("defaults:comp", "");
	}

	if(defaultComp == ""){
		ofLog(OF_LOG_ERROR, "THISTimeline -- No defaults comp, creating one.");
		ofEnableDataPath();
		if(!ofDirectory::doesDirectoryExist("defaultcomp")){
			ofDirectory::createDirectory("defaultcomp", true);
		}
		defaultComp = ofToDataPath("deafultcomp/", true);
		
		cout << "DEFAULT COMP IS " << defaultComp << endl;
		ofDisableDataPath();

	}
	
	if(!loadComposition(defaultComp)){
		newComposition();
	}
}
コード例 #6
0
//--------------------------------------------------------------
void testApp::setup(){
	ofBackground(0, 0, 0);
	ofSetVerticalSync(true);
    ofEnableDataPath();
	
	//Connect to Port
	myTuio.connect(3333);
	
	//init buttons
	//button.setSize(100, 100);
	//button.registerForMultitouchEvents();
	buttonTwo.setPos(ofGetWidth() - 230, 0);
	buttonTwo.setSize(50, 50);
	buttonTwo.registerForMultitouchEvents();
	
	/*
	markerButton.setPos(600,500);
	markerButton.setSize(60,60);
	markerButton.registerForMarkerEvents();
	*/
	
	//----------------
	//Draggable Rotate Scalable Object
	//rotatableScalableItem.setSize(100, 100);
	draggableRotatableScalableItem.setPos(ofGetWidth()/2, ofGetHeight()/2);
	draggableRotatableScalableItem.setColor(0x00FF00);
	draggableRotatableScalableItem.setPriorityLevel(1);
	
	int *tRange = new int[2];
	tRange[0] = 2;
	tRange[1] = 3;
	draggableRotatableScalableItem.setIsRotatable(true, tRange, 2);
	delete [] tRange;
	
	/*
	tRange = new int[1];
	tRange[0] = 2;
	draggableRotatableScalableItem.setIsScalable(true, tRange, 1);
	delete [] tRange;
	*/
	
	tRange = new int[2];
	tRange[0] = 1;
	tRange[1] = -4; //a negative value means the value and up. Is this case 4+
	draggableRotatableScalableItem.setIsDraggable(true, tRange, 2);
	delete [] tRange;
	//----------------
	
	//----------------
	//Scalable Object
	scalableItem.setPos(ofRandom(10, ofGetWidth()-10), ofRandom(10, ofGetHeight()-10));
	scalableItem.setColor(0xFF0000);
	scalableItem.setPriorityLevel(2);
	
	tRange = new int[2];
	tRange[0] = 2;
	tRange[1] = 3;
	scalableItem.setIsScalable(true, tRange, 2);
	delete [] tRange;
	
	tRange = new int[1];
	tRange[0] = 1;
	scalableItem.setIsDraggable(true, tRange, 1);
	delete [] tRange;
	//----------------
	
	//----------------
	//Draggable Object
	draggableItem.setPos(ofRandom(10, ofGetWidth()-10), ofRandom(10, ofGetHeight()-10));
	draggableItem.setColor(0x2233FF);
	draggableItem.setPriorityLevel(1);
	
	tRange = new int[1];
	tRange[0] = 1;
	draggableItem.setIsDraggable(true, tRange, 1);
	delete [] tRange;
	//----------------
	
	//----------------
	sliderW = 40;
	sliderH = 70;
	gapW = 15;
	drawSliders = true;
	//Slider Object - Red
	rSlider.setPos(ofGetWidth() - 3*(sliderW+gapW), ofGetHeight() - sliderH);
	rSlider.setSize(sliderW, sliderH);
	rSlider.setColor(255, 0, 0);
	rSlider.setPriorityLevel(3);
	rSlider.registerForMultitouchEvents();
	
	tRange = new int[1];
	tRange[0] = 1;
	rSlider.setIsDraggable(true, tRange, 1, false, true);
	delete [] tRange;
	
	//Slider Object - Green
	gSlider.setPos(ofGetWidth() - 2*(sliderW+gapW), ofGetHeight() - sliderH);
	gSlider.setSize(sliderW, sliderH);
	gSlider.setColor(0, 255, 0);
	gSlider.setPriorityLevel(3);
	gSlider.registerForMultitouchEvents();
	
	tRange = new int[1];
	tRange[0] = 1;
	gSlider.setIsDraggable(true, tRange, 1, false, true);
	delete [] tRange;
	
	//Slider Object - Blue
	bSlider.setPos(ofGetWidth() - 1*(sliderW+gapW), ofGetHeight() - sliderH);
	bSlider.setSize(sliderW, sliderH);
	bSlider.setColor(0, 0, 255);
	bSlider.setPriorityLevel(3);
	bSlider.registerForMultitouchEvents();
	
	tRange = new int[1];
	tRange[0] = 1;
	bSlider.setIsDraggable(true, tRange, 1, false, true);
	delete [] tRange;
	//----------------
	
	
	mtActionsHub.addObject(&draggableRotatableScalableItem);
	mtActionsHub.addObject(&scalableItem);
	mtActionsHub.addObject(&draggableItem);
	
	mtSliderHub.addObject(&rSlider);
	mtSliderHub.addObject(&gSlider);
	mtSliderHub.addObject(&bSlider);
	
	
	ofAddListener(rSlider.eMultiTouchMoved,this,&testApp::updateBackgroundColor);
	ofAddListener(gSlider.eMultiTouchMoved,this,&testApp::updateBackgroundColor);
	ofAddListener(bSlider.eMultiTouchMoved,this,&testApp::updateBackgroundColor);
	
	//add button event listener for global callback function in testApp
	ofAddListener(buttonTwo.eMultiTouchUp,this,&testApp::buttonTwoCallback);
	
	//Assign Global TUIO Callback Functions
	ofAddListener(myTuio.objectAdded,this,&testApp::tuioObjectAdded);
	ofAddListener(myTuio.objectRemoved,this,&testApp::tuioObjectRemoved);
	ofAddListener(myTuio.objectUpdated,this,&testApp::tuioObjectUpdated);
	ofAddListener(myTuio.cursorAdded,this,&testApp::tuioCursorAdded);
	ofAddListener(myTuio.cursorRemoved,this,&testApp::tuioCursorRemoved);
	ofAddListener(myTuio.cursorUpdated,this,&testApp::tuioCursorUpdated);

}