Mercurial > hg > beatroot-vamp
diff BeatRootProcessor.h @ 22:6afcb5edd7ab
Fix compiler warnings, etc
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2013 16:50:40 +0100 |
parents | 887c629502a9 |
children | 633ec097fa56 |
line wrap: on
line diff
--- a/BeatRootProcessor.h Wed Aug 28 16:50:22 2013 +0100 +++ b/BeatRootProcessor.h Wed Aug 28 16:50:40 2013 +0100 @@ -117,10 +117,15 @@ protected: /** Allocates memory for arrays, based on parameter settings */ void init() { +#ifdef DEBUG_BEATROOT + std::cerr << "BeatRootProcessor::init()" << std::endl; +#endif makeFreqMap(fftSize, sampleRate); prevFrame.clear(); for (int i = 0; i <= fftSize/2; i++) prevFrame.push_back(0); spectralFlux.clear(); + onsets.clear(); + onsetList.clear(); } // init() /** Creates a map of FFT frequency bins to comparison bins. @@ -137,13 +142,16 @@ int crossoverMidi = (int)lrint(log(crossoverBin*binWidth/440)/ log(2) * 12 + 69); int i = 0; - while (i <= crossoverBin && i <= fftSize/2) - freqMap[i++] = i; + while (i <= crossoverBin && i <= fftSize/2) { + freqMap[i] = i; + ++i; + } while (i <= fftSize/2) { double midi = log(i*binWidth/440) / log(2) * 12 + 69; if (midi > 127) midi = 127; - freqMap[i++] = crossoverBin + (int)lrint(midi) - crossoverMidi; + freqMap[i] = crossoverBin + (int)lrint(midi) - crossoverMidi; + ++i; } freqMapSize = freqMap[i-1] + 1; } // makeFreqMap()