aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_pcm_mix.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_pcm_mix.cxx')
-rw-r--r--test/test_pcm_mix.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/test_pcm_mix.cxx b/test/test_pcm_mix.cxx
index 2a8a11388..973b58f4d 100644
--- a/test/test_pcm_mix.cxx
+++ b/test/test_pcm_mix.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,32 +21,36 @@
#include "test_pcm_all.hxx"
#include "test_pcm_util.hxx"
#include "pcm/PcmMix.hxx"
+#include "pcm/PcmDither.hxx"
template<typename T, SampleFormat format, typename G=RandomInt<T>>
static void
TestPcmMix(G g=G())
{
- constexpr unsigned N = 256;
+ constexpr unsigned N = 509;
const auto src1 = TestDataBuffer<T, N>(g);
const auto src2 = TestDataBuffer<T, N>(g);
+ PcmDither dither;
+
/* portion1=1.0: result must be equal to src1 */
auto result = src1;
- bool success = pcm_mix(result.begin(), src2.begin(), sizeof(result),
+ bool success = pcm_mix(dither,
+ result.begin(), src2.begin(), sizeof(result),
format, 1.0);
CPPUNIT_ASSERT(success);
- AssertEqualWithTolerance(result, src1, 1);
+ AssertEqualWithTolerance(result, src1, 3);
/* portion1=0.0: result must be equal to src2 */
result = src1;
- success = pcm_mix(result.begin(), src2.begin(), sizeof(result),
+ success = pcm_mix(dither, result.begin(), src2.begin(), sizeof(result),
format, 0.0);
CPPUNIT_ASSERT(success);
- AssertEqualWithTolerance(result, src2, 1);
+ AssertEqualWithTolerance(result, src2, 3);
/* portion1=0.5 */
result = src1;
- success = pcm_mix(result.begin(), src2.begin(), sizeof(result),
+ success = pcm_mix(dither, result.begin(), src2.begin(), sizeof(result),
format, 0.5);
CPPUNIT_ASSERT(success);
@@ -54,7 +58,7 @@ TestPcmMix(G g=G())
for (unsigned i = 0; i < N; ++i)
expected[i] = (int64_t(src1[i]) + int64_t(src2[i])) / 2;
- AssertEqualWithTolerance(result, expected, 1);
+ AssertEqualWithTolerance(result, expected, 3);
}
void