summaryrefslogtreecommitdiff
path: root/libs/ardour/test/resampled_source_test.cc
blob: 97bf2e58fe63f012b149e30c38c6f46e8ebdd27d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "test_util.h"

#include "pbd/file_utils.h"
#include "ardour/resampled_source.h"
#include "ardour/sndfileimportable.h"
#include "resampled_source_test.h"


CPPUNIT_TEST_SUITE_REGISTRATION (ResampledSourceTest);

using namespace std;
using namespace ARDOUR;
using namespace PBD;

void
ResampledSourceTest::seekTest ()
{
	std::string test_file_path;
	const string test_filename = "test.wav";

	CPPUNIT_ASSERT (find_file (test_search_path (), test_filename, test_file_path));

	boost::shared_ptr<SndFileImportableSource> s (new SndFileImportableSource (test_file_path));
	ResampledImportableSource r (s, 48000, SrcBest);

	/* Make sure that seek (0) has the desired effect, ie that
	   given the same input you get the same output after seek (0)
	   as you got when the Source was newly created.
	*/

	Sample A[64];
	r.read (A, 64);

	r.seek (0);

	Sample B[64];
	r.read (B, 64);

	for (int i = 0; i < 64; ++i) {
		CPPUNIT_ASSERT (A[i] == B[i]);
	}
}