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 e7dd31ab7c07b7b5d31322c8e283571e1da939b0..ae739656134e21ac74abda94c286c255998f6b7d 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 9c8551df70ea9682a2beb52c34a54d35a5331ddd..ee2bfe58bf5e150d64dc17f9280f6f87302316a7 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 c28e1089e4becec9d4bc89c23b20d14bccf9d1dd..73ad728227ae52514cf9c43b6e550fd05517dccb 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 46f6ea2b615fe3f56d9a0ff0832fbce45fdb19ec..a16a68daaa5d53330bb8047c705ca82009f2e5cb 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;