summaryrefslogtreecommitdiff
path: root/libs/ardour/test/resampled_source.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-04-09 14:11:47 +0000
committerCarl Hetherington <carl@carlh.net>2010-04-09 14:11:47 +0000
commitf4ac9430f3fc2c405334f3f02fe08a5782454396 (patch)
tree2858264db409fc1bfe778554f86100f01c1f0b3d /libs/ardour/test/resampled_source.cc
parent77c09fc8248160ab60e2e229710d07934fe08894 (diff)
Prevent clipping during the import of files from sources that have
amplitudes greater than 1 when data is being stored in files that are clamped. e.g. when importing hot sources and resampling them when the session file format is integer. git-svn-id: svn://localhost/ardour2/branches/3.0@6879 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/test/resampled_source.cc')
-rw-r--r--libs/ardour/test/resampled_source.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/libs/ardour/test/resampled_source.cc b/libs/ardour/test/resampled_source.cc
new file mode 100644
index 0000000000..02bd7ff1a8
--- /dev/null
+++ b/libs/ardour/test/resampled_source.cc
@@ -0,0 +1,31 @@
+#include "ardour/resampled_source.h"
+#include "ardour/sndfileimportable.h"
+#include "resampled_source.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (ResampledSourceTest);
+
+using namespace ARDOUR;
+
+void
+ResampledSourceTest::seekTest ()
+{
+ boost::shared_ptr<SndFileImportableSource> s (new SndFileImportableSource ("../../libs/ardour/test/test.wav"));
+ 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]);
+ }
+}