comparison dsp/tempotracking/DownBeat.cpp @ 70:c3cdb404f807

* build fixes for win32-x-g++
author cannam
date Tue, 02 Jun 2009 09:53:01 +0000
parents 6cb2b3cd5356
children 4fada56adbb8
comparison
equal deleted inserted replaced
69:6afa0e011f74 70:c3cdb404f807
215 } 215 }
216 } 216 }
217 217
218 // We now have all spectral difference measures in specdiff 218 // We now have all spectral difference measures in specdiff
219 219
220 uint timesig = m_bpb; 220 unsigned int timesig = m_bpb;
221 if (timesig == 0) timesig = 4; 221 if (timesig == 0) timesig = 4;
222 222
223 d_vec_t dbcand(timesig); // downbeat candidates 223 d_vec_t dbcand(timesig); // downbeat candidates
224 224
225 for (int beat = 0; beat < timesig; ++beat) { 225 for (int beat = 0; beat < timesig; ++beat) {
251 double 251 double
252 DownBeat::measureSpecDiff(d_vec_t oldspec, d_vec_t newspec) 252 DownBeat::measureSpecDiff(d_vec_t oldspec, d_vec_t newspec)
253 { 253 {
254 // JENSEN-SHANNON DIVERGENCE BETWEEN SPECTRAL FRAMES 254 // JENSEN-SHANNON DIVERGENCE BETWEEN SPECTRAL FRAMES
255 255
256 uint SPECSIZE = 512; // ONLY LOOK AT FIRST 512 SAMPLES OF SPECTRUM. 256 unsigned int SPECSIZE = 512; // ONLY LOOK AT FIRST 512 SAMPLES OF SPECTRUM.
257 if (SPECSIZE > oldspec.size()/4) { 257 if (SPECSIZE > oldspec.size()/4) {
258 SPECSIZE = oldspec.size()/4; 258 SPECSIZE = oldspec.size()/4;
259 } 259 }
260 double SD = 0.; 260 double SD = 0.;
261 double sd1 = 0.; 261 double sd1 = 0.;
262 262
263 double sumnew = 0.; 263 double sumnew = 0.;
264 double sumold = 0.; 264 double sumold = 0.;
265 265
266 for (uint i = 0;i < SPECSIZE;i++) 266 for (unsigned int i = 0;i < SPECSIZE;i++)
267 { 267 {
268 newspec[i] +=EPS; 268 newspec[i] +=EPS;
269 oldspec[i] +=EPS; 269 oldspec[i] +=EPS;
270 270
271 sumnew+=newspec[i]; 271 sumnew+=newspec[i];
272 sumold+=oldspec[i]; 272 sumold+=oldspec[i];
273 } 273 }
274 274
275 for (uint i = 0;i < SPECSIZE;i++) 275 for (unsigned int i = 0;i < SPECSIZE;i++)
276 { 276 {
277 newspec[i] /= (sumnew); 277 newspec[i] /= (sumnew);
278 oldspec[i] /= (sumold); 278 oldspec[i] /= (sumold);
279 279
280 // IF ANY SPECTRAL VALUES ARE 0 (SHOULDN'T BE ANY!) SET THEM TO 1 280 // IF ANY SPECTRAL VALUES ARE 0 (SHOULDN'T BE ANY!) SET THEM TO 1