From: Paul Brossier Date: Tue, 19 Jan 2016 15:54:26 +0000 (+0100) Subject: merge with master X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=f96a808cdb216127ac40d31b45ae48130374fa97;p=ofxAubio.git merge with master --- f96a808cdb216127ac40d31b45ae48130374fa97 diff --cc example_aubioDemo/src/ofApp.cpp index 9aa0dc7,d381608..fc83303 --- a/example_aubioDemo/src/ofApp.cpp +++ b/example_aubioDemo/src/ofApp.cpp @@@ -84,23 -86,17 +88,22 @@@ void ofApp::update() //-------------------------------------------------------------- void ofApp::draw(){ // update beat info - if (beat.received()) { + if (gotBeat) { ofSetColor(ofColor::green); ofRect(90,150,50,50); + gotBeat = false; } + if (beat.toSendTatum) { + ofSetColor(ofColor::limeGreen); + ofRect(140,150,25,25); + beat.toSendTatum = false; + } // update onset info - if (onset.received()) { + if (gotOnset) { ofSetColor(ofColor::red); ofRect(250 + 90,150,50,50); - gotOnset = 1; - } else { - gotOnset = 0; + gotOnset = false; } onsetNovelty = onset.novelty; onsetThresholdedNovelty = onset.thresholdedNovelty; diff --cc example_aubioDemo/src/ofApp.h index 64a9bf3,cb68c48..a6b18ca --- a/example_aubioDemo/src/ofApp.h +++ b/example_aubioDemo/src/ofApp.h @@@ -37,7 -40,7 +40,8 @@@ class ofApp : public ofBaseApp ofxFloatSlider pitchConfidence; ofxPanel beatGui; + bool gotBeat; + ofxIntSlider bpm_tatumSignature; ofxFloatSlider bpm; ofxPanel onsetGui; diff --cc src/ofxAubioBeat.cpp index de297dc,719ff8c..de4c867 --- a/src/ofxAubioBeat.cpp +++ b/src/ofxAubioBeat.cpp @@@ -56,17 -59,9 +59,19 @@@ void ofxAubioBeat::blockAudioIn( aubio_tempo_do(tempo, aubio_input, aubio_output); if (aubio_output->data[0]) { //ofLogNotice() << "found beat: " << aubio_output->data[0]; - toSend = true; bpm = aubio_tempo_get_bpm(tempo); + float last_beat = aubio_tempo_get_last_s(tempo); + ofNotifyEvent(gotBeat, last_beat, this); + ofNotifyEvent(gotGlobalBeat, last_beat); } + if (aubio_tempo_was_tatum(tempo) == 1) { + toSendTatum = true; + } +} + +void ofxAubioBeat::setTatumSignature(unsigned tatumSignature) +{ + if (aubio_tempo_set_tatum_signature(tempo, tatumSignature)) { + tatum_signature = tatumSignature; + } }