# HG changeset patch # User Andrew N Robertson # Date 1321362612 0 # Node ID 9e972948d6545fe43a895bc3c7d77ea07f87df93 # Parent 3f103cf78148d07a23b78386cf145c7ec27813b7 looking at offline version - need to do updateBestEstimate routine which presently only works for realtime diff -r 3f103cf78148 -r 9e972948d654 .DS_Store Binary file .DS_Store has changed diff -r 3f103cf78148 -r 9e972948d654 src/midiEventHolder.cpp --- a/src/midiEventHolder.cpp Thu Nov 10 17:29:45 2011 +0000 +++ b/src/midiEventHolder.cpp Tue Nov 15 13:10:12 2011 +0000 @@ -6,7 +6,6 @@ * Copyright 2011 QMUL. All rights reserved. * */ -//hello #include "midiEventHolder.h" @@ -148,7 +147,9 @@ // double timeDifference = ofGetElapsedTimeMillis() - bayesStruct.lastEventTime; double timeDifference = timePlayed - bayesStruct.lastEventTime; -// printf("note %i played at %f and last event %f\n", pitch, timePlayed, bayesStruct.lastEventTime); + + + printf("note %i played at %f and last event %f time difference %f and current best estmate %f\n", pitch, timePlayed, bayesStruct.lastEventTime, timeDifference, bayesStruct.bestEstimate); //addnoise to the tempo distribution //bayesStruct.decaySpeedDistribution(timeDifference); if (timeDifference > 50){ @@ -233,6 +234,7 @@ matchString = ""; windowStartTime = max(0.0,(bayesStruct.bestEstimate - matchWindowWidth/2));//was playPositionInMillis + cout << "best estimate is " << bayesStruct.bestEstimate << endl; int numberOfMatches = findMatch(notePitch, windowStartTime, windowStartTime + matchWindowWidth); @@ -329,7 +331,7 @@ matchMatrix.push_back(v); matchConfidence.push_back(d); - printf("BEST MATCH TO note %i,time %i is recorded time %i, confidence %0.2f\n", notePitch, startTime, (int) recordedEventTimes[bestMatchIndex], minimumConfidence); + printf("BEST MATCH TO note %i, start time %i, endtime %i, time %i is recorded time %i, confidence %0.2f\n", notePitch, startTime, endTime, (int) recordedEventTimes[bestMatchIndex], minimumConfidence); return size; } @@ -483,7 +485,10 @@ //actually time since beginning of file i think - double timeDifference = ofGetElapsedTimeMillis() - lastPeriodUpdateTime;//elpased - lastperiodupdatetime + double timeDifference = 0; + if (runningInRealTime) + timeDifference = ofGetElapsedTimeMillis() - lastPeriodUpdateTime;//elpased - lastperiodupdatetime + //this is time diff in milliseconds //then we have double quarterNoteIntervals = (timeDifference / period); diff -r 3f103cf78148 -r 9e972948d654 src/testApp.cpp --- a/src/testApp.cpp Thu Nov 10 17:29:45 2011 +0000 +++ b/src/testApp.cpp Tue Nov 15 13:10:12 2011 +0000 @@ -65,6 +65,20 @@ { stopPlaying(); } + + + + if ( m.getAddress() == "/realtime" ) + { + midiEvents.runningInRealTime = true; + } + + + if ( m.getAddress() == "/offline" ) + { + midiEvents.runningInRealTime = false; + } + }//end while osc }