comparison TempogramPlugin.cpp @ 49:b27e42b68c61

* Added reference tempo parameter for cyclic tempogram
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Tue, 30 Sep 2014 14:44:39 +0100
parents 8c151a9ca202
children 45ba1627d802
comparison
equal deleted inserted replaced
48:8c151a9ca202 49:b27e42b68c61
37 m_tempogramMaxBin(0), //set in initialise() 37 m_tempogramMaxBin(0), //set in initialise()
38 m_tempogramMinLag(0), //set in initialise() 38 m_tempogramMinLag(0), //set in initialise()
39 m_tempogramMaxLag(0), //set in initialise() 39 m_tempogramMaxLag(0), //set in initialise()
40 m_cyclicTempogramMinBPM(30), //reset in initialise() 40 m_cyclicTempogramMinBPM(30), //reset in initialise()
41 m_cyclicTempogramNumberOfOctaves(0), //set in initialise() 41 m_cyclicTempogramNumberOfOctaves(0), //set in initialise()
42 m_cyclicTempogramOctaveDivider(30) //parameter 42 m_cyclicTempogramOctaveDivider(30), //parameter
43 m_cyclicTempogramReferenceBPM(60)
43 44
44 // Also be sure to set your plugin parameters (presumably stored 45 // Also be sure to set your plugin parameters (presumably stored
45 // in member variables) to their default values here -- the host 46 // in member variables) to their default values here -- the host
46 // will not do that for you 47 // will not do that for you
47 { 48 {
236 d8.maxValue = 60; 237 d8.maxValue = 60;
237 d8.defaultValue = 30; 238 d8.defaultValue = 30;
238 d8.isQuantized = true; 239 d8.isQuantized = true;
239 d8.quantizeStep = 1; 240 d8.quantizeStep = 1;
240 list.push_back(d8); 241 list.push_back(d8);
242
243 ParameterDescriptor d9;
244 d9.identifier = "refBPM";
245 d9.name = "Cyclic Tempogram Reference BPM";
246 d9.description = "The reference BPM used when calculating the parameter \'s\' of the cyclic tempogram.";
247 d9.unit = "";
248 d9.minValue = 30;
249 d9.maxValue = 240;
250 d9.defaultValue = 60;
251 d9.isQuantized = true;
252 d9.quantizeStep = 1;
253 list.push_back(d9);
241 254
242 return list; 255 return list;
243 } 256 }
244 257
245 float 258 float
267 return m_tempogramMaxBPM; 280 return m_tempogramMaxBPM;
268 } 281 }
269 else if (identifier == "octDiv"){ 282 else if (identifier == "octDiv"){
270 return m_cyclicTempogramOctaveDivider; 283 return m_cyclicTempogramOctaveDivider;
271 } 284 }
285 else if (identifier == "refBPM"){
286 return m_cyclicTempogramReferenceBPM;
287 }
272 288
273 return 0; 289 return 0;
274 } 290 }
275 291
276 void 292 void
298 else if (identifier == "maxBPM"){ 314 else if (identifier == "maxBPM"){
299 m_tempogramMaxBPM = value; 315 m_tempogramMaxBPM = value;
300 } 316 }
301 else if (identifier == "octDiv"){ 317 else if (identifier == "octDiv"){
302 m_cyclicTempogramOctaveDivider = value; 318 m_cyclicTempogramOctaveDivider = value;
319 }
320 else if (identifier == "refBPM"){
321 m_cyclicTempogramReferenceBPM = value;
303 } 322 }
304 323
305 } 324 }
306 325
307 TempogramPlugin::ProgramList 326 TempogramPlugin::ProgramList
346 d1.hasKnownExtents = false; 365 d1.hasKnownExtents = false;
347 d1.isQuantized = false; 366 d1.isQuantized = false;
348 d1.sampleType = OutputDescriptor::FixedSampleRate; 367 d1.sampleType = OutputDescriptor::FixedSampleRate;
349 d_sampleRate = tempogramInputSampleRate/m_tempogramHopSize; 368 d_sampleRate = tempogramInputSampleRate/m_tempogramHopSize;
350 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 //assert((int)logBins[0].size() == m_cyclicTempogramOctaveDivider);
373 for(int i = 0; i < (int)m_cyclicTempogramOctaveDivider; i++){
374 //float s = binToBPM(logBins[0][i])/m_cyclicTempogramReferenceBPM;
375 //d1.binNames.push_back(floatToString(s));
376 }
377 }
351 d1.hasDuration = false; 378 d1.hasDuration = false;
352 list.push_back(d1); 379 list.push_back(d1);
353 380
354 OutputDescriptor d2; 381 OutputDescriptor d2;
355 d2.identifier = "tempogramDFT"; 382 d2.identifier = "tempogramDFT";