Mercurial > hg > multitrack-audio-matcher
changeset 21:604add81822f
fixing aspects of the draw window
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Sun, 12 Feb 2012 01:07:45 +0000 |
parents | 4f6006cac9de |
children | 24c413f0f2c5 |
files | src/AudioEventMatcher.cpp |
diffstat | 1 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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); }