2 Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file test/resampler_test.cc
21 * @brief Check that the timings that come back from the resampler correspond
22 * to the number of samples it generates.
25 #include <boost/test/unit_test.hpp>
26 #include "lib/audio_buffers.h"
27 #include "lib/resampler.h"
31 using boost::shared_ptr;
34 resampler_test_one (int from, int to)
36 Resampler resamp (from, to, 1);
41 int64_t const N = int64_t (from) * 60 * 60 * 3;
43 /* XXX: no longer checks anything */
44 for (int64_t i = 0; i < N; i += 1000) {
45 shared_ptr<AudioBuffers> a (new AudioBuffers (1, 1000));
47 shared_ptr<const AudioBuffers> r = resamp.run (a);
48 total_out += r->frames ();
52 BOOST_AUTO_TEST_CASE (resampler_test)
54 resampler_test_one (44100, 48000);
55 resampler_test_one (44100, 46080);
56 resampler_test_one (44100, 50000);