comparison plugins/BarBeatTrack.cpp @ 190:af6a5ba00a8f

Some fixes for MSVC
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 01 Feb 2018 16:36:55 +0000
parents f96ea0e4b475
children
comparison
equal deleted inserted replaced
189:4e3bd932c195 190:af6a5ba00a8f
22 22
23 using std::string; 23 using std::string;
24 using std::vector; 24 using std::vector;
25 using std::cerr; 25 using std::cerr;
26 using std::endl; 26 using std::endl;
27
28 #ifndef __GNUC__
29 #include <alloca.h>
30 #endif
31 27
32 float BarBeatTracker::m_stepSecs = 0.01161; // 512 samples at 44100 28 float BarBeatTracker::m_stepSecs = 0.01161; // 512 samples at 44100
33 29
34 class BarBeatTrackerData 30 class BarBeatTrackerData
35 { 31 {
339 // make a temporary copy 335 // make a temporary copy
340 336
341 // We only support a single input channel 337 // We only support a single input channel
342 338
343 const int fl = m_d->dfConfig.frameLength; 339 const int fl = m_d->dfConfig.frameLength;
344 #ifndef __GNUC__ 340 double *dfinput = new double[fl];
345 double *dfinput = (double *)alloca(fl * sizeof(double)); 341
346 #else 342 for (int i = 0; i < fl; ++i) dfinput[i] = inputBuffers[0][i];
347 double dfinput[fl];
348 #endif
349 for (int i = 0; i < fl; ++i) dfinput[i] = inputBuffers[0][i];
350
351 double output = m_d->df->processTimeDomain(dfinput); 343 double output = m_d->df->processTimeDomain(dfinput);
344
345 delete[] dfinput;
352 346
353 if (m_d->dfOutput.empty()) m_d->origin = timestamp; 347 if (m_d->dfOutput.empty()) m_d->origin = timestamp;
354 348
355 // std::cerr << "df[" << m_d->dfOutput.size() << "] is " << output << std::endl; 349 // std::cerr << "df[" << m_d->dfOutput.size() << "] is " << output << std::endl;
356 m_d->dfOutput.push_back(output); 350 m_d->dfOutput.push_back(output);