diff src/BayesianArrayStructure.cpp @ 19:2e17f0fdeaef

offline method is now working, linked via pointer in BayesianStructure. Progresses using the time played so could be used for sequential offfline analysis
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 22 Nov 2011 13:30:02 +0000
parents c7107e5c8f03
children 11e3119ce6b4
line wrap: on
line diff
--- a/src/BayesianArrayStructure.cpp	Fri Nov 18 11:56:32 2011 +0000
+++ b/src/BayesianArrayStructure.cpp	Tue Nov 22 13:30:02 2011 +0000
@@ -131,12 +131,15 @@
 }
 
 void BayesianArrayStructure::setStartPlaying(){
-	lastEventTime = 0;//ofGetElapsedTimeMillis();
+	
+	lastEventTime = 0;
 	bestEstimate = 0;
-	lastBestEstimateUpdateTime = lastEventTime;
-	//bug somewhere here that prevented offline
-	//ofGetElapsedTimeMillis();//lastEventTime;//
+	lastBestEstimateUpdateTime = 0;
+	if (*realTimeMode)
+		lastBestEstimateUpdateTime = ofGetElapsedTimeMillis();
+	//cannot just be zero - offline bug
 	printf("start playing - best estimate %f\n", lastBestEstimateUpdateTime);
+	
 	resetArrays();
 }
 
@@ -160,15 +163,13 @@
 	
 	updateCounter = 0;
 	
-	bestEstimate = 0;
-	lastBestEstimateUpdateTime = ofGetElapsedTimeMillis();
-	//cannot just be zero - offline bug
-	
+
 	printf("bayes reset arrays - best estimate %f\n", lastBestEstimateUpdateTime);
 	
 	setSpeedPrior(speedPriorValue);
 }
 
+
 void BayesianArrayStructure::zeroArrays(){
 	prior.zero();
 	likelihood.zero();
@@ -199,7 +200,7 @@
 	
 	//Using timedifferencfe here will make it go wrong. Is time since beginning of playing
 	
-	//if (*realTimeMode)
+	if (*realTimeMode)
 		timeDiff = ofGetElapsedTimeMillis() - lastBestEstimateUpdateTime;
 	
 	double speedEstimate;