From 5d1f716d0a6ce26298befa58d87e5a6dc938fa76 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 15 Jul 2012 14:48:21 -0600 Subject: [PATCH] tests/src/io/test-sink.c: added simple test --- tests/src/io/test-sink.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/src/io/test-sink.c diff --git a/tests/src/io/test-sink.c b/tests/src/io/test-sink.c new file mode 100644 index 00000000..cf57536b --- /dev/null +++ b/tests/src/io/test-sink.c @@ -0,0 +1,30 @@ +#include +#include +#include "config.h" + +char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; +char_t *outpath = "/var/tmp/test.wav"; + +int main(){ + int err = 0; + uint_t samplerate = 44100; + uint_t hop_size = 512; + uint_t read = hop_size; + fvec_t *vec = new_fvec(hop_size); + aubio_source_t * i = new_aubio_source(path, samplerate, hop_size); + aubio_sink_t * o = new_aubio_sink(outpath, samplerate); + + if (!i || !o) { err = -1; goto beach; } + + while ( read == hop_size ) { + aubio_source_do(i, vec, &read); + aubio_sink_do(o, vec, read); + } + +beach: + del_aubio_source(i); + del_aubio_sink(o); + del_fvec(vec); + return err; +} + -- 2.26.2