# HG changeset patch # User Andrew N Robertson # Date 1329008865 0 # Node ID 604add81822f61fb66249186e3a66d25835513b1 # Parent 4f6006cac9de7b1179bb0bf2aa5391481ef8cd89 fixing aspects of the draw window diff -r 4f6006cac9de -r 604add81822f src/AudioEventMatcher.cpp --- a/src/AudioEventMatcher.cpp Sun Feb 12 00:48:07 2012 +0000 +++ b/src/AudioEventMatcher.cpp Sun Feb 12 01:07:45 2012 +0000 @@ -136,6 +136,9 @@ currentSpeedRatio = 1; + temporal.tempoPosterior.zero(); + temporal.tempoPosterior.addGaussianShapeFromRealTime(recordedTempo, 10, 1); + //SET TEMPO PRIOR for Speed Ratio //the update this setSpeedRatioDistribution(currentSpeedRatio); @@ -248,23 +251,28 @@ void AudioEventMatcher::drawRecordedTempo(){ - int xTempoIndex = ofGetWidth() * (recordedTempo - recordedTempoData.minimumTempoInterval)/(recordedTempoData.maximumTempoInterval - recordedTempoData.minimumTempoInterval); + int xTempoIndex = ofGetWidth() * (double)(recordedTempo - recordedTempoData.minimumTempoInterval)/(double)(recordedTempoData.maximumTempoInterval - recordedTempoData.minimumTempoInterval); ofSetColor(0, 200, 0); ofLine(xTempoIndex, bayesLikelihoodWindow.y, xTempoIndex, bayesLikelihoodWindow.y + bayesLikelihoodWindow.height); ofDrawBitmapString(ofToString(recordedTempo), xTempoIndex, bayesLikelihoodWindow.y + 10); } void AudioEventMatcher::drawPlayingTempo(){ - - int xTempoIndex = ofGetWidth() * (temporal.playingTempo - temporal.minimumTempoInterval)/(temporal.maximumTempoInterval - temporal.minimumTempoInterval); + //purple line for MAP estimate of new intervals + int xTempoIndex = (double)(ofGetWidth() * (temporal.playingTempo - temporal.minimumTempoInterval))/(double)(temporal.maximumTempoInterval - temporal.minimumTempoInterval); ofSetColor(200, 0, 200); ofLine(xTempoIndex, bayesLikelihoodWindow.y, xTempoIndex, bayesLikelihoodWindow.y + bayesLikelihoodWindow.height); - ofDrawBitmapString(ofToString(recordedTempo), xTempoIndex, bayesLikelihoodWindow.y + 10); + ofDrawBitmapString(ofToString(temporal.playingTempo), xTempoIndex, bayesLikelihoodWindow.y + 10); + //red line where the ratio is between playing tempo and recorded one int xSpeedRatioIndex = (double)(temporal.tempoPosterior.getIndexInRealTerms(currentSpeedRatio)*ofGetWidth())/(double)temporal.tempoPosterior.arraySize; ofSetColor(200,0,0); ofLine(xSpeedRatioIndex, bayesTempoWindow.y, xSpeedRatioIndex, bayesTempoWindow.y + bayesTempoWindow.height); - ofDrawBitmapString(ofToString(currentSpeedRatio), 100, bayesTempoWindow.y+50); + string tmpString = "playing "+ofToString(temporal.playingTempo); + tmpString += ", recorded "+ofToString(recordedTempo); + tmpString += " ratio "+ofToString(currentSpeedRatio); + ofSetColor(155,155,155); + ofDrawBitmapString(tmpString, 20, bayesTempoWindow.y+10); }