add aubio_ to pitch detection modes
authorPaul Brossier <piem@altern.org>
Sun, 22 May 2005 10:40:37 +0000 (10:40 +0000)
committerPaul Brossier <piem@altern.org>
Sun, 22 May 2005 10:40:37 +0000 (10:40 +0000)
add aubio_ to pitch detection modes

examples/utils.c
src/pitchdetection.c
src/pitchdetection.h

index 6741840..d4f88bb 100644 (file)
@@ -58,7 +58,7 @@ aubio_pickpeak_t * parms;
 /* pitch objects */
 smpl_t pitch               = 0.;
 aubio_pitchdetection_t * pitchdet;
-aubio_pitchdetection_type mode = yin; // mcomb
+aubio_pitchdetection_type mode = aubio_yin; // aubio_mcomb
 uint_t median         = 6;
 
 fvec_t * note_buffer  = NULL;
@@ -217,7 +217,8 @@ void examples_common_init(int argc,char ** argv) {
   fftgrain  = new_cvec(buffer_size, channels);
 
   if (usepitch) {
-    pitchdet = new_aubio_pitchdetection(buffer_size*4, overlap_size, channels, samplerate, mode, freq);
+    pitchdet = new_aubio_pitchdetection(buffer_size*4, 
+                    overlap_size, channels, samplerate, mode, aubio_freq);
   
   if (median) {
           note_buffer = new_fvec(median, 1);
index 038988a..71dbf5b 100644 (file)
@@ -52,11 +52,11 @@ aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize,
        p->type = type;
        p->bufsize = bufsize;
        switch(p->type) {
-               case yin:
+               case aubio_yin:
                        p->buf      = new_fvec(bufsize,channels);
                        p->yin      = new_fvec(bufsize/2,channels);
                        break;
-               case mcomb:
+               case aubio_mcomb:
                        p->pv       = new_aubio_pvoc(bufsize, hopsize, channels);
                        p->fftgrain = new_cvec(bufsize, channels);
                        p->filter   = new_aubio_adsgn_filter((smpl_t)samplerate);
@@ -70,11 +70,11 @@ aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize,
 
 void del_aubio_pitchdetection(aubio_pitchdetection_t * p) {
        switch(p->type) {
-               case yin:
+               case aubio_yin:
                        del_fvec(p->yin);
                        del_fvec(p->buf);
                        break;
-               case mcomb:
+               case aubio_mcomb:
                        del_aubio_pvoc(p->pv);
                        del_cvec(p->fftgrain);
                        //del_aubio_adsgn_filter(p->filter);
@@ -91,7 +91,7 @@ smpl_t aubio_pitchdetection(aubio_pitchdetection_t *p, fvec_t * ibuf) {
        smpl_t pitch = 0.;
        uint_t i,j = 0;
        switch(p->type) {
-               case yin:
+               case aubio_yin:
                        /* do sliding window blocking */
                        for (i=0;i<p->buf->channels;i++){
                                for (j=0;j<p->buf->length-ibuf->length;j++){
@@ -110,7 +110,7 @@ smpl_t aubio_pitchdetection(aubio_pitchdetection_t *p, fvec_t * ibuf) {
                                pitch = 0.;
                        }
                        break;
-               case mcomb:
+               case aubio_mcomb:
                        aubio_filter_do(p->filter,ibuf);
                        aubio_filter_do(p->filter,ibuf);
                        aubio_pvoc_do(p->pv,ibuf,p->fftgrain);
index 9ab49a1..220a6bb 100644 (file)
@@ -24,15 +24,15 @@ extern "C" {
 #endif
 
 typedef enum {
-       yin,
-       mcomb
+       aubio_yin,
+       aubio_mcomb
 } aubio_pitchdetection_type;
 
 typedef enum {
-       freq,
-       midi,
-       cent,
-       bin
+       aubio_freq,
+       aubio_midi,
+       aubio_cent,
+       aubio_bin
 } aubio_pitchdetection_mode;
 
 typedef struct _aubio_pitchdetection_t aubio_pitchdetection_t;