diff jnmr/testApp.cpp @ 48:803edc47e825

Adding files, possibly some minor code changes
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 06 Mar 2012 17:11:46 +0000
parents 43edc8abe2a7
children 3ce6dadd8167
line wrap: on
line diff
--- a/jnmr/testApp.cpp	Sun Feb 05 22:07:55 2012 +0000
+++ b/jnmr/testApp.cpp	Tue Mar 06 17:11:46 2012 +0000
@@ -5,6 +5,7 @@
 	this->args = args;
 }
 
+
 //--------------------------------------------------------------
 void testApp::setup(){
 
@@ -17,7 +18,7 @@
 	
 	
 	
-//	diffFile.open("../../../data/FilesOut/diffTest.txt");
+// 	diffFile.open("../../../data/FilesOut/diffTest.txt");
 	
 	midiEvents.fileOutput = &myfile;
 	midiEvents.differenceOutput = &diffFile;
@@ -102,6 +103,14 @@
 		midiEvents.updatePlayPosition();//this fn calls	midiEvents.bayesStruct.updateBestEstimate();
 	}
 //	drawer.tickLocation+=20;
+	checkOSCmessages();
+	
+	if (midiEvents.recordedEventTimes.size() > 0)
+	checkNewScoreNote();
+	
+}
+
+void testApp::checkOSCmessages(){
 	
 	// check for waiting messages
 	while( receiver.hasWaitingMessages() )
@@ -120,11 +129,11 @@
 					startPlaying();
 					printf("starting to PLAY!!!");
 				}
-			//	printf("MIDI NOTE %i \n", newMidiOnPitch);
+				//	printf("MIDI NOTE %i \n", newMidiOnPitch);
 				midiEvents.newNoteOnEvent(newMidiOnPitch, velocity, time);
 				noteInStream.newNoteCounted(newMidiOnPitch);//counts notes for an overall score
 			}
-
+			
 		}
 		
 		if ( m.getAddress() == "/setSpeedPrior" )
@@ -137,7 +146,7 @@
 		
 		if ( m.getAddress() == "/startplaying" )
 		{
-//			prepareToStartOnNextNote();
+			//			prepareToStartOnNextNote();
 			startPlaying();
 		}
 		
@@ -151,7 +160,7 @@
 		{
 			midiEvents.bayesStruct.usingIntegratedTempoEstimate = true;
 		}
-	
+		
 		if ( m.getAddress() == "/MAPestimate" )
 		{
 			midiEvents.bayesStruct.usingIntegratedTempoEstimate = false;
@@ -171,15 +180,15 @@
 		
 		if ( m.getAddress() == "/minimumSpeedRatio" )
 		{
-				
+			
 			float minSpeed = m.getArgAsFloat(0);
 			//printf("minimum speed received is  %f and max is %f\n", minSpeed, midiEvents.bayesStruct.relativeSpeedLikelihood.getIndexInRealTerms(midiEvents.bayesStruct.relativeSpeedLikelihood.length-1));
 			if (minSpeed > 0 && minSpeed < midiEvents.bayesStruct.relativeSpeedLikelihood.getIndexInRealTerms(midiEvents.bayesStruct.relativeSpeedLikelihood.length-1)){
-			printf("minimum speed accepted is %f\n", minSpeed);
+				printf("minimum speed accepted is %f\n", minSpeed);
 				midiEvents.minimumMatchSpeed = minSpeed;
 			}
 		}
-
+		
 		if ( m.getAddress() == "/maximumSpeedRatio" )
 		{
 			
@@ -200,7 +209,7 @@
 				midiEvents.likelihoodToNoiseRatio = ratio;
 				printf("likelihood for events relative to noise uses ratio %f\n", ratio);
 			}
-		
+			
 		}
 		
 		if ( m.getAddress() == "/duration" )
@@ -223,9 +232,6 @@
 		
 	}//end while osc
 	
-	if (midiEvents.recordedEventTimes.size() > 0)
-	checkNewScoreNote();
-	
 }