Mercurial > hg > multitrack-audio-matcher
changeset 5:5ef00d1dfe68
cross update checked and working
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Thu, 02 Feb 2012 12:45:36 +0000 |
parents | 45b5cf9be377 |
children | 746a5af43c02 |
files | bayesianArraySrc/BayesianArrayStructure.cpp src/AudioEventMatcher.cpp |
diffstat | 2 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/bayesianArraySrc/BayesianArrayStructure.cpp Thu Feb 02 12:13:44 2012 +0000 +++ b/bayesianArraySrc/BayesianArrayStructure.cpp Thu Feb 02 12:45:36 2012 +0000 @@ -29,7 +29,7 @@ lastEventTime = 0;//ofGetElapsedTimeMillis(); tmpBestEstimate = 0; - crossUpdateTimeThreshold = 60000; + crossUpdateTimeThreshold = 60; priorWidth = 20; } @@ -280,7 +280,7 @@ // calculateNewPriorOffset(timeDifference);//dioesnt do anything - printf("new prior offset %f and post offset %f\n", prior.offset, posterior.offset); +// printf("new prior offset %f and post offset %f\n", prior.offset, posterior.offset); if (timeDifferenceInPositionVectorUnits > crossUpdateTimeThreshold) complexCrossUpdate(timeDifferenceInPositionVectorUnits); @@ -295,6 +295,9 @@ void BayesianArrayStructure::complexCrossUpdate(const double& timeDifferenceInPositionVectorUnits){ + + printf("before cross c : posterior map is %i = %f ms time diff pos vec %f\n", posterior.getMAPestimate(), posterior.getIndexInRealTerms(prior.getMAPestimate()), timeDifferenceInPositionVectorUnits); + int distanceMoved, newPriorIndex; double speedValue = relativeSpeedPosterior.offset; @@ -305,7 +308,8 @@ //so we have moved distanceMoved = round(timeDifferenceInPositionVectorUnits * speedValue);//round the value - + // printf("Speed value %f time %f gives distance %i\n", speedValue, timeDifferenceInPositionVectorUnits, distanceMoved); + if (relativeSpeedPosterior.array[i] != 0){ double speedContribution = relativeSpeedPosterior.array[i]; @@ -314,7 +318,8 @@ //1/2/12 deleted line newPriorIndex = posterior.offset - prior.offset + distanceMoved;//i.e. where post[0] goes to in terms of prior at this speed - int postIndex = 0; + int postIndex = 0;//index of posterior that will contribute + while (postIndex < posterior.arraySize && newPriorIndex < prior.arraySize){ //did use a for loop @@ -335,11 +340,15 @@ }//if not zero - speedValue += relativeSpeedPosterior.scalar; - //optimised line + + speedValue += relativeSpeedPosterior.scalar;//optimised line //as we wanted: // double speedValue = relativeSpeedPosterior.getIndexInRealTerms(i);//so for scalar 0.01, 50 -> speed value of 0.5 + }//end speed + + + printf("after cross c : prior map is %i = %f ms\n", prior.getMAPestimate(), prior.getIndexInRealTerms(prior.getMAPestimate())); }