From f2adb86b158fa279449c5d596de8704159ad2428 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 22 Dec 2005 16:30:24 +0000 Subject: [PATCH] add _getval method to explicitely get the peak picked value add _getval method to explicitely get the peak picked value --- src/peakpick.c | 13 +++++++++++-- src/peakpick.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/peakpick.c b/src/peakpick.c index 1a686ef0..cc6411fb 100644 --- a/src/peakpick.c +++ b/src/peakpick.c @@ -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; } diff --git a/src/peakpick.h b/src/peakpick.h index 0c0426b3..75552655 100644 --- a/src/peakpick.h +++ b/src/peakpick.h @@ -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); -- 2.26.2