Mercurial > hg > vamp-tempogram
comparison TempogramPlugin.cpp @ 51:c7cc649dc9b6
* I had made further changes to previous revisions accidentally. Now should wor.
author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
---|---|
date | Tue, 30 Sep 2014 16:19:31 +0100 |
parents | 45ba1627d802 |
children | eff9dc53de62 |
comparison
equal
deleted
inserted
replaced
50:45ba1627d802 | 51:c7cc649dc9b6 |
---|---|
237 d8.maxValue = 60; | 237 d8.maxValue = 60; |
238 d8.defaultValue = 30; | 238 d8.defaultValue = 30; |
239 d8.isQuantized = true; | 239 d8.isQuantized = true; |
240 d8.quantizeStep = 1; | 240 d8.quantizeStep = 1; |
241 list.push_back(d8); | 241 list.push_back(d8); |
242 | |
243 ParameterDescriptor d9; | |
244 d8.identifier = "refBPM"; | |
245 d8.name = "Cyclic Tempogram Reference Tempo"; | |
246 d8.description = "The reference tempo used when calculating the Cyclic Tempogram parameter \'s\'."; | |
247 d8.unit = ""; | |
248 d8.minValue = 5; | |
249 d8.maxValue = 60; | |
250 d8.defaultValue = 30; | |
251 d8.isQuantized = true; | |
252 d8.quantizeStep = 1; | |
253 list.push_back(d8); | |
242 | 254 |
243 return list; | 255 return list; |
244 } | 256 } |
245 | 257 |
246 float | 258 float |
268 return m_tempogramMaxBPM; | 280 return m_tempogramMaxBPM; |
269 } | 281 } |
270 else if (identifier == "octDiv"){ | 282 else if (identifier == "octDiv"){ |
271 return m_cyclicTempogramOctaveDivider; | 283 return m_cyclicTempogramOctaveDivider; |
272 } | 284 } |
285 else if (identifier == "refBPM"){ | |
286 return m_cyclicTempogramReferenceBPM; | |
287 } | |
273 | 288 |
274 return 0; | 289 return 0; |
275 } | 290 } |
276 | 291 |
277 void | 292 void |
299 else if (identifier == "maxBPM"){ | 314 else if (identifier == "maxBPM"){ |
300 m_tempogramMaxBPM = value; | 315 m_tempogramMaxBPM = value; |
301 } | 316 } |
302 else if (identifier == "octDiv"){ | 317 else if (identifier == "octDiv"){ |
303 m_cyclicTempogramOctaveDivider = value; | 318 m_cyclicTempogramOctaveDivider = value; |
319 } | |
320 else if (identifier == "refBPM"){ | |
321 m_cyclicTempogramReferenceBPM = value; | |
304 } | 322 } |
305 | 323 |
306 } | 324 } |
307 | 325 |
308 TempogramPlugin::ProgramList | 326 TempogramPlugin::ProgramList |
347 d1.hasKnownExtents = false; | 365 d1.hasKnownExtents = false; |
348 d1.isQuantized = false; | 366 d1.isQuantized = false; |
349 d1.sampleType = OutputDescriptor::FixedSampleRate; | 367 d1.sampleType = OutputDescriptor::FixedSampleRate; |
350 d_sampleRate = tempogramInputSampleRate/m_tempogramHopSize; | 368 d_sampleRate = tempogramInputSampleRate/m_tempogramHopSize; |
351 d1.sampleRate = d_sampleRate > 0.0 && !isnan(d_sampleRate) ? d_sampleRate : 0; | 369 d1.sampleRate = d_sampleRate > 0.0 && !isnan(d_sampleRate) ? d_sampleRate : 0; |
370 vector< vector <unsigned int> > logBins = calculateTempogramNearestNeighbourLogBins(); | |
371 if (!logBins.empty()){ | |
372 float scale = pow(2,floor(60/logBins[0][0])); | |
373 | |
374 cerr << m_cyclicTempogramOctaveDivider << endl; | |
375 for(int i = 0; i < m_cyclicTempogramNumberOfOctaves; i++){ | |
376 float s = fmod(binToBPM(logBins[0][i]), m_cyclicTempogramReferenceBPM)*scale; | |
377 d1.binNames.push_back(floatToString(s)); | |
378 cerr << i << endl; | |
379 //cerr << m_cyclicTempogramOctaveDivider << " " << s << endl; | |
380 } | |
381 } | |
352 d1.hasDuration = false; | 382 d1.hasDuration = false; |
353 list.push_back(d1); | 383 list.push_back(d1); |
354 | 384 |
355 OutputDescriptor d2; | 385 OutputDescriptor d2; |
356 d2.identifier = "tempogramDFT"; | 386 d2.identifier = "tempogramDFT"; |