diff options
Diffstat (limited to 'gistanalysis/src/ofApp.cpp')
| -rw-r--r-- | gistanalysis/src/ofApp.cpp | 80 |
1 files changed, 64 insertions, 16 deletions
diff --git a/gistanalysis/src/ofApp.cpp b/gistanalysis/src/ofApp.cpp index 50a4be6..76e53a9 100644 --- a/gistanalysis/src/ofApp.cpp +++ b/gistanalysis/src/ofApp.cpp @@ -45,9 +45,11 @@ void ofApp::setup(){ } - - - + gui.setup("panel"); // most of the time you don't need a name but don't forget to call setup + gui.add(numPlots.set("num plots", 1, 1, 128)); + gui.add(scalePlot.set( "scale plot", 0.1f, 0.0f, 1.0f )); + gui.add(decayPlot.set( "decay", 0.9f, 0.0f, 1.0f )); + gui.add(xform.set("xform",ofVec2f(0,0),ofVec2f(-10,-10),ofVec2f(10,10))); /* @@ -73,10 +75,11 @@ void ofApp::setup(){ soundStream.setup(this,0, 1, sampleRate, bufferSize, 1); - loadSong("passades/1 The Ninth Set-sector1:sector2pt.1.aiff"); + loadSong("12 Ferric Appetite.aiff"); + //loadSong("passades/1 The Ninth Set-sector1:sector2pt.1.aiff"); //loadSong("assets/sounds/Coltrane_acc_VUIMM.wav"); - plotter=Audioplotter(8); + plotter=Audioplotter(4,true); } @@ -94,6 +97,9 @@ void ofApp::onNoteOff(GistEvent &e){ //-------------------------------------------------------------- void ofApp::update(){ +} +//-------------------------------------------------------------- +void ofApp::updateOutput(ofEventArgs& e){ @@ -106,7 +112,7 @@ void ofApp::update(){ processAudio(&output[0], bufferSize, 2); fftSmoothed = player.getFFT(); - plotter.addpoints(centre,256); + plotter.addpoints(centre,numPlots); } } @@ -163,12 +169,16 @@ void ofApp::update(){ noteOnRadius--; } } - //-------------------------------------------------------------- void ofApp::draw(){ ofBackground(0); + gui.draw(); +} +//-------------------------------------------------------------- +void ofApp::drawOutput(ofEventArgs & args){ + ofBackground(0); - + /* ofFill(); @@ -207,6 +217,7 @@ void ofApp::draw(){ for (int i = 0; i < right.size(); i++){ //ofLine(i,500+right[i]*waveHeight,i,500+right[i]*waveHeight+1); } + */ /* int num; @@ -230,14 +241,14 @@ void ofApp::draw(){ } } - */ + ofFill(); ofSetColor(255,0,0,200); ofCircle(ofGetWidth()/2,ofGetHeight()/2,noteOnRadius); - /* + if(!showMFCC){ @@ -261,10 +272,10 @@ void ofApp::draw(){ } */ - ofMatrix4x4 xform; - xform.makeTranslationMatrix(1,5,0); + ofMatrix4x4 _xform; + _xform.makeTranslationMatrix(xform->x,xform->y,0); - auto lines=plotter.output(xform); + auto lines=plotter.output(_xform,scalePlot,decayPlot); laser.draw(lines,50); ofTranslate(0,ofGetHeight()/2); @@ -273,8 +284,13 @@ void ofApp::draw(){ line->draw(); } + ofSetWindowTitle(ofToString(ofGetFrameRate())+" fps, "+ofToString(plotter.numpoints())+" pts"); + } +//-------------------------------------------------------------- +void ofApp::exit() { +} ofxHistoryPlot* ofApp::addGraph(string varName,float max,ofColor color){ @@ -374,7 +390,13 @@ void ofApp::audioIn(float * input, int bufferSize, int nChannels){ +//-------------------------------------------------------------- +void ofApp::outputKeyPressed(ofKeyEventArgs &args){ + keyPressed(args.key); + + +} //-------------------------------------------------------------- void ofApp::keyPressed(int key){ if(key =='f'){ @@ -408,7 +430,12 @@ void ofApp::keyPressed(int key){ showMFCC = !showMFCC; } } +//-------------------------------------------------------------- +void ofApp::outputKeyReleased(ofKeyEventArgs &args){ + + keyReleased(args.key); +} //-------------------------------------------------------------- void ofApp::keyReleased(int key){ @@ -418,7 +445,12 @@ void ofApp::keyReleased(int key){ void ofApp::mouseMoved(int x, int y ){ } - +//-------------------------------------------------------------- +void ofApp::outputMouseDragged(ofMouseEventArgs & args){ + //if (select_warpframe>-1){ + // warpframe[select_warpframe]=glm::vec2(args.x,args.y); + //} +} //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button){ if(!useMic){ @@ -428,18 +460,32 @@ void ofApp::mouseDragged(int x, int y, int button){ float t = x/(float)ofGetWidth(); gist.setThreshold(GIST_SPECTRAL_DIFFERENCE,t); } - +//-------------------------------------------------------------- +void ofApp::outputMousePressed(ofMouseEventArgs & args){ + // for (int i=0;i<4;i++){ + // if (ofPoint(args.x,args.y).distance(warpframe[i])<25){ + // select_warpframe=i; + // } + // } +} //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ } - +//-------------------------------------------------------------- +void ofApp::outputMouseReleased(ofMouseEventArgs & args){ + //select_warpframe=-1; +} //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ } //-------------------------------------------------------------- +void ofApp::outputWindowResized(ofResizeEventArgs &resizeargs){ + +} +//-------------------------------------------------------------- void ofApp::windowResized(int w, int h){ } @@ -456,3 +502,5 @@ void ofApp::dragEvent(ofDragInfo dragInfo){ loadSong(paths[1]); } +void ofApp::newMidiMessage(ofxMidiMessage& msg) { +} |
