add _getval method to explicitely get the peak picked value
authorPaul Brossier <piem@altern.org>
Thu, 22 Dec 2005 16:30:24 +0000 (16:30 +0000)
committerPaul Brossier <piem@altern.org>
Thu, 22 Dec 2005 16:30:24 +0000 (16:30 +0000)
add _getval method to explicitely get the peak picked value

src/peakpick.c
src/peakpick.h

index 1a686ef0800b1c725683ffd04dd58e311ad740a8..cc6411fb9ab5ba309c92aa610d41bcf4be53aa15 100644 (file)
@@ -112,15 +112,24 @@ uint_t aubio_peakpick_pimrt(fvec_t * onset,  aubio_pickpeak_t * p) {
        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;
 }
index 0c0426b341d421758ff7cdf955bff874ade3d4ba..75552655b26ddbe059229cc255d9e5bafebe6b90 100644 (file)
@@ -38,6 +38,7 @@ aubio_pickpeak_t * new_aubio_peakpicker(smpl_t threshold);
 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);