Revision 23:28097c1b3de4 TestInitialise.cpp
| TestInitialise.cpp | ||
|---|---|---|
| 59 | 59 |
static const size_t _step = 1000; |
| 60 | 60 |
|
| 61 | 61 |
Test::Results |
| 62 |
TestSampleRates::test(string key, Options) |
|
| 62 |
TestSampleRates::test(string key, Options options)
|
|
| 63 | 63 |
{
|
| 64 | 64 |
int rates[] = |
| 65 | 65 |
{ 1, 800, 10099, 11024, 44100, 48000, 96000, 192000, 201011, 1094091 };
|
| 66 | 66 |
|
| 67 | 67 |
Results r; |
| 68 | 68 |
|
| 69 |
if (options & Verbose) {
|
|
| 70 |
cout << " "; |
|
| 71 |
} |
|
| 72 |
|
|
| 69 | 73 |
for (int i = 0; i < int(sizeof(rates)/sizeof(rates[0])); ++i) {
|
| 70 | 74 |
|
| 71 | 75 |
int rate = rates[i]; |
| 76 |
|
|
| 77 |
if (options & Verbose) {
|
|
| 78 |
cout << "[" << rate << "Hz] " << flush; |
|
| 79 |
} |
|
| 80 |
|
|
| 72 | 81 |
auto_ptr<Plugin> p(load(key, rate)); |
| 73 | 82 |
Plugin::FeatureSet f; |
| 74 | 83 |
float **data = 0; |
| 75 | 84 |
size_t channels = 0; |
| 76 | 85 |
size_t count = 100; |
| 77 | 86 |
|
| 78 |
if (!initAdapted(p.get(), channels, _step, _step, r)) continue; |
|
| 87 |
Results subr; |
|
| 88 |
if (!initAdapted(p.get(), channels, _step, _step, subr)) {
|
|
| 89 |
// This is not an error; the plugin can legitimately |
|
| 90 |
// refuse to initialise at weird settings and that's often |
|
| 91 |
// the most acceptable result |
|
| 92 |
if (!subr.empty()) {
|
|
| 93 |
r.push_back(note(subr.begin()->message())); |
|
| 94 |
} |
|
| 95 |
continue; |
|
| 96 |
} |
|
| 79 | 97 |
|
| 80 | 98 |
data = createTestAudio(channels, _step, count); |
| 81 | 99 |
for (size_t i = 0; i < count; ++i) {
|
| ... | ... | |
| 91 | 109 |
destroyTestAudio(data, channels); |
| 92 | 110 |
} |
| 93 | 111 |
|
| 112 |
if (options & Verbose) cout << endl; |
|
| 113 |
|
|
| 94 | 114 |
// We can't actually do anything meaningful with our results. |
| 95 | 115 |
// We're really just testing to see whether the plugin crashes. I |
| 96 | 116 |
// wonder whether it's possible to do any better? If not, we |
Also available in: Unified diff