From: Paul Brossier Date: Sat, 12 Sep 2009 11:14:53 +0000 (+0200) Subject: examples/aubiotrack.c: compute sample accurate beat position X-Git-Tag: bzr2git~366 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=54a5d5659db6f03a7b7d9c0df7a7571f18315154;p=aubio.git examples/aubiotrack.c: compute sample accurate beat position --- diff --git a/examples/aubiotrack.c b/examples/aubiotrack.c index 6edcd919..070ed8a0 100644 --- a/examples/aubiotrack.c +++ b/examples/aubiotrack.c @@ -23,7 +23,7 @@ unsigned int pos = 0; /* frames%dspblocksize */ uint_t usepitch = 0; fvec_t * out = NULL; aubio_tempo_t * bt = NULL; -uint_t istactus = 0; +smpl_t istactus = 0; int aubio_process(float **input, float **output, int nframes); int aubio_process(float **input, float **output, int nframes) { @@ -42,8 +42,8 @@ int aubio_process(float **input, float **output, int nframes) { if (pos == overlap_size-1) { /* block loop */ aubio_tempo(bt,ibuf,out); - if (out->data[0][0]==1) - istactus = 1; + if (out->data[0][0]>=1) + istactus = out->data[0][0]; else istactus = 0; if (istactus) { @@ -64,8 +64,9 @@ int aubio_process(float **input, float **output, int nframes) { void process_print (void); void process_print (void) { if (output_filename == NULL) { - if (istactus) - outmsg("%f\n",(frames)*overlap_size/(float)samplerate); + if (istactus) { + outmsg("%f\n",((smpl_t)(frames*overlap_size)+(istactus-1.)*overlap_size)/(smpl_t)samplerate); + } if (isonset && verbose) outmsg(" \t \t%f\n",(frames)*overlap_size/(float)samplerate); }