src/onset/peakpick.h: clean up peakpicker object
authorPaul Brossier <piem@piem.org>
Tue, 6 Oct 2009 15:02:54 +0000 (17:02 +0200)
committerPaul Brossier <piem@piem.org>
Tue, 6 Oct 2009 15:02:54 +0000 (17:02 +0200)
src/onset/onset.c
src/onset/peakpick.c
src/onset/peakpick.h
src/tempo/tempo.c

index e7dd31a..ae73965 100644 (file)
@@ -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;
index 9c8551d..ee2bfe5 100644 (file)
@@ -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;
index c28e108..73ad728 100644 (file)
@@ -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);
 
index 46f6ea2..a16a68d 100644 (file)
@@ -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;