Mercurial > hg > btrack
changeset 26:e4d5f045064d develop
Replaced the pointers to arrays in BTrack with vectors
author | Adam <adamstark.uk@gmail.com> |
---|---|
date | Mon, 27 Jan 2014 23:54:18 +0000 |
parents | 20917cfb56a0 |
children | 98f7a54faa0c |
files | src/BTrack.cpp src/BTrack.h |
diffstat | 2 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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++)
--- 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 <vector> //======================================================================= /** 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<double> onsetDF; /**< to hold onset detection function */ + std::vector<double> 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 */