changeset 5:eba88b84b5ca

added external, some code changes
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Mon, 22 Oct 2012 20:25:14 +0100
parents fb106f14e0a4
children 6a95d8b80393
files Source/AubioOnsetDetector.cpp Source/aubioOnsetDetect~.cpp aubioOnsetDetectorOFvisualiser/src/testApp.cpp maxExternals/aubioOnsetDetect~.mxo/Contents/MacOS/aubioOnsetDetect~
diffstat 4 files changed, 19 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/Source/AubioOnsetDetector.cpp	Thu Oct 18 17:12:05 2012 +0100
+++ b/Source/AubioOnsetDetector.cpp	Mon Oct 22 20:25:14 2012 +0100
@@ -66,7 +66,9 @@
 				fvec_write_sample(vec, 0.234, 0, pos);
 				fftgrain  = (cvec_t *)new_cvec(buffersize,1);
 				onset = (fvec_t *)new_fvec(1,1);
-		}
+
+	resetValues();
+}
 
 bool AubioOnsetDetector :: processframe(float frame[], int n){
 	bool newFrameResult = false;
@@ -182,7 +184,6 @@
 	if (recentValueIndex == numberOfDetectionValues)
 	recentValueIndex = 0;
 
-		
 	return bestValue;
 	
 }
--- a/Source/aubioOnsetDetect~.cpp	Thu Oct 18 17:12:05 2012 +0100
+++ b/Source/aubioOnsetDetect~.cpp	Mon Oct 22 20:25:14 2012 +0100
@@ -108,8 +108,8 @@
 	//x->onsetDetector = new AubioOnsetDetector();
 	x->onsetDetector->buffersize = x->bufsize;
 	x->onsetDetector->hopsize = x->hopsize;
-	x->onsetDetector->threshold = x->threshold;
-	x->onsetDetector->threshold2 = x->threshold2;
+//	x->onsetDetector->threshold = x->threshold;
+//	x->onsetDetector->threshold2 = x->threshold2;
 	x->onsetDetector->initialise();
 }
 
@@ -122,8 +122,8 @@
 //	x->onsetDetector = new AubioOnsetDetector();
 	x->onsetDetector->buffersize = x->bufsize;
 	x->onsetDetector->hopsize = x->hopsize;
-	x->onsetDetector->threshold = x->threshold;
-	x->onsetDetector->threshold2 = x->threshold2;
+//	x->onsetDetector->threshold = x->threshold;
+//	x->onsetDetector->threshold2 = x->threshold2;
 	x->onsetDetector->initialise();
 	}
 }
@@ -322,22 +322,21 @@
 	//note for C++ programmers:
 	//adding (t_class *) in the line below lets you use .cpp files instead 
 	//then just change your external code to .cpp instead of c
+	
 	if (x = (t_aubioOnsetDetect *)object_alloc((t_class *) aubioOnsetDetect_class)) {
 		dsp_setup((t_pxobject *)x, 1);	// MSP inlets: arg is # of inlets and is REQUIRED! 
 										// use 0 if you don't need inlets
 
+		//set outlets, from right to left
 		x->medianDetectionFunctionOutlet = floatout(x);
 		x->medianBangOutlet  = bangout(x);
 		x->rawDetectionFunctionOutlet = floatout(x);		
 		x->detectionFunctionOutlet = floatout(x);
 		x->bangoutlet  = bangout(x);
 
-	//	outlet_new(x, "signal"); // signal outlet (note "signal" rather than NULL)
-
+		//aubio params
 		x->threshold = 1;
 		x->threshold2 = -70.;
-
-		//
 		
 		if (argc > 1){
 			t_atom my_atom = argv[1];
--- a/aubioOnsetDetectorOFvisualiser/src/testApp.cpp	Thu Oct 18 17:12:05 2012 +0100
+++ b/aubioOnsetDetectorOFvisualiser/src/testApp.cpp	Mon Oct 22 20:25:14 2012 +0100
@@ -17,7 +17,6 @@
 
 	ofBackground( 30, 30, 130 );
 
-
 	outputGraphics = false;
 	
 	maximumDetectionFunction = 20;
@@ -51,8 +50,7 @@
 
 //--------------------------------------------------------------
 void testApp::update(){
-maxValue *= 0.995;
-	// hide old messages
+	maxValue *= 0.995;
 
 	// check for waiting messages
 	while( receiver.hasWaitingMessages() )
@@ -61,9 +59,6 @@
 		ofxOscMessage m;
 		receiver.getNextMessage( &m );
 
-			// unrecognized message: display on the bottom of the screen
-	//		string msg_string;
-	//		msg_string = m.getAddress();
 			if (m.getAddress() == "/aubioData" ){
 			
 				if( m.getArgType( 0 ) == OFXOSC_TYPE_FLOAT ){
@@ -291,7 +286,7 @@
 	int Xindex = (onsetIndex-Xvalue) ;
 	int previousIndex = (Xindex-1);
 	
-	//below - Paule's processed onsets	
+	//below - Paul's processed onsets	
 	ofSetColor(55,100,255);
 
 	ofLine((int) (width*(amplitudeNumber - Xvalue - 1)), screenHeight - (scale_factor*(onsetFunction[previousIndex]- minimumValue)), 
@@ -302,10 +297,10 @@
 		ofCircle(width*(amplitudeNumber - Xvalue), screenHeight - (scale_factor*(onsetFunction[Xindex]- minimumValue)) , 3);
 	}
 	
-//specDiffOnsets	
+	//specDiffOnsets	
 	ofSetColor(55,100,55);
- Xindex = (rawOnsetIndex-Xvalue) ;
- previousIndex = (Xindex-1);
+	Xindex = (rawOnsetIndex-Xvalue);
+	previousIndex = (Xindex-1);
 
 	ofLine((int) (width*(amplitudeNumber - Xvalue - 1)), screenHeight - (scale_factor*(rawOnsetFunction[previousIndex]- minimumValue)), 
 			(int) (width*(amplitudeNumber - Xvalue)),  screenHeight - (scale_factor*(rawOnsetFunction[Xindex]- minimumValue)) );
@@ -320,10 +315,10 @@
 		
 		
 		
-	if (rawOnsetRecorded[Xindex] == true){
-		ofSetColor(255,100,0);
-		ofCircle(width*(amplitudeNumber - Xvalue), screenHeight - (scale_factor*(rawOnsetFunction[Xindex]- minimumValue)) , 3);
-	}
+		if (rawOnsetRecorded[Xindex] == true){
+			ofSetColor(255,100,0);
+			ofCircle(width*(amplitudeNumber - Xvalue), screenHeight - (scale_factor*(rawOnsetFunction[Xindex]- minimumValue)) , 3);
+		}
 		
 		//median onsets in red
 		if (medianOnsetRecorded[Xindex] == true){
@@ -331,13 +326,6 @@
 			ofCircle(width*(amplitudeNumber - Xvalue), screenHeight - (scale_factor*(medianOnsetFunction[Xindex]- minimumValue)) , 3);
 		}
 		
-		
-		/*
-	if (medianOnsetRecorded[Xindex] == true){
-		ofSetColor(255,0,0);
-		ofCircle(width*(amplitudeNumber - Xvalue), screenHeight - (scale_factor*(medianOnsetFunction[Xindex]- minimumValue)) , 3);
-	}	
-	*/
 		ofSetColor(255,100,0);
 		
 	}//end for Xvalue (across the recent observations of osc data)
Binary file maxExternals/aubioOnsetDetect~.mxo/Contents/MacOS/aubioOnsetDetect~ has changed