Revision 5:6a279da6fdd7 TestMultipleRuns.cpp
| TestMultipleRuns.cpp | ||
|---|---|---|
| 56 | 56 |
Tester::TestRegistrar<TestInterleavedRuns> |
| 57 | 57 |
TestInterleavedRuns::m_registrar("D3 Simultaneous interleaved runs in a single thread");
|
| 58 | 58 |
|
| 59 |
Tester::TestRegistrar<TestDifferentStartTimes> |
|
| 60 |
TestDifferentStartTimes::m_registrar("D4 Consecutive runs with different start times");
|
|
| 61 |
|
|
| 59 | 62 |
static const size_t _step = 1000; |
| 60 | 63 |
|
| 61 | 64 |
Test::Results |
| ... | ... | |
| 180 | 183 |
|
| 181 | 184 |
return r; |
| 182 | 185 |
} |
| 186 |
|
|
| 187 |
Test::Results |
|
| 188 |
TestDifferentStartTimes::test(string key) |
|
| 189 |
{
|
|
| 190 |
Plugin::FeatureSet f[2]; |
|
| 191 |
int rate = 44100; |
|
| 192 |
Results r; |
|
| 193 |
float **data = 0; |
|
| 194 |
size_t channels = 0; |
|
| 195 |
size_t count = 100; |
|
| 196 |
|
|
| 197 |
for (int run = 0; run < 2; ++run) {
|
|
| 198 |
auto_ptr<Plugin> p(load(key, rate)); |
|
| 199 |
if (!initAdapted(p.get(), channels, _step, _step, r)) return r; |
|
| 200 |
if (!data) data = createTestAudio(channels, _step, count); |
|
| 201 |
for (size_t i = 0; i < count; ++i) {
|
|
| 202 |
float *ptr[channels]; |
|
| 203 |
size_t idx = i * _step; |
|
| 204 |
for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; |
|
| 205 |
RealTime timestamp = RealTime::frame2RealTime(idx, rate); |
|
| 206 |
if (run == 1) timestamp = timestamp + RealTime::fromSeconds(10); |
|
| 207 |
Plugin::FeatureSet fs = p->process(ptr, timestamp); |
|
| 208 |
appendFeatures(f[run], fs); |
|
| 209 |
} |
|
| 210 |
Plugin::FeatureSet fs = p->getRemainingFeatures(); |
|
| 211 |
appendFeatures(f[run], fs); |
|
| 212 |
} |
|
| 213 |
if (data) destroyTestAudio(data, channels); |
|
| 214 |
|
|
| 215 |
if (f[0] == f[1]) {
|
|
| 216 |
r.push_back(warning("Consecutive runs with different starting timestamps produce the same result"));
|
|
| 217 |
} else {
|
|
| 218 |
r.push_back(success()); |
|
| 219 |
} |
|
| 220 |
|
|
| 221 |
return r; |
|
| 222 |
} |
|
Also available in: Unified diff