//--------------------------------------------------------------
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;
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;
+ }
}