From 01b8fcc1b4d797f0f001d3a4372d1e7f3c1c5b2d Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 7 Oct 2009 22:58:25 +0200 Subject: [PATCH] src/onset: rename aubio_onsetdetection to aubio_onsetdetection_do --- examples/aubionotes.c | 4 +- examples/aubioonset.c | 4 +- plugins/puredata/aubioonset~.c | 2 +- python/aubio/aubioclass.py | 2 +- src/onset/onset.c | 4 +- src/onset/onsetdetection.c | 2 +- src/onset/onsetdetection.h | 2 +- src/tempo/tempo.c | 4 +- swig/aubio.i | 11 +--- tests/src/test-onsetdetection.c | 91 +++++++++++++++------------------ 10 files changed, 55 insertions(+), 71 deletions(-) diff --git a/examples/aubionotes.c b/examples/aubionotes.c index 8e0c3fcb..43e9da6d 100644 --- a/examples/aubionotes.c +++ b/examples/aubionotes.c @@ -38,9 +38,9 @@ int aubio_process(smpl_t **input, smpl_t **output, int nframes) { if (pos == overlap_size-1) { /* block loop */ aubio_pvoc_do (pv,ibuf, fftgrain); - aubio_onsetdetection(o,fftgrain, onset); + aubio_onsetdetection_do(o,fftgrain, onset); if (usedoubled) { - aubio_onsetdetection(o2,fftgrain, onset2); + aubio_onsetdetection_do(o2,fftgrain, onset2); onset->data[0][0] *= onset2->data[0][0]; } isonset = aubio_peakpicker_do(parms, onset); diff --git a/examples/aubioonset.c b/examples/aubioonset.c index 1d412e31..d0b8d9f7 100644 --- a/examples/aubioonset.c +++ b/examples/aubioonset.c @@ -38,9 +38,9 @@ int aubio_process(smpl_t **input, smpl_t **output, int nframes) { if (pos == overlap_size-1) { /* block loop */ aubio_pvoc_do (pv,ibuf, fftgrain); - aubio_onsetdetection(o,fftgrain, onset); + aubio_onsetdetection_do (o,fftgrain, onset); if (usedoubled) { - aubio_onsetdetection(o2,fftgrain, onset2); + aubio_onsetdetection_do (o2,fftgrain, onset2); onset->data[0][0] *= onset2->data[0][0]; } isonset = aubio_peakpicker_do(parms, onset); diff --git a/plugins/puredata/aubioonset~.c b/plugins/puredata/aubioonset~.c index cdbef7ab..371cea22 100644 --- a/plugins/puredata/aubioonset~.c +++ b/plugins/puredata/aubioonset~.c @@ -46,7 +46,7 @@ static t_int *aubioonset_tilde_perform(t_int *w) if (x->pos == x->hopsize-1) { /* block loop */ aubio_pvoc_do (x->pv,x->vec, x->fftgrain); - aubio_onsetdetection(x->o,x->fftgrain, x->onset); + aubio_onsetdetection_do (x->o,x->fftgrain, x->onset); isonset = aubio_peakpick_pimrt(x->onset,x->parms); if (isonset) { /* test for silence */ diff --git a/python/aubio/aubioclass.py b/python/aubio/aubioclass.py index 277d1fc9..0a5f702d 100644 --- a/python/aubio/aubioclass.py +++ b/python/aubio/aubioclass.py @@ -72,7 +72,7 @@ class onsetdetection: def __init__(self,type,buf,chan): self.od = new_aubio_onsetdetection(type,buf,chan) def do(self,tc,tf): - aubio_onsetdetection(self.od,tc(),tf()) + aubio_onsetdetection_do(self.od,tc(),tf()) def __del__(self): del_aubio_onsetdetection(self.od) diff --git a/src/onset/onset.c b/src/onset/onset.c index c5cff855..a7a80133 100644 --- a/src/onset/onset.c +++ b/src/onset/onset.c @@ -45,9 +45,9 @@ void aubio_onset(aubio_onset_t *o, fvec_t * input, fvec_t * onset) uint_t isonset = 0; uint_t wasonset = o->wasonset; aubio_pvoc_do (o->pv,input, o->fftgrain); - aubio_onsetdetection(o->od,o->fftgrain, o->of); + aubio_onsetdetection_do (o->od,o->fftgrain, o->of); /*if (usedoubled) { - aubio_onsetdetection(o2,fftgrain, onset2); + aubio_onsetdetection_do (o2,fftgrain, onset2); onset->data[0][0] *= onset2->data[0][0]; }*/ isonset = aubio_peakpicker_do(o->pp, o->of); diff --git a/src/onset/onsetdetection.c b/src/onset/onsetdetection.c index 4bc53e28..62163808 100644 --- a/src/onset/onsetdetection.c +++ b/src/onset/onsetdetection.c @@ -295,7 +295,7 @@ void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, /* Generic function pointing to the choosen one */ void -aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, +aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset) { o->funcpointer(o,fftgrain,onset); } diff --git a/src/onset/onsetdetection.h b/src/onset/onsetdetection.h index 0c044ceb..978005a1 100644 --- a/src/onset/onsetdetection.h +++ b/src/onset/onsetdetection.h @@ -61,7 +61,7 @@ typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t; \param onset output vector (one sample long, to send to the peak picking) */ -void aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); +void aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); /** creation of an onset detection object \param type onset detection mode diff --git a/src/tempo/tempo.c b/src/tempo/tempo.c index 6b7a7d43..2d949c0d 100644 --- a/src/tempo/tempo.c +++ b/src/tempo/tempo.c @@ -51,9 +51,9 @@ void aubio_tempo_do(aubio_tempo_t *o, fvec_t * input, fvec_t * tempo) uint_t winlen = o->winlen; uint_t step = o->step; aubio_pvoc_do (o->pv, input, o->fftgrain); - aubio_onsetdetection(o->od, o->fftgrain, o->of); + aubio_onsetdetection_do (o->od, o->fftgrain, o->of); /*if (usedoubled) { - aubio_onsetdetection(o2,fftgrain, onset2); + aubio_onsetdetection_do(o2,fftgrain, onset2); onset->data[0][0] *= onset2->data[0][0]; }*/ /* execute every overlap_size*step */ diff --git a/swig/aubio.i b/swig/aubio.i index 892660ef..f68bf2c6 100644 --- a/swig/aubio.i +++ b/swig/aubio.i @@ -198,18 +198,9 @@ typedef enum { aubio_onset_specflux, } aubio_onsetdetection_type; aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels); -void aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); +void aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); void del_aubio_onsetdetection(aubio_onsetdetection_t *o); -/* should these still be exposed ? */ -void aubio_onsetdetection_energy (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); -void aubio_onsetdetection_hfc (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); -void aubio_onsetdetection_complex (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); -void aubio_onsetdetection_phase (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); -void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); -void aubio_onsetdetection_kl (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); -void aubio_onsetdetection_mkl (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); - /* pvoc */ aubio_pvoc_t * new_aubio_pvoc (uint_t win_s, uint_t hop_s, uint_t channels); void del_aubio_pvoc(aubio_pvoc_t *pv); diff --git a/tests/src/test-onsetdetection.c b/tests/src/test-onsetdetection.c index 0efa3639..64a780e6 100644 --- a/tests/src/test-onsetdetection.c +++ b/tests/src/test-onsetdetection.c @@ -1,54 +1,47 @@ #include -int main(){ - /* allocate some memory */ - uint_t win_s = 1024; /* window size */ - uint_t channels = 1; /* number of channel */ - cvec_t * in = new_cvec (win_s, channels); /* input buffer */ - fvec_t * out = new_fvec (1, channels); /* input buffer */ +int +main () +{ + uint_t win_s = 1024; /* window size */ + uint_t channels = 1; /* number of channel */ + cvec_t *in = new_cvec (win_s, channels); /* input buffer */ + fvec_t *out = new_fvec (1, channels); /* input buffer */ + + aubio_onsetdetection_t *o; - /* allocate fft and other memory space */ - aubio_onsetdetection_t * o = - new_aubio_onsetdetection(aubio_onset_energy, win_s, channels); - aubio_onsetdetection(o,in,out); - aubio_onsetdetection_energy(o,in,out); - del_aubio_onsetdetection(o); - - o = new_aubio_onsetdetection(aubio_onset_specdiff, win_s, channels); - aubio_onsetdetection(o,in,out); - aubio_onsetdetection_specdiff(o,in,out); - del_aubio_onsetdetection(o); - - o = new_aubio_onsetdetection(aubio_onset_hfc, win_s, channels); - aubio_onsetdetection(o,in,out); - aubio_onsetdetection_hfc(o,in,out); - del_aubio_onsetdetection(o); - - o = new_aubio_onsetdetection(aubio_onset_complex, win_s, channels); - aubio_onsetdetection(o,in,out); - aubio_onsetdetection_complex(o,in,out); - del_aubio_onsetdetection(o); - - o = new_aubio_onsetdetection(aubio_onset_phase, win_s, channels); - aubio_onsetdetection(o,in,out); - aubio_onsetdetection_phase(o,in,out); - del_aubio_onsetdetection(o); - - o = new_aubio_onsetdetection(aubio_onset_kl, win_s, channels); - aubio_onsetdetection(o,in,out); - aubio_onsetdetection_kl(o,in,out); - del_aubio_onsetdetection(o); - - o = new_aubio_onsetdetection(aubio_onset_mkl, win_s, channels); - aubio_onsetdetection(o,in,out); - aubio_onsetdetection_mkl(o,in,out); - del_aubio_onsetdetection(o); - - del_cvec(in); - del_fvec(out); - aubio_cleanup(); - - return 0; -} + o = new_aubio_onsetdetection (aubio_onset_energy, win_s, channels); + aubio_onsetdetection_do (o, in, out); + del_aubio_onsetdetection (o); + + o = new_aubio_onsetdetection (aubio_onset_specdiff, win_s, channels); + aubio_onsetdetection_do (o, in, out); + del_aubio_onsetdetection (o); + + o = new_aubio_onsetdetection (aubio_onset_hfc, win_s, channels); + aubio_onsetdetection_do (o, in, out); + del_aubio_onsetdetection (o); + + o = new_aubio_onsetdetection (aubio_onset_complex, win_s, channels); + aubio_onsetdetection_do (o, in, out); + del_aubio_onsetdetection (o); + + o = new_aubio_onsetdetection (aubio_onset_phase, win_s, channels); + aubio_onsetdetection_do (o, in, out); + del_aubio_onsetdetection (o); + o = new_aubio_onsetdetection (aubio_onset_kl, win_s, channels); + aubio_onsetdetection_do (o, in, out); + del_aubio_onsetdetection (o); + + o = new_aubio_onsetdetection (aubio_onset_mkl, win_s, channels); + aubio_onsetdetection_do (o, in, out); + del_aubio_onsetdetection (o); + + del_cvec (in); + del_fvec (out); + aubio_cleanup (); + + return 0; +} -- 2.26.2