]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | ** Copyright (c) 2008-2016, Erik de Castro Lopo <erikd@mega-nerd.com> | |
3 | ** All rights reserved. | |
4 | ** | |
5 | ** This code is released under 2-clause BSD license. Please see the | |
6 | ** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING | |
7 | */ | |
8 | ||
9 | #include <stdio.h> | |
10 | #include <stdlib.h> | |
11 | #include <samplerate.h> | |
12 | ||
13 | #include "util.h" | |
14 | ||
15 | static void | |
16 | downsample_test (int converter) | |
17 | { static float in [1000], out [10] ; | |
18 | SRC_DATA data ; | |
19 | ||
20 | printf (" downsample_test (%-28s) ....... ", src_get_name (converter)) ; | |
21 | fflush (stdout) ; | |
22 | ||
23 | data.src_ratio = 1.0 / 255.0 ; | |
24 | data.input_frames = ARRAY_LEN (in) ; | |
25 | data.output_frames = ARRAY_LEN (out) ; | |
26 | data.data_in = in ; | |
27 | data.data_out = out ; | |
28 | ||
29 | if (src_simple (&data, converter, 1)) | |
30 | { puts ("src_simple failed.") ; | |
31 | exit (1) ; | |
32 | } ; | |
33 | ||
34 | puts ("ok") ; | |
35 | } /* downsample_test */ | |
36 | ||
37 | int | |
38 | main (void) | |
39 | { | |
40 | puts ("") ; | |
41 | ||
42 | downsample_test (SRC_ZERO_ORDER_HOLD) ; | |
43 | downsample_test (SRC_LINEAR) ; | |
44 | downsample_test (SRC_SINC_FASTEST) ; | |
45 | downsample_test (SRC_SINC_MEDIUM_QUALITY) ; | |
46 | downsample_test (SRC_SINC_BEST_QUALITY) ; | |
47 | ||
48 | puts ("") ; | |
49 | ||
50 | return 0 ; | |
51 | } /* main */ |