Mercurial > hg > qm-dsp
comparison tests/TestPhaseVocoder.cpp @ 476:2de6184b2ce0
Untabify
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Thu, 30 May 2019 18:30:58 +0100 |
parents | 3c7338aff6a8 |
children |
comparison
equal
deleted
inserted
replaced
475:64fc3009d0a3 | 476:2de6184b2ce0 |
---|---|
16 | 16 |
17 BOOST_AUTO_TEST_SUITE(TestFFT) | 17 BOOST_AUTO_TEST_SUITE(TestFFT) |
18 | 18 |
19 #define COMPARE_CONST(a, n) \ | 19 #define COMPARE_CONST(a, n) \ |
20 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \ | 20 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \ |
21 BOOST_CHECK_SMALL(a[cmp_i] - n, 1e-7); \ | 21 BOOST_CHECK_SMALL(a[cmp_i] - n, 1e-7); \ |
22 } | 22 } |
23 | 23 |
24 #define COMPARE_ARRAY(a, b) \ | 24 #define COMPARE_ARRAY(a, b) \ |
25 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \ | 25 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \ |
26 BOOST_CHECK_SMALL(a[cmp_i] - b[cmp_i], 1e-7); \ | 26 BOOST_CHECK_SMALL(a[cmp_i] - b[cmp_i], 1e-7); \ |
27 } | 27 } |
28 | 28 |
29 #define COMPARE_ARRAY_EXACT(a, b) \ | 29 #define COMPARE_ARRAY_EXACT(a, b) \ |
30 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \ | 30 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \ |
31 BOOST_CHECK_EQUAL(a[cmp_i], b[cmp_i]); \ | 31 BOOST_CHECK_EQUAL(a[cmp_i], b[cmp_i]); \ |
32 } | 32 } |
33 | 33 |
34 BOOST_AUTO_TEST_CASE(fullcycle) | 34 BOOST_AUTO_TEST_CASE(fullcycle) |
35 { | 35 { |
36 // Cosine with one cycle exactly equal to pvoc hopsize. This is | 36 // Cosine with one cycle exactly equal to pvoc hopsize. This is |
114 // is introduced "by magic", i.e. it doesn't appear in the second | 114 // is introduced "by magic", i.e. it doesn't appear in the second |
115 // half of the first frame (it would have quite strange effects on | 115 // half of the first frame (it would have quite strange effects on |
116 // the first frame if it did). | 116 // the first frame if it did). |
117 | 117 |
118 double data[32] = { // 3 x 8-sample frames which we pretend are overlapping | 118 double data[32] = { // 3 x 8-sample frames which we pretend are overlapping |
119 0, 1, 0, -1, 0, 1, 0, -1, | 119 0, 1, 0, -1, 0, 1, 0, -1, |
120 1, 1.70710678, 0, -1.70710678, -1, 0.29289322, 0, -0.29289322, | 120 1, 1.70710678, 0, -1.70710678, -1, 0.29289322, 0, -0.29289322, |
121 -1, 0.29289322, 0, -0.29289322, 1, 1.70710678, 0, -1.70710678, | 121 -1, 0.29289322, 0, -0.29289322, 1, 1.70710678, 0, -1.70710678, |
122 }; | 122 }; |
123 | 123 |
124 PhaseVocoder pvoc(8, 4); | 124 PhaseVocoder pvoc(8, 4); |
125 | 125 |
126 // Make these arrays one element too long at each end, so as to | 126 // Make these arrays one element too long at each end, so as to |