From fbebc525117f18d5751e6951bc4ffcc51f70dcc4 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 1 Aug 2023 14:00:31 +1000 Subject: Add libsamplerate for resampling decoder output --- .../libsamplerate-0.2.2/tests/downsample_test.c | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 lib/libsamplerate/libsamplerate-0.2.2/tests/downsample_test.c (limited to 'lib/libsamplerate/libsamplerate-0.2.2/tests/downsample_test.c') diff --git a/lib/libsamplerate/libsamplerate-0.2.2/tests/downsample_test.c b/lib/libsamplerate/libsamplerate-0.2.2/tests/downsample_test.c new file mode 100755 index 00000000..6a4a75e1 --- /dev/null +++ b/lib/libsamplerate/libsamplerate-0.2.2/tests/downsample_test.c @@ -0,0 +1,61 @@ +/* +** Copyright (c) 2008-2016, Erik de Castro Lopo +** All rights reserved. +** +** This code is released under 2-clause BSD license. Please see the +** file at : https://github.com/libsndfile/libsamplerate/blob/master/COPYING +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "util.h" + +static void +downsample_test (int converter) +{ static float in [1000], out [10] ; + SRC_DATA data ; + + printf (" downsample_test (%-28s) ....... ", src_get_name (converter)) ; + fflush (stdout) ; + + data.src_ratio = 1.0 / 255.0 ; + data.input_frames = ARRAY_LEN (in) ; + data.output_frames = ARRAY_LEN (out) ; + data.data_in = in ; + data.data_out = out ; + + if (src_simple (&data, converter, 1)) + { puts ("src_simple failed.") ; + exit (1) ; + } ; + + puts ("ok") ; +} /* downsample_test */ + +int +main (void) +{ + puts ("") ; + + downsample_test (SRC_ZERO_ORDER_HOLD) ; + downsample_test (SRC_LINEAR) ; +#ifdef ENABLE_SINC_FAST_CONVERTER + downsample_test (SRC_SINC_FASTEST) ; +#endif +#ifdef ENABLE_SINC_MEDIUM_CONVERTER + downsample_test (SRC_SINC_MEDIUM_QUALITY) ; +#endif +#ifdef ENABLE_SINC_BEST_CONVERTER + downsample_test (SRC_SINC_BEST_QUALITY) ; +#endif + + puts ("") ; + + return 0 ; +} /* main */ -- cgit v1.2.3