shithub: aubio

Download patch

ref: f2adb86b158fa279449c5d596de8704159ad2428
parent: 4f4a8a4fdc1225669e4f821cc96945524c6addb0
author: Paul Brossier <piem@altern.org>
date: Thu Dec 22 11:30:24 EST 2005

add _getval method to explicitely get the peak picked value
add _getval method to explicitely get the peak picked value


--- a/src/peakpick.c
+++ b/src/peakpick.c
@@ -112,15 +112,24 @@
 	return (p->pickerfn)(onset_peek,1);
 }
 
+/** this method returns the current value in the pick peaking buffer
+ * after smoothing
+ */
+smpl_t aubio_peakpick_pimrt_getval(aubio_pickpeak_t * p) 
+{
+	uint_t i = 0;
+	return p->onset_peek->data[i][1];
+}
+
 /** function added by Miguel Ramirez to return the onset detection amplitude in peakval */
 uint_t aubio_peakpick_pimrt_wt(fvec_t * onset,  aubio_pickpeak_t * p, smpl_t* peakval) 
 {
-	uint_t i = 0, isonset = 0;
+	uint_t isonset = 0;
 	isonset = aubio_peakpick_pimrt(onset,p);
 
 	//if ( isonset && peakval != NULL )
 	if ( peakval != NULL )
-		*peakval = p->onset_peek->data[i][1];
+		*peakval = aubio_peakpick_pimrt_getval(p); 
 
 	return isonset;
 }
--- a/src/peakpick.h
+++ b/src/peakpick.h
@@ -38,6 +38,7 @@
 uint_t aubio_peakpick_pimrt(fvec_t * DF, aubio_pickpeak_t * p);
 /** function added by Miguel Ramirez to return the onset detection amplitude in peakval */
 uint_t aubio_peakpick_pimrt_wt( fvec_t* DF, aubio_pickpeak_t* p, smpl_t* peakval );
+smpl_t aubio_peakpick_pimrt_getval(aubio_pickpeak_t * p);
 void del_aubio_peakpicker(aubio_pickpeak_t * p);
 
 void aubio_peakpicker_set_threshold(aubio_pickpeak_t * p, smpl_t threshold);