cannam@85
|
1 /*
|
cannam@85
|
2 ** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
cannam@85
|
3 **
|
cannam@85
|
4 ** This program is free software; you can redistribute it and/or modify
|
cannam@85
|
5 ** it under the terms of the GNU General Public License as published by
|
cannam@85
|
6 ** the Free Software Foundation; either version 2 of the License, or
|
cannam@85
|
7 ** (at your option) any later version.
|
cannam@85
|
8 **
|
cannam@85
|
9 ** This program is distributed in the hope that it will be useful,
|
cannam@85
|
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
cannam@85
|
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
cannam@85
|
12 ** GNU General Public License for more details.
|
cannam@85
|
13 **
|
cannam@85
|
14 ** You should have received a copy of the GNU General Public License
|
cannam@85
|
15 ** along with this program; if not, write to the Free Software
|
cannam@85
|
16 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
cannam@85
|
17 */
|
cannam@85
|
18
|
cannam@85
|
19 #include <stdio.h>
|
cannam@85
|
20 #include <stdlib.h>
|
cannam@85
|
21 #include <samplerate.h>
|
cannam@85
|
22
|
cannam@85
|
23 #include "util.h"
|
cannam@85
|
24
|
cannam@85
|
25 static void
|
cannam@85
|
26 downsample_test (int converter)
|
cannam@85
|
27 { static float in [1000], out [10] ;
|
cannam@85
|
28 SRC_DATA data ;
|
cannam@85
|
29
|
cannam@85
|
30 printf (" downsample_test (%-28s) ....... ", src_get_name (converter)) ;
|
cannam@85
|
31 fflush (stdout) ;
|
cannam@85
|
32
|
cannam@85
|
33 data.src_ratio = 1.0 / 255.0 ;
|
cannam@85
|
34 data.input_frames = ARRAY_LEN (in) ;
|
cannam@85
|
35 data.output_frames = ARRAY_LEN (out) ;
|
cannam@85
|
36 data.data_in = in ;
|
cannam@85
|
37 data.data_out = out ;
|
cannam@85
|
38
|
cannam@85
|
39 if (src_simple (&data, converter, 1))
|
cannam@85
|
40 { puts ("src_simple failed.") ;
|
cannam@85
|
41 exit (1) ;
|
cannam@85
|
42 } ;
|
cannam@85
|
43
|
cannam@85
|
44 puts ("ok") ;
|
cannam@85
|
45 } /* downsample_test */
|
cannam@85
|
46
|
cannam@85
|
47 int
|
cannam@85
|
48 main (void)
|
cannam@85
|
49 {
|
cannam@85
|
50 puts ("") ;
|
cannam@85
|
51
|
cannam@85
|
52 downsample_test (SRC_ZERO_ORDER_HOLD) ;
|
cannam@85
|
53 downsample_test (SRC_LINEAR) ;
|
cannam@85
|
54 downsample_test (SRC_SINC_FASTEST) ;
|
cannam@85
|
55 downsample_test (SRC_SINC_MEDIUM_QUALITY) ;
|
cannam@85
|
56 downsample_test (SRC_SINC_BEST_QUALITY) ;
|
cannam@85
|
57
|
cannam@85
|
58 puts ("") ;
|
cannam@85
|
59
|
cannam@85
|
60 return 0 ;
|
cannam@85
|
61 } /* main */
|