| @@ -0,0 +1,57 @@ |
| 1 | +/* |
| 2 | +** Copyright (C) 2008 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 <samplerate.h> |
| 21 | + |
| 22 | +#include "util.h" |
| 23 | + |
| 24 | +static void |
| 25 | +downsample_test (int converter) |
| 26 | +{ static float in [1000], out[10] ; |
| 27 | + SRC_DATA data ; |
| 28 | + |
| 29 | + printf (" downsample_test (%-28s) ....... ", src_get_name (converter)) ; |
| 30 | + fflush (stdout) ; |
| 31 | + |
| 32 | + data.src_ratio = 1.0 / 255.0 ; |
| 33 | + data.input_frames = ARRAY_LEN (in) ; |
| 34 | + data.output_frames = ARRAY_LEN (out) ; |
| 35 | + data.data_in = in ; |
| 36 | + data.data_out = out ; |
| 37 | + |
| 38 | + src_simple (&data, converter, 1) ; |
| 39 | + |
| 40 | + puts ("ok") ; |
| 41 | +} /* downsample_test */ |
| 42 | + |
| 43 | +int |
| 44 | +main (void) |
| 45 | +{ |
| 46 | + puts ("") ; |
| 47 | + |
| 48 | + downsample_test (SRC_ZERO_ORDER_HOLD) ; |
| 49 | + downsample_test (SRC_LINEAR) ; |
| 50 | + downsample_test (SRC_SINC_FASTEST) ; |
| 51 | + downsample_test (SRC_SINC_MEDIUM_QUALITY) ; |
| 52 | + downsample_test (SRC_SINC_BEST_QUALITY) ; |
| 53 | + |
| 54 | + puts ("") ; |
| 55 | + |
| 56 | + return 0 ; |
| 57 | +} /* main */ |