diff TestDefaults.cpp @ 67:fa66ee7dcf08

VC build projects and fixes therefore. Interestingly the alloca() calls I'm replacing were all wrong
author Chris Cannam
date Wed, 07 Feb 2018 17:54:27 +0000
parents 4bd0cd3c60f3
children
line wrap: on
line diff
--- a/TestDefaults.cpp	Tue Jun 20 15:09:00 2017 +0100
+++ b/TestDefaults.cpp	Wed Feb 07 17:54:27 2018 +0000
@@ -48,10 +48,6 @@
 #include <cmath>
 #include <time.h>
 
-#ifndef __GNUC__
-#include <alloca.h>
-#endif
-
 Tester::TestRegistrar<TestDefaultProgram>
 TestDefaultProgram::m_registrar("E1", "Inconsistent default program");
 
@@ -82,15 +78,12 @@
         if (!initAdapted(p.get(), channels, _step, _step, r)) return r;
         if (!data) data = createTestAudio(channels, _step, count);
         for (size_t i = 0; i < count; ++i) {
-#ifdef __GNUC__
-            float *ptr[channels];
-#else
-            float **ptr = (float **)alloca(channels * sizeof(float));
-#endif
+            float **ptr = new float *[channels];
             size_t idx = i * _step;
             for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
             RealTime timestamp = RealTime::frame2RealTime(idx, rate);
             Plugin::FeatureSet fs = p->process(ptr, timestamp);
+            delete[] ptr;
             appendFeatures(f[run], fs);
         }
         Plugin::FeatureSet fs = p->getRemainingFeatures();
@@ -142,15 +135,12 @@
         if (!initAdapted(p.get(), channels, _step, _step, r)) return r;
         if (!data) data = createTestAudio(channels, _step, count);
         for (size_t i = 0; i < count; ++i) {
-#ifdef __GNUC__
-            float *ptr[channels];
-#else
-            float **ptr = (float **)alloca(channels * sizeof(float));
-#endif
+            float **ptr = new float *[channels];
             size_t idx = i * _step;
             for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
             RealTime timestamp = RealTime::frame2RealTime(idx, rate);
             Plugin::FeatureSet fs = p->process(ptr, timestamp);
+            delete[] ptr;
             appendFeatures(f[run], fs);
         }
         Plugin::FeatureSet fs = p->getRemainingFeatures();
@@ -256,15 +246,12 @@
 
         if (!data) data = createTestAudio(channels, _step, count);
         for (size_t i = 0; i < count; ++i) {
-#ifdef __GNUC__
-            float *ptr[channels];
-#else
-            float **ptr = (float **)alloca(channels * sizeof(float));
-#endif
+            float **ptr = new float *[channels];
             size_t idx = i * _step;
             for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
             RealTime timestamp = RealTime::frame2RealTime(idx, rate);
             Plugin::FeatureSet fs = p->process(ptr, timestamp);
+            delete[] ptr;
             appendFeatures(f[run], fs);
         }
         Plugin::FeatureSet fs = p->getRemainingFeatures();