Revision 43:0973204bf446 TestInitialise.cpp
| TestInitialise.cpp | ||
|---|---|---|
| 60 | 60 |
Tester::TestRegistrar<TestLengthyConstructor> |
| 61 | 61 |
TestLengthyConstructor::m_registrar("F2", "Lengthy constructor");
|
| 62 | 62 |
|
| 63 |
static const size_t _step = 1000; |
|
| 64 |
|
|
| 65 | 63 |
Test::Results |
| 66 | 64 |
TestSampleRates::test(string key, Options options) |
| 67 | 65 |
{
|
| 68 | 66 |
int rates[] = |
| 69 |
{ 11, 800, 10099, 11024, 44100, 48000, 96000, 192000, 201011, 1094091 };
|
|
| 67 |
{ 111, 800, 10099, 11024, 44100, 48000, 96000, 192000, 201011, 1094091 };
|
|
| 70 | 68 |
|
| 71 | 69 |
Results r; |
| 72 | 70 |
|
| ... | ... | |
| 86 | 84 |
Plugin::FeatureSet f; |
| 87 | 85 |
float **data = 0; |
| 88 | 86 |
size_t channels = 0; |
| 89 |
size_t count = 100; |
|
| 87 |
|
|
| 88 |
// Aim to feed the plugin a roughly fixed input duration in secs |
|
| 89 |
const float seconds = 10.f; |
|
| 90 |
size_t step = 1000; |
|
| 91 |
size_t count = (seconds * rate) / step; |
|
| 92 |
if (count < 1) count = 1; |
|
| 90 | 93 |
|
| 91 | 94 |
Results subr; |
| 92 |
if (!initAdapted(p.get(), channels, _step, _step, subr)) {
|
|
| 95 |
if (!initAdapted(p.get(), channels, step, step, subr)) {
|
|
| 93 | 96 |
// This is not an error; the plugin can legitimately |
| 94 | 97 |
// refuse to initialise at weird settings and that's often |
| 95 | 98 |
// the most acceptable result |
| ... | ... | |
| 99 | 102 |
continue; |
| 100 | 103 |
} |
| 101 | 104 |
|
| 102 |
data = createTestAudio(channels, _step, count);
|
|
| 103 |
for (size_t i = 0; i < count; ++i) {
|
|
| 105 |
data = createTestAudio(channels, step, count); |
|
| 106 |
for (size_t j = 0; j < count; ++j) {
|
|
| 104 | 107 |
#ifdef __GNUC__ |
| 105 | 108 |
float *ptr[channels]; |
| 106 | 109 |
#else |
| 107 | 110 |
float **ptr = (float **)alloca(channels * sizeof(float)); |
| 108 | 111 |
#endif |
| 109 |
size_t idx = i * _step;
|
|
| 112 |
size_t idx = j * step;
|
|
| 110 | 113 |
for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; |
| 111 | 114 |
RealTime timestamp = RealTime::frame2RealTime(idx, rate); |
| 112 | 115 |
Plugin::FeatureSet fs = p->process(ptr, timestamp); |
Also available in: Unified diff