From 3684ab46aec73be1c65fd8d989dec0f02492009a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 3 Mar 2013 13:40:05 -0500 Subject: [PATCH] tests/src/temporal/: improve examples --- tests/src/temporal/test-a_weighting.c | 3 ++- tests/src/temporal/test-biquad.c | 3 ++- tests/src/temporal/test-c_weighting.c | 4 ++-- tests/src/temporal/test-filter.c | 18 +++++++----------- tests/src/temporal/test-resampler.c | 11 ++++------- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/tests/src/temporal/test-a_weighting.c b/tests/src/temporal/test-a_weighting.c index 64915b25..3ac3c263 100644 --- a/tests/src/temporal/test-a_weighting.c +++ b/tests/src/temporal/test-a_weighting.c @@ -1,6 +1,7 @@ #include -int main(){ +int main () +{ aubio_filter_t * f; diff --git a/tests/src/temporal/test-biquad.c b/tests/src/temporal/test-biquad.c index 4991f728..33c1ca00 100644 --- a/tests/src/temporal/test-biquad.c +++ b/tests/src/temporal/test-biquad.c @@ -1,6 +1,7 @@ #include -int main () { +int main () +{ uint_t win_s = 64; // window size // create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2` diff --git a/tests/src/temporal/test-c_weighting.c b/tests/src/temporal/test-c_weighting.c index d5283fc3..dccaa582 100644 --- a/tests/src/temporal/test-c_weighting.c +++ b/tests/src/temporal/test-c_weighting.c @@ -1,7 +1,7 @@ #include -int main(){ - +int main () +{ aubio_filter_t * f; uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000}; diff --git a/tests/src/temporal/test-filter.c b/tests/src/temporal/test-filter.c index 84409d05..15446350 100644 --- a/tests/src/temporal/test-filter.c +++ b/tests/src/temporal/test-filter.c @@ -1,13 +1,10 @@ #include -int -main (void) +int main () { - /* allocate some memory */ - uint_t win_s = 32; /* window size */ - fvec_t *in = new_fvec (win_s); /* input buffer */ - fvec_t *out = new_fvec (win_s); /* input buffer */ - + uint_t win_s = 32; // window size + fvec_t *in = new_fvec (win_s); // input buffer + fvec_t *out = new_fvec (win_s); // input buffer aubio_filter_t *o = new_aubio_filter_c_weighting (44100); in->data[12] = 0.5; @@ -16,22 +13,21 @@ main (void) fvec_print (in); del_aubio_filter (o); - o = new_aubio_filter_c_weighting (44100); + o = new_aubio_filter_a_weighting (32000); in->data[12] = 0.5; fvec_print (in); aubio_filter_do_outplace (o, in, out); fvec_print (out); - del_aubio_filter (o); - o = new_aubio_filter_c_weighting (44100); + aubio_filter_set_a_weighting (o, 32000); in->data[12] = 0.5; fvec_print (in); aubio_filter_do_filtfilt (o, in, out); fvec_print (out); - del_aubio_filter (o); del_fvec (in); del_fvec (out); + del_aubio_filter (o); aubio_cleanup (); return 0; diff --git a/tests/src/temporal/test-resampler.c b/tests/src/temporal/test-resampler.c index b28bf9a9..1ac65e96 100644 --- a/tests/src/temporal/test-resampler.c +++ b/tests/src/temporal/test-resampler.c @@ -1,14 +1,11 @@ -#include #include -int -main () +int main () { - /* allocate some memory */ - uint_t win_s = 1024; /* window size */ + uint_t win_s = 1024; // window size smpl_t ratio = 0.5; - fvec_t *in = new_fvec (win_s); /* input buffer */ - fvec_t *out = new_fvec ((uint_t) (win_s * ratio)); /* input buffer */ + fvec_t *in = new_fvec (win_s); // input buffer + fvec_t *out = new_fvec ((uint_t) (win_s * ratio)); // output buffer aubio_resampler_t *o = new_aubio_resampler (0.5, 0); uint_t i = 0; -- 2.26.2