Mercurial > hg > btrack
comparison src/BTrack.cpp @ 101:1fcc06afd9cb
Removed confusing and unnecessary 'tempo' member variable
author | Adam Stark <adamstark.uk@gmail.com> |
---|---|
date | Sun, 03 Sep 2017 11:34:04 +0100 |
parents | 6aea5918992d |
children | 0a99d93955bb |
comparison
equal
deleted
inserted
replaced
100:6aea5918992d | 101:1fcc06afd9cb |
---|---|
102 | 102 |
103 | 103 |
104 // initialise parameters | 104 // initialise parameters |
105 tightness = 5; | 105 tightness = 5; |
106 alpha = 0.9; | 106 alpha = 0.9; |
107 tempo = 120; | |
108 estimatedTempo = 120.0; | 107 estimatedTempo = 120.0; |
109 tempoToLagFactor = 60. * 44100. / 512.; | 108 tempoToLagFactor = 60. * 44100. / 512.; |
110 | 109 |
111 m0 = 10; | 110 m0 = 10; |
112 beatCounter = -1; | 111 beatCounter = -1; |
144 latestCumulativeScoreValue = 0; | 143 latestCumulativeScoreValue = 0; |
145 | 144 |
146 // initialise algorithm given the hopsize | 145 // initialise algorithm given the hopsize |
147 setHopSize (hopSize_); | 146 setHopSize (hopSize_); |
148 | 147 |
149 | |
150 // Set up FFT for calculating the auto-correlation function | 148 // Set up FFT for calculating the auto-correlation function |
151 FFTLengthForACFCalculation = 1024; | 149 FFTLengthForACFCalculation = 1024; |
152 | 150 |
153 #ifdef USE_FFTW | 151 #ifdef USE_FFTW |
154 complexIn = (fftw_complex*) fftw_malloc (sizeof(fftw_complex) * FFTLengthForACFCalculation); // complex array to hold fft data | 152 complexIn = (fftw_complex*) fftw_malloc (sizeof(fftw_complex) * FFTLengthForACFCalculation); // complex array to hold fft data |
169 //======================================================================= | 167 //======================================================================= |
170 void BTrack::setHopSize (int hopSize_) | 168 void BTrack::setHopSize (int hopSize_) |
171 { | 169 { |
172 hopSize = hopSize_; | 170 hopSize = hopSize_; |
173 onsetDFBufferSize = (512 * 512) / hopSize; // calculate df buffer size | 171 onsetDFBufferSize = (512 * 512) / hopSize; // calculate df buffer size |
174 | 172 beatPeriod = round(60/((((double) hopSize)/44100) * 120.)); |
175 beatPeriod = round(60/((((double) hopSize)/44100)*tempo)); | |
176 | 173 |
177 // set size of onset detection function buffer | 174 // set size of onset detection function buffer |
178 onsetDF.resize (onsetDFBufferSize); | 175 onsetDF.resize (onsetDFBufferSize); |
179 | 176 |
180 // set size of cumulative score buffer | 177 // set size of cumulative score buffer |