# HG changeset patch # User Adam Stark # Date 1390866858 0 # Node ID 1395895f6cdf0f0362c360013a6ef835ef8112fd # Parent 2ec37d4afc3798cdd64517be96bf2d105084cf04 Replaced the pointers to arrays in BTrack with vectors diff -r 2ec37d4afc37 -r 1395895f6cdf src/BTrack.cpp --- a/src/BTrack.cpp Mon Jan 27 23:20:13 2014 +0000 +++ b/src/BTrack.cpp Mon Jan 27 23:54:18 2014 +0000 @@ -127,10 +127,12 @@ onsetDFBufferSize = (512*512)/hopSize; // calculate df buffer size beatPeriod = round(60/((((double) hopSize)/44100)*tempo)); - - onsetDF = new double[onsetDFBufferSize]; // create df_buffer - cumulativeScore = new double[onsetDFBufferSize]; // create cumscore - + + // set size of onset detection function buffer + onsetDF.resize(onsetDFBufferSize); + + // set size of cumulative score buffer + cumulativeScore.resize(onsetDFBufferSize); // initialise df_buffer to zeros for (int i = 0;i < onsetDFBufferSize;i++) diff -r 2ec37d4afc37 -r 1395895f6cdf src/BTrack.h --- a/src/BTrack.h Mon Jan 27 23:20:13 2014 +0000 +++ b/src/BTrack.h Mon Jan 27 23:54:18 2014 +0000 @@ -23,6 +23,7 @@ #define __BTRACK_H #include "OnsetDetectionFunction.h" +#include //======================================================================= /** The main beat tracking class and the interface to the BTrack @@ -172,9 +173,11 @@ //======================================================================= // buffers - double *onsetDF; /**< to hold onset detection function */ + + std::vector onsetDF; /**< to hold onset detection function */ + std::vector cumulativeScore; /**< to hold cumulative score */ + double resampledOnsetDF[512]; /**< to hold resampled detection function */ - double *cumulativeScore; /**< to hold cumulative score */ double acf[512]; /**< to hold autocorrelation function */