Mercurial > hg > btrack
diff src/BTrack.cpp @ 52:45231107c9d6
Reformatted comments, removed the OnsetDetectionFunction constructor with no arguments, removed a number of unused variables and made changes to the python module to fix some casting problems and removed some unused variables there also. Still getting the same results, so no overall changes to the algorithm.
author | Adam Stark <adamstark@users.noreply.github.com> |
---|---|
date | Wed, 22 Jan 2014 01:13:45 +0000 |
parents | 68d01fea1e8d |
children | 338f5eb29e41 |
line wrap: on
line diff
--- a/src/BTrack.cpp Tue Jan 21 10:24:33 2014 +0000 +++ b/src/BTrack.cpp Wed Jan 22 01:13:45 2014 +0000 @@ -19,13 +19,10 @@ */ //======================================================================= -#include <iostream> #include <cmath> +#include <algorithm> #include "BTrack.h" #include "samplerate.h" -using namespace std; - - //======================================================================= @@ -381,12 +378,12 @@ int p_post = 7; int p_pre = 8; - t = min(N,p_post); // what is smaller, p_post of df size. This is to avoid accessing outside of arrays + t = std::min(N,p_post); // what is smaller, p_post of df size. This is to avoid accessing outside of arrays // find threshold for first 't' samples, where a full average cannot be computed yet for (i = 0;i <= t;i++) { - k = min((i+p_pre),N); + k = std::min((i+p_pre),N); x_thresh[i] = mean_array(x,1,k); } // find threshold for bulk of samples across a moving average from [i-p_pre,i+p_post] @@ -397,7 +394,7 @@ // for last few samples calculate threshold, again, not enough samples to do as above for (i = N-p_post;i < N;i++) { - k = max((i-p_post),1); + k = std::max((i-p_post),1); x_thresh[i] = mean_array(x,k,N); }