Mercurial > hg > midi-score-follower
comparison jnmr/BayesianArrayStructure.cpp @ 52:13194a9dca77 tip
Added exporting of image and text data
| author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
|---|---|
| date | Tue, 17 Jul 2012 22:13:10 +0100 |
| parents | 158f5f38e9d3 |
| children |
comparison
equal
deleted
inserted
replaced
| 51:ef30f465a904 | 52:13194a9dca77 |
|---|---|
| 10 //look at reset speed to one - what does this do? - get rid of? | 10 //look at reset speed to one - what does this do? - get rid of? |
| 11 | 11 |
| 12 | 12 |
| 13 #include "BayesianArrayStructure.h" | 13 #include "BayesianArrayStructure.h" |
| 14 | 14 |
| 15 int priorColor = 0xEE00CC;//230,0,170 | |
| 16 int posteriorColor = 0x444444;//000099; | |
| 17 | |
| 15 BayesianArrayStructure::BayesianArrayStructure(){ | 18 BayesianArrayStructure::BayesianArrayStructure(){ |
| 16 printf("Bayesian structure: DeFault constructor called\n"); | 19 printf("Bayesian structure: DeFault constructor called\n"); |
| 17 usingIntegratedTempoEstimate = false;// use max index | 20 usingIntegratedTempoEstimate = false;// use max index |
| 18 | 21 |
| 19 useConstantTempoDistribution = false; | 22 useConstantTempoDistribution = false; |
| 20 | 23 |
| 21 relativeSpeedLikelihoodStdDev = 5.0; | 24 relativeSpeedLikelihoodStdDev = 5.0; |
| 22 | 25 |
| 23 prior.createVector(1); | 26 prior.createVector(1); |
| 24 likelihood.createVector(1); | 27 likelihood.createVector(1); |
| 25 posterior.createVector(1); | 28 posterior.createVector(1); |
| 26 | 29 |
| 27 | 30 |
| 28 speedPriorValue = 1.0; | 31 speedPriorValue = 1.0; |
| 29 speedEstimate = speedPriorValue; | 32 speedEstimate = speedPriorValue; |
| 31 lastEventTime = 0;//ofGetElapsedTimeMillis(); | 34 lastEventTime = 0;//ofGetElapsedTimeMillis(); |
| 32 | 35 |
| 33 //tmpBestEstimate = 0; | 36 //tmpBestEstimate = 0; |
| 34 crossUpdateTimeThreshold = 60; | 37 crossUpdateTimeThreshold = 60; |
| 35 priorWidth = 50; | 38 priorWidth = 50; |
| 39 | |
| 40 drawLikelihood = false; | |
| 41 drawPrior = true; | |
| 42 drawPosterior = true; | |
| 36 | 43 |
| 37 } | 44 } |
| 38 | 45 |
| 39 BayesianArrayStructure::BayesianArrayStructure(int length){ | 46 BayesianArrayStructure::BayesianArrayStructure(int length){ |
| 40 printf("BAYESIAN STURTUCRE CREATED LENGTH (EVER CALLED?????): %i\n", length); | 47 printf("BAYESIAN STURTUCRE CREATED LENGTH (EVER CALLED?????): %i\n", length); |
| 564 // relativeString += ofToString(prior.getIndexInRealTerms(endArrayIndex), 3)+"] (sc-width:"+ofToString(screenWidthMillis, 1)+") "; | 571 // relativeString += ofToString(prior.getIndexInRealTerms(endArrayIndex), 3)+"] (sc-width:"+ofToString(screenWidthMillis, 1)+") "; |
| 565 relativeString += " mapped to screen "+ofToString(startScreenPosition)+" , "+ofToString(endScreenPosition); | 572 relativeString += " mapped to screen "+ofToString(startScreenPosition)+" , "+ofToString(endScreenPosition); |
| 566 // ofDrawBitmapString(relativeString, 100, 180); | 573 // ofDrawBitmapString(relativeString, 100, 180); |
| 567 | 574 |
| 568 | 575 |
| 569 | 576 if (drawLikelihood){ |
| 570 ofSetColor(100,100,100);//255, 255, 0); | 577 ofSetColor(100,100,100);//255, 255, 0); |
| 571 likelihood.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | 578 likelihood.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); |
| 572 | 579 } |
| 573 // ofSetColor(0,0,200); | 580 |
| 574 ofSetColor(230,0,170);//00,200); | 581 if (drawPrior){ |
| 575 prior.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | 582 ofSetHexColor(priorColor);//00,200); |
| 576 | 583 prior.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); |
| 577 ofSetColor(0,0,150); | 584 } |
| 578 // ofSetColor(200, 0, 0); | 585 |
| 579 posterior.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | 586 if (drawPosterior){ |
| 580 | 587 ofSetHexColor(posteriorColor); |
| 588 // ofSetColor(200, 0, 0); | |
| 589 posterior.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | |
| 590 } | |
| 581 | 591 |
| 582 // ofSetColor(0, 200, 255); | 592 // ofSetColor(0, 200, 255); |
| 583 // acceleration.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | 593 // acceleration.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); |
| 584 | 594 |
| 585 | 595 |
