comparison TestDefaults.cpp @ 28:b1bc4d045a4b vamp-plugin-tester-v1.0

* Solaris build fixes
author cannam
date Thu, 24 Sep 2009 14:11:14 +0000
parents 28097c1b3de4
children a2d9aed55a2a
comparison
equal deleted inserted replaced
27:5dcdc86d45d4 28:b1bc4d045a4b
46 using namespace std; 46 using namespace std;
47 47
48 #include <cmath> 48 #include <cmath>
49 #include <time.h> 49 #include <time.h>
50 50
51 #ifndef __GNUC__
52 #include <alloca.h>
53 #endif
54
51 Tester::TestRegistrar<TestDefaultProgram> 55 Tester::TestRegistrar<TestDefaultProgram>
52 TestDefaultProgram::m_registrar("E1 Inconsistent default program"); 56 TestDefaultProgram::m_registrar("E1 Inconsistent default program");
53 57
54 Tester::TestRegistrar<TestDefaultParameters> 58 Tester::TestRegistrar<TestDefaultParameters>
55 TestDefaultParameters::m_registrar("E2 Inconsistent default parameters"); 59 TestDefaultParameters::m_registrar("E2 Inconsistent default parameters");
73 p->selectProgram(p->getCurrentProgram()); 77 p->selectProgram(p->getCurrentProgram());
74 } 78 }
75 if (!initAdapted(p.get(), channels, _step, _step, r)) return r; 79 if (!initAdapted(p.get(), channels, _step, _step, r)) return r;
76 if (!data) data = createTestAudio(channels, _step, count); 80 if (!data) data = createTestAudio(channels, _step, count);
77 for (size_t i = 0; i < count; ++i) { 81 for (size_t i = 0; i < count; ++i) {
82 #ifdef __GNUC__
78 float *ptr[channels]; 83 float *ptr[channels];
84 #else
85 float **ptr = (float **)alloca(channels * sizeof(float));
86 #endif
79 size_t idx = i * _step; 87 size_t idx = i * _step;
80 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; 88 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
81 RealTime timestamp = RealTime::frame2RealTime(idx, rate); 89 RealTime timestamp = RealTime::frame2RealTime(idx, rate);
82 Plugin::FeatureSet fs = p->process(ptr, timestamp); 90 Plugin::FeatureSet fs = p->process(ptr, timestamp);
83 appendFeatures(f[run], fs); 91 appendFeatures(f[run], fs);
129 } 137 }
130 } 138 }
131 if (!initAdapted(p.get(), channels, _step, _step, r)) return r; 139 if (!initAdapted(p.get(), channels, _step, _step, r)) return r;
132 if (!data) data = createTestAudio(channels, _step, count); 140 if (!data) data = createTestAudio(channels, _step, count);
133 for (size_t i = 0; i < count; ++i) { 141 for (size_t i = 0; i < count; ++i) {
142 #ifdef __GNUC__
134 float *ptr[channels]; 143 float *ptr[channels];
144 #else
145 float **ptr = (float **)alloca(channels * sizeof(float));
146 #endif
135 size_t idx = i * _step; 147 size_t idx = i * _step;
136 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; 148 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
137 RealTime timestamp = RealTime::frame2RealTime(idx, rate); 149 RealTime timestamp = RealTime::frame2RealTime(idx, rate);
138 Plugin::FeatureSet fs = p->process(ptr, timestamp); 150 Plugin::FeatureSet fs = p->process(ptr, timestamp);
139 appendFeatures(f[run], fs); 151 appendFeatures(f[run], fs);