diff options
Diffstat (limited to 'src/testApp.cpp')
| -rwxr-xr-x | src/testApp.cpp | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/src/testApp.cpp b/src/testApp.cpp index e66f892..b58971d 100755 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -11,6 +11,34 @@ void previewWindow::draw(){ for (auto i:parent->viewports) i.draw(parent->brightSlider,previewscale); } +void previewWindow::mouseDragged(int x, int y, int button){ + //cerr<<"dragged "<<x<<","<<y<<endl; + if (button==0&&parent->viewports.size()) { + //get relative coords to window + + + parent->control.bx=((float)((x/previewscale)%parent->viewports[0].w))/parent->viewports[0].w; + parent->control.by=((float)((y/previewscale)%parent->viewports[0].h))/parent->viewports[0].h; + parent->control.drawseconds=ofGetElapsedTimef()-drawStartTime; + } +} +void previewWindow::mousePressed(int x, int y, int button){ + + if (button==0&&parent->viewports.size()) { + drawStartTime=ofGetElapsedTimef(); + //get relative coords to window + parent->control.bx=((float)((x/previewscale)%parent->viewports[0].w))/parent->viewports[0].w; + parent->control.by=((float)((y/previewscale)%parent->viewports[0].h))/parent->viewports[0].h; + parent->control.drawseconds=0.01f; + } + //cerr<<"pressed button "<<button<<" "<<bx<<","<<by<<endl; +} +void previewWindow::mouseReleased(int x, int y, int button){ + //cerr<<"released "<<x<<","<<y<<endl; + if (button==0) { + parent->control.drawseconds=-1.0f; + } +} void previewWindow::dragEvent(ofDragInfo dragInfo, ofxFenster* win){ if (parent->viewports.size()){ int sta=dragInfo.files[0].find_last_of("\\/")+1; @@ -294,17 +322,41 @@ void testApp::update(){ control.waveheight=slidWave; control.fade=(uint8_t)fadeSlider; - if (vamphost.feat.size()) cerr<<"found "<<vamphost.feat.size()<<" feature(s)\n"; + //if (vamphost.feat.size()) cerr<<"found "<<vamphost.feat.size()<<" feature(s)\n"; + + if (vamphost.feat.size()) { + control.feats.clear(); + for (int i=0;i<vamphost.feat.size();i++){ + if (vamphost.feat[i].size()){ + if (vamphost.feat[i][0].values.size()){ + control.feats.push_back((float)vamphost.feat[i][0].values[0]); + } + } + } + } } //-------------------------------------------------------------- void testApp::draw(){ - + /* +[F] [v2] Key Detector, "qm-keydetector" [Queen Mary, University of London] + > Key and Tonality + - Estimate the key of the music + (0) Tonic Pitch, "tonic" + - Tonic of the estimated key (from C = 1 to B = 12) + (1) Key Mode, "mode" + - Major or minor mode of the estimated key (major = 0, minor = 1) + (2) Key, "key" + - Estimated key (from C major = 1 to B major = 12 and C minor = 13 to B minor = 24) + (3) Key Strength Plot, "keystrength" + - Correlation of the chroma vector with stored key profile for each major and minor key +*/ for (auto i:viewports) i.drawport(control); ofPushMatrix(); - ofTranslate((ofGetWidth()/2)-(2*windowsize),(ofGetHeight()/2)-windowsize); + //ofTranslate((ofGetWidth()/2)-(2*windowsize),(ofGetHeight()/2)-windowsize); + ofTranslate(1,1); for (auto i:viewports) i.draw((uint8_t)brightSlider); ofPopMatrix(); |
