From: Paul Brossier Date: Tue, 6 Oct 2009 15:02:54 +0000 (+0200) Subject: src/onset/peakpick.h: clean up peakpicker object X-Git-Tag: bzr2git~208 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=422edfb832893f93b9e17a78c25788950c84a028;p=aubio.git src/onset/peakpick.h: clean up peakpicker object --- diff --git a/src/onset/onset.c b/src/onset/onset.c index e7dd31ab..ae739656 100644 --- a/src/onset/onset.c +++ b/src/onset/onset.c @@ -50,7 +50,7 @@ void aubio_onset(aubio_onset_t *o, fvec_t * input, fvec_t * onset) aubio_onsetdetection(o2,fftgrain, onset2); onset->data[0][0] *= onset2->data[0][0]; }*/ - isonset = aubio_peakpick_pimrt(o->of,o->pp); + isonset = aubio_peakpicker_do(o->pp, o->of); if (isonset > 0.) { if (aubio_silence_detection(input, o->silence)==1) { isonset = 0; diff --git a/src/onset/peakpick.c b/src/onset/peakpick.c index 9c8551df..ee2bfe58 100644 --- a/src/onset/peakpick.c +++ b/src/onset/peakpick.c @@ -67,7 +67,7 @@ struct _aubio_pickpeak_t { /** modified version for real time, moving mean adaptive threshold this method * is slightly more permissive than the offline one, and yelds to an increase * of false positives. best */ -smpl_t aubio_peakpick_pimrt(fvec_t * onset, aubio_pickpeak_t * p) { +smpl_t aubio_peakpicker_do(aubio_pickpeak_t * p, fvec_t * onset) { fvec_t * onset_keep = (fvec_t *)p->onset_keep; fvec_t * onset_proc = (fvec_t *)p->onset_proc; fvec_t * onset_peek = (fvec_t *)p->onset_peek; @@ -120,25 +120,12 @@ smpl_t aubio_peakpick_pimrt(fvec_t * onset, aubio_pickpeak_t * p) { /** this method returns the current value in the pick peaking buffer * after smoothing */ -smpl_t aubio_peakpick_pimrt_getval(aubio_pickpeak_t * p) +smpl_t aubio_peakpicker_get_thresholded_input(aubio_pickpeak_t * p) { - uint_t i = 0; - return p->onset_peek->data[i][1]; + return p->onset_peek->data[0][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 isonset = 0; - isonset = aubio_peakpick_pimrt(onset,p); - - //if ( isonset && peakval != NULL ) - if ( peakval != NULL ) - *peakval = aubio_peakpick_pimrt_getval(p); - - return isonset; -} - void aubio_peakpicker_set_threshold(aubio_pickpeak_t * p, smpl_t threshold) { p->threshold = threshold; return; diff --git a/src/onset/peakpick.h b/src/onset/peakpick.h index c28e1089..73ad7282 100644 --- a/src/onset/peakpick.h +++ b/src/onset/peakpick.h @@ -40,11 +40,9 @@ typedef struct _aubio_pickpeak_t aubio_pickpeak_t; /** peak-picker creation function */ aubio_pickpeak_t * new_aubio_peakpicker(smpl_t threshold); /** real time peak picking function */ -smpl_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_peakpicker_do(aubio_pickpeak_t * p, fvec_t * DF); /** get current peak value */ -smpl_t aubio_peakpick_pimrt_getval(aubio_pickpeak_t * p); +smpl_t aubio_peakpicker_get_thresholded_input(aubio_pickpeak_t * p); /** destroy peak picker structure */ void del_aubio_peakpicker(aubio_pickpeak_t * p); diff --git a/src/tempo/tempo.c b/src/tempo/tempo.c index 46f6ea2b..a16a68da 100644 --- a/src/tempo/tempo.c +++ b/src/tempo/tempo.c @@ -68,8 +68,9 @@ void aubio_tempo(aubio_tempo_t *o, fvec_t * input, fvec_t * tempo) o->blockpos = -1; } o->blockpos++; - tempo->data[0][1] = aubio_peakpick_pimrt_wt(o->of,o->pp, - &(o->dfframe->data[0][winlen - step + o->blockpos])); + tempo->data[0][1] = aubio_peakpicker_do (o->pp, o->of); + o->dfframe->data[0][winlen - step + o->blockpos] = + aubio_peakpicker_get_thresholded_input(o->pp); /* end of second level loop */ tempo->data[0][0] = 0; /* reset tactus */ i=0;