示例#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 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();
}
示例#3
0
//--------------------------------------------------------------
void testApp::setup(){

	ofEnableAlphaBlending();

	timeline = new THISTimeline();
	timeline->setup();


    timeline->position = ofPoint(0, 3*720/4*.75 + 20);
    timeline->uiposition = ofPoint(960, 0);
	timeline->frameInfoPosition = ofPoint(3*1280/4*.75+20, 2*720/4*.75 + 20);
	
	outputImage = NULL;

	ofSetFullscreen(true);

	ofDisableDataPath();
}
示例#4
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();
	}
}