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