examples/: simplify, use fvec_ funcs
authorPaul Brossier <piem@piem.org>
Sun, 25 Oct 2009 20:33:24 +0000 (21:33 +0100)
committerPaul Brossier <piem@piem.org>
Sun, 25 Oct 2009 20:33:24 +0000 (21:33 +0100)
examples/aubiomfcc.c
examples/aubioonset.c
examples/aubiopitch.c
examples/aubiotrack.c

index d7d1ebf..4dc9995 100644 (file)
@@ -70,7 +70,7 @@ static void process_print (void) {
       if (output_filename == NULL) {
         outmsg("%f\t",frames*overlap_size/(float)samplerate);
         for (coef_cnt = 0; coef_cnt < n_coefs; coef_cnt++) {
-            outmsg("%f ",mfcc_out->data[0][coef_cnt]);
+            outmsg("%f ", fvec_read_sample (mfcc_out, 0, coef_cnt) );
         }
         outmsg("\n");
       }
index 9cd9654..df081b6 100644 (file)
@@ -40,13 +40,9 @@ static int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
       /* block loop */
       aubio_onset_do (o, ibuf, onset);
       if (fvec_read_sample(onset, 0, 0)) {
-        for (pos = 0; pos < overlap_size; pos++){
-          obuf->data[0][pos] = woodblock->data[0][pos];
-        }
+        fvec_copy (woodblock, obuf);
       } else {
-        for (pos = 0; pos < overlap_size; pos++) {
-          obuf->data[0][pos] = 0.;
-        }
+        fvec_zeros (obuf);
       }
       /* end of block loop */
       pos = -1; /* so it will be zero next j loop */
index c362c01..d8b8046 100644 (file)
@@ -41,12 +41,10 @@ static int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
       aubio_pitch_do (o, ibuf, pitch);
       if (fvec_read_sample(pitch, 0, 0)) {
         for (pos = 0; pos < overlap_size; pos++){
-          obuf->data[0][pos] = woodblock->data[0][pos];
+          // TODO, play sine at this freq
         }
       } else {
-        for (pos = 0; pos < overlap_size; pos++) {
-          obuf->data[0][pos] = 0.;
-        }
+        fvec_zeros (obuf);
       }
       /* end of block loop */
       pos = -1; /* so it will be zero next j loop */
index 8e9b84e..b69ac4b 100644 (file)
@@ -41,20 +41,12 @@ static int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
     if (pos == overlap_size-1) {         
       /* block loop */
       aubio_tempo_do (bt,ibuf,tempo_out);
-      if (tempo_out->data[0][0]>0) 
-        istactus = tempo_out->data[0][0];
-      else 
-        istactus = 0;
-      if (tempo_out->data[0][1]>0) 
-        isonset = tempo_out->data[0][0];
-      else 
-        isonset = 0;
-      if (istactus) {
-              for (pos = 0; pos < overlap_size; pos++)
-                      obuf->data[0][pos] = woodblock->data[0][pos];
+      istactus = fvec_read_sample (tempo_out, 0, 0);
+      isonset = fvec_read_sample (tempo_out, 0, 1);
+      if (istactus > 0.) {
+        fvec_copy (woodblock, obuf);
       } else {
-              for (pos = 0; pos < overlap_size; pos++)
-                      obuf->data[0][pos] = 0.;
+        fvec_zeros (obuf);
       }
       /* end of block loop */
       pos = -1; /* so it will be zero next j loop */