Mercurial > hg > multitrack-audio-matcher
comparison src/AudioEventMatcher.cpp @ 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 |
comparison
equal
deleted
inserted
replaced
20:4f6006cac9de | 21:604add81822f |
---|---|
134 recordedTempoIndex = 0; | 134 recordedTempoIndex = 0; |
135 recordedTempo = recordedTempoData.globalTempo[recordedTempoIndex]; | 135 recordedTempo = recordedTempoData.globalTempo[recordedTempoIndex]; |
136 | 136 |
137 currentSpeedRatio = 1; | 137 currentSpeedRatio = 1; |
138 | 138 |
139 temporal.tempoPosterior.zero(); | |
140 temporal.tempoPosterior.addGaussianShapeFromRealTime(recordedTempo, 10, 1); | |
141 | |
139 //SET TEMPO PRIOR for Speed Ratio | 142 //SET TEMPO PRIOR for Speed Ratio |
140 //the update this | 143 //the update this |
141 setSpeedRatioDistribution(currentSpeedRatio); | 144 setSpeedRatioDistribution(currentSpeedRatio); |
142 //bayesianStruct.posterior.printArray(); | 145 //bayesianStruct.posterior.printArray(); |
143 } | 146 } |
246 | 249 |
247 } | 250 } |
248 | 251 |
249 void AudioEventMatcher::drawRecordedTempo(){ | 252 void AudioEventMatcher::drawRecordedTempo(){ |
250 | 253 |
251 int xTempoIndex = ofGetWidth() * (recordedTempo - recordedTempoData.minimumTempoInterval)/(recordedTempoData.maximumTempoInterval - recordedTempoData.minimumTempoInterval); | 254 int xTempoIndex = ofGetWidth() * (double)(recordedTempo - recordedTempoData.minimumTempoInterval)/(double)(recordedTempoData.maximumTempoInterval - recordedTempoData.minimumTempoInterval); |
252 ofSetColor(0, 200, 0); | 255 ofSetColor(0, 200, 0); |
253 ofLine(xTempoIndex, bayesLikelihoodWindow.y, xTempoIndex, bayesLikelihoodWindow.y + bayesLikelihoodWindow.height); | 256 ofLine(xTempoIndex, bayesLikelihoodWindow.y, xTempoIndex, bayesLikelihoodWindow.y + bayesLikelihoodWindow.height); |
254 ofDrawBitmapString(ofToString(recordedTempo), xTempoIndex, bayesLikelihoodWindow.y + 10); | 257 ofDrawBitmapString(ofToString(recordedTempo), xTempoIndex, bayesLikelihoodWindow.y + 10); |
255 } | 258 } |
256 | 259 |
257 void AudioEventMatcher::drawPlayingTempo(){ | 260 void AudioEventMatcher::drawPlayingTempo(){ |
258 | 261 //purple line for MAP estimate of new intervals |
259 int xTempoIndex = ofGetWidth() * (temporal.playingTempo - temporal.minimumTempoInterval)/(temporal.maximumTempoInterval - temporal.minimumTempoInterval); | 262 int xTempoIndex = (double)(ofGetWidth() * (temporal.playingTempo - temporal.minimumTempoInterval))/(double)(temporal.maximumTempoInterval - temporal.minimumTempoInterval); |
260 ofSetColor(200, 0, 200); | 263 ofSetColor(200, 0, 200); |
261 ofLine(xTempoIndex, bayesLikelihoodWindow.y, xTempoIndex, bayesLikelihoodWindow.y + bayesLikelihoodWindow.height); | 264 ofLine(xTempoIndex, bayesLikelihoodWindow.y, xTempoIndex, bayesLikelihoodWindow.y + bayesLikelihoodWindow.height); |
262 ofDrawBitmapString(ofToString(recordedTempo), xTempoIndex, bayesLikelihoodWindow.y + 10); | 265 ofDrawBitmapString(ofToString(temporal.playingTempo), xTempoIndex, bayesLikelihoodWindow.y + 10); |
263 | 266 |
267 //red line where the ratio is between playing tempo and recorded one | |
264 int xSpeedRatioIndex = (double)(temporal.tempoPosterior.getIndexInRealTerms(currentSpeedRatio)*ofGetWidth())/(double)temporal.tempoPosterior.arraySize; | 268 int xSpeedRatioIndex = (double)(temporal.tempoPosterior.getIndexInRealTerms(currentSpeedRatio)*ofGetWidth())/(double)temporal.tempoPosterior.arraySize; |
265 ofSetColor(200,0,0); | 269 ofSetColor(200,0,0); |
266 ofLine(xSpeedRatioIndex, bayesTempoWindow.y, xSpeedRatioIndex, bayesTempoWindow.y + bayesTempoWindow.height); | 270 ofLine(xSpeedRatioIndex, bayesTempoWindow.y, xSpeedRatioIndex, bayesTempoWindow.y + bayesTempoWindow.height); |
267 ofDrawBitmapString(ofToString(currentSpeedRatio), 100, bayesTempoWindow.y+50); | 271 string tmpString = "playing "+ofToString(temporal.playingTempo); |
272 tmpString += ", recorded "+ofToString(recordedTempo); | |
273 tmpString += " ratio "+ofToString(currentSpeedRatio); | |
274 ofSetColor(155,155,155); | |
275 ofDrawBitmapString(tmpString, 20, bayesTempoWindow.y+10); | |
268 | 276 |
269 } | 277 } |
270 | 278 |
271 | 279 |
272 void AudioEventMatcher::setScreenDisplayTimes(){ | 280 void AudioEventMatcher::setScreenDisplayTimes(){ |