From 77b2e3037f12f98da3e1f3cc5ce2333d49dab773 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 16 Dec 2018 20:49:47 +0100 Subject: [PATCH] [tests] remove test-sink_*-multi, now redundant --- tests/src/io/test-sink-multi.c | 72 --------------------------- tests/src/io/test-sink_apple_audio-multi.c | 78 ------------------------------ tests/src/io/test-sink_sndfile-multi.c | 78 ------------------------------ tests/src/io/test-sink_wavwrite-multi.c | 78 ------------------------------ 4 files changed, 306 deletions(-) delete mode 100644 tests/src/io/test-sink-multi.c delete mode 100644 tests/src/io/test-sink_apple_audio-multi.c delete mode 100644 tests/src/io/test-sink_sndfile-multi.c delete mode 100644 tests/src/io/test-sink_wavwrite-multi.c diff --git a/tests/src/io/test-sink-multi.c b/tests/src/io/test-sink-multi.c deleted file mode 100644 index f30aa059..00000000 --- a/tests/src/io/test-sink-multi.c +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include "utils_tests.h" - -// same as test-sink.c, but uses aubio_source_do_multi to read multiple -// channels - -int main (int argc, char **argv) -{ - sint_t err = 0; - - if (argc < 3) { - PRINT_ERR("not enough arguments, running tests\n"); - err = run_on_default_source_and_sink(main); - PRINT_MSG("usage: %s [samplerate] [channels] [hop_size]\n", argv[0]); - return err; - } - - uint_t samplerate = 0; - uint_t channels = 0; - uint_t hop_size = 512; - uint_t n_frames = 0, read = 0; - - char_t *source_path = argv[1]; - char_t *sink_path = argv[2]; - - if ( argc >= 4 ) samplerate = atoi(argv[3]); - if ( argc >= 5 ) channels = atoi(argv[4]); - if ( argc >= 6 ) hop_size = atoi(argv[5]); - if ( argc >= 7 ) { - err = 2; - PRINT_ERR("too many arguments\n"); - return err; - } - - aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size); - if (!i) { err = 1; goto beach_source; } - - if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i); - if (channels == 0 ) channels = aubio_source_get_channels(i); - - fmat_t *mat = new_fmat(channels, hop_size); - if (!mat) { err = 1; goto beach_fmat; } - - aubio_sink_t *o = new_aubio_sink(sink_path, 0); - if (!o) { err = 1; goto beach_sink; } - err = aubio_sink_preset_samplerate(o, samplerate); - if (err) { goto beach; } - err = aubio_sink_preset_channels(o, channels); - if (err) { goto beach; } - - do { - aubio_source_do_multi(i, mat, &read); - aubio_sink_do_multi(o, mat, read); - n_frames += read; - } while ( read == hop_size ); - - PRINT_MSG("read %d frames at %dHz in %d channels (%d blocks) from %s written to %s\n", - n_frames, samplerate, channels, n_frames / hop_size, - source_path, sink_path); - PRINT_MSG("wrote %s with %dHz in %d channels\n", sink_path, - aubio_sink_get_samplerate(o), - aubio_sink_get_channels(o) ); - -beach: - del_aubio_sink(o); -beach_sink: - del_fmat(mat); -beach_fmat: - del_aubio_source(i); -beach_source: - return err; -} diff --git a/tests/src/io/test-sink_apple_audio-multi.c b/tests/src/io/test-sink_apple_audio-multi.c deleted file mode 100644 index ffff6935..00000000 --- a/tests/src/io/test-sink_apple_audio-multi.c +++ /dev/null @@ -1,78 +0,0 @@ -#define AUBIO_UNSTABLE 1 -#include -#include "utils_tests.h" - -// this file uses the unstable aubio api to test aubio_sink_apple_audio, please -// use aubio_sink instead see src/io/sink.h and tests/src/sink/test-sink.c - -int main (int argc, char **argv) -{ - sint_t err = 0; - - if (argc < 3) { - PRINT_ERR("not enough arguments, running tests\n"); - err = run_on_default_source_and_sink(main); - PRINT_MSG("usage: %s [samplerate] [channels] [hop_size]\n", argv[0]); - return err; - } - -#ifdef HAVE_SINK_APPLE_AUDIO - uint_t samplerate = 0; - uint_t channels = 0; - uint_t hop_size = 512; - uint_t n_frames = 0, read = 0; - - char_t *source_path = argv[1]; - char_t *sink_path = argv[2]; - - if ( argc >= 4 ) samplerate = atoi(argv[3]); - if ( argc >= 5 ) channels = atoi(argv[4]); - if ( argc >= 6 ) hop_size = atoi(argv[5]); - if ( argc >= 7 ) { - err = 2; - PRINT_ERR("too many arguments\n"); - return err; - } - - aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size); - if (!i) { err = 1; goto beach_source; } - - if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i); - if (channels == 0 ) channels = aubio_source_get_channels(i); - - fmat_t *mat = new_fmat(channels, hop_size); - if (!mat) { err = 1; goto beach_fmat; } - - aubio_sink_apple_audio_t *o = new_aubio_sink_apple_audio(sink_path, 0); - if (!o) { err = 1; goto beach_sink; } - err = aubio_sink_apple_audio_preset_samplerate(o, samplerate); - if (err) { goto beach; } - err = aubio_sink_apple_audio_preset_channels(o, channels); - if (err) { goto beach; } - - do { - aubio_source_do_multi(i, mat, &read); - aubio_sink_apple_audio_do_multi(o, mat, read); - n_frames += read; - } while ( read == hop_size ); - - PRINT_MSG("read %d frames at %dHz in %d channels (%d blocks) from %s written to %s\n", - n_frames, samplerate, channels, n_frames / hop_size, - source_path, sink_path); - PRINT_MSG("wrote %s with %dHz in %d channels\n", sink_path, - aubio_sink_apple_audio_get_samplerate(o), - aubio_sink_apple_audio_get_channels(o) ); - -beach: - del_aubio_sink_apple_audio(o); -beach_sink: - del_fmat(mat); -beach_fmat: - del_aubio_source(i); -beach_source: -#else /* HAVE_SINK_APPLE_AUDIO */ - err = 0; - PRINT_ERR("aubio was not compiled with aubio_sink_apple_audio\n"); -#endif /* HAVE_SINK_APPLE_AUDIO */ - return err; -} diff --git a/tests/src/io/test-sink_sndfile-multi.c b/tests/src/io/test-sink_sndfile-multi.c deleted file mode 100644 index 1a8677a4..00000000 --- a/tests/src/io/test-sink_sndfile-multi.c +++ /dev/null @@ -1,78 +0,0 @@ -#define AUBIO_UNSTABLE 1 -#include -#include "utils_tests.h" - -// this file uses the unstable aubio api to test aubio_sink_sndfile, please -// use aubio_sink instead see src/io/sink.h and tests/src/sink/test-sink.c - -int main (int argc, char **argv) -{ - sint_t err = 0; - - if (argc < 3) { - PRINT_ERR("not enough arguments, running tests\n"); - err = run_on_default_source_and_sink(main); - PRINT_MSG("usage: %s [samplerate] [channels] [hop_size]\n", argv[0]); - return err; - } - -#ifdef HAVE_SNDFILE - uint_t samplerate = 0; - uint_t channels = 0; - uint_t hop_size = 512; - uint_t n_frames = 0, read = 0; - - char_t *source_path = argv[1]; - char_t *sink_path = argv[2]; - - if ( argc >= 4 ) samplerate = atoi(argv[3]); - if ( argc >= 5 ) channels = atoi(argv[4]); - if ( argc >= 6 ) hop_size = atoi(argv[5]); - if ( argc >= 7 ) { - err = 2; - PRINT_ERR("too many arguments\n"); - return err; - } - - aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size); - if (!i) { err = 1; goto beach_source; } - - if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i); - if (channels == 0 ) channels = aubio_source_get_channels(i); - - fmat_t *mat = new_fmat(channels, hop_size); - if (!mat) { err = 1; goto beach_fmat; } - - aubio_sink_sndfile_t *o = new_aubio_sink_sndfile(sink_path, 0); - if (!o) { err = 1; goto beach_sink; } - err = aubio_sink_sndfile_preset_samplerate(o, samplerate); - if (err) { goto beach; } - err = aubio_sink_sndfile_preset_channels(o, channels); - if (err) { goto beach; } - - do { - aubio_source_do_multi(i, mat, &read); - aubio_sink_sndfile_do_multi(o, mat, read); - n_frames += read; - } while ( read == hop_size ); - - PRINT_MSG("read %d frames at %dHz in %d channels (%d blocks) from %s written to %s\n", - n_frames, samplerate, channels, n_frames / hop_size, - source_path, sink_path); - PRINT_MSG("wrote %s with %dHz in %d channels\n", sink_path, - aubio_sink_sndfile_get_samplerate(o), - aubio_sink_sndfile_get_channels(o) ); - -beach: - del_aubio_sink_sndfile(o); -beach_sink: - del_fmat(mat); -beach_fmat: - del_aubio_source(i); -beach_source: -#else - err = 0; - PRINT_ERR("aubio was not compiled with aubio_sink_sndfile\n"); -#endif /* HAVE_SNDFILE */ - return err; -} diff --git a/tests/src/io/test-sink_wavwrite-multi.c b/tests/src/io/test-sink_wavwrite-multi.c deleted file mode 100644 index 2388677e..00000000 --- a/tests/src/io/test-sink_wavwrite-multi.c +++ /dev/null @@ -1,78 +0,0 @@ -#define AUBIO_UNSTABLE 1 -#include -#include "utils_tests.h" - -// this file uses the unstable aubio api to test aubio_sink_wavwrite, please -// use aubio_sink instead see src/io/sink.h and tests/src/sink/test-sink.c - -int main (int argc, char **argv) -{ - sint_t err = 0; - - if (argc < 3) { - PRINT_ERR("not enough arguments, running tests\n"); - err = run_on_default_source_and_sink(main); - PRINT_MSG("usage: %s [samplerate] [channels] [hop_size]\n", argv[0]); - return err; - } - -#ifdef HAVE_WAVWRITE - uint_t samplerate = 0; - uint_t channels = 0; - uint_t hop_size = 512; - uint_t n_frames = 0, read = 0; - - char_t *source_path = argv[1]; - char_t *sink_path = argv[2]; - - if ( argc >= 4 ) samplerate = atoi(argv[3]); - if ( argc >= 5 ) channels = atoi(argv[4]); - if ( argc >= 6 ) hop_size = atoi(argv[5]); - if ( argc >= 7 ) { - err = 2; - PRINT_ERR("too many arguments\n"); - return err; - } - - aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size); - if (!i) { err = 1; goto beach_source; } - - if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i); - if (channels == 0 ) channels = aubio_source_get_channels(i); - - fmat_t *mat = new_fmat(channels, hop_size); - if (!mat) { err = 1; goto beach_fmat; } - - aubio_sink_wavwrite_t *o = new_aubio_sink_wavwrite(sink_path, 0); - if (!o) { err = 1; goto beach_sink; } - err = aubio_sink_wavwrite_preset_samplerate(o, samplerate); - if (err) { goto beach; } - err = aubio_sink_wavwrite_preset_channels(o, channels); - if (err) { goto beach; } - - do { - aubio_source_do_multi(i, mat, &read); - aubio_sink_wavwrite_do_multi(o, mat, read); - n_frames += read; - } while ( read == hop_size ); - - PRINT_MSG("read %d frames at %dHz in %d channels (%d blocks) from %s written to %s\n", - n_frames, samplerate, channels, n_frames / hop_size, - source_path, sink_path); - PRINT_MSG("wrote %s with %dHz in %d channels\n", sink_path, - aubio_sink_wavwrite_get_samplerate(o), - aubio_sink_wavwrite_get_channels(o) ); - -beach: - del_aubio_sink_wavwrite(o); -beach_sink: - del_fmat(mat); -beach_fmat: - del_aubio_source(i); -beach_source: -#else - err = 0; - PRINT_ERR("aubio was not compiled with aubio_sink_wavwrite\n"); -#endif /* HAVE_WAVWRITE */ - return err; -} -- 2.11.0