possible fix for race between diskstream buffer overwrite and channel setup
[ardour2.git] / libs / ardour / test / interpolation_test.h
bloba051990e8508f678352075063fa1c131b689bcd6
1 /* Copyright(C) 2000-2008 Paul Davis
2 * Author: Hans Baier
4 * Evoral is free software; you can redistribute it and/or modify it under the
5 * terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 2 of the License, or(at your option) any later
7 * version.
9 * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #include <cassert>
19 #include <stdint.h>
20 #include <cppunit/TestFixture.h>
21 #include <cppunit/extensions/HelperMacros.h>
23 #include "ardour/interpolation.h"
25 class InterpolationTest : public CppUnit::TestFixture
27 CPPUNIT_TEST_SUITE(InterpolationTest);
28 CPPUNIT_TEST(cubicInterpolationTest);
29 CPPUNIT_TEST(linearInterpolationTest);
30 CPPUNIT_TEST_SUITE_END();
32 #define NUM_SAMPLES 1000000
33 #define INTERVAL 100
35 ARDOUR::Sample input[NUM_SAMPLES];
36 ARDOUR::Sample output[NUM_SAMPLES];
38 ARDOUR::LinearInterpolation linear;
39 ARDOUR::CubicInterpolation cubic;
41 public:
43 void setUp() {
44 for (int i = 0; i < NUM_SAMPLES; ++i) {
45 if (i % INTERVAL == 0) {
46 input[i] = 1.0f;
47 } else {
48 input[i] = 0.0f;
50 output[i] = 0.0f;
52 linear.add_channel_to (NUM_SAMPLES, NUM_SAMPLES);
53 cubic.add_channel_to (NUM_SAMPLES, NUM_SAMPLES);
56 void tearDown() {
59 void linearInterpolationTest();
60 void cubicInterpolationTest();