Mercurial > hg > vamp-tempogram
comparison TempogramPlugin.cpp @ 30:36cffe6493e4
* Made sure the FFT variables are initialised in initialise()
author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
---|---|
date | Wed, 03 Sep 2014 13:50:02 +0100 |
parents | 1ad47a9afc2e |
children | 023d12fb71b1 |
comparison
equal
deleted
inserted
replaced
29:1ad47a9afc2e | 30:36cffe6493e4 |
---|---|
286 } | 286 } |
287 else if (identifier == "log2TN") { | 287 else if (identifier == "log2TN") { |
288 m_tempogramLog2WindowLength = value; | 288 m_tempogramLog2WindowLength = value; |
289 } | 289 } |
290 else if (identifier == "log2HopSize"){ | 290 else if (identifier == "log2HopSize"){ |
291 m_tempogramHopSize = pow(2,value); | 291 m_tempogramLog2HopSize = value; |
292 } | 292 } |
293 else if (identifier == "log2FftLength"){ | 293 else if (identifier == "log2FftLength"){ |
294 m_tempogramFftLength = pow(2,value); | 294 m_tempogramLog2FftLength = value; |
295 } | 295 } |
296 else if (identifier == "minBPM") { | 296 else if (identifier == "minBPM") { |
297 m_tempogramMinBPM = value; | 297 m_tempogramMinBPM = value; |
298 } | 298 } |
299 else if (identifier == "maxBPM"){ | 299 else if (identifier == "maxBPM"){ |
578 return (bin*sampleRate/m_tempogramFftLength)*60; | 578 return (bin*sampleRate/m_tempogramFftLength)*60; |
579 } | 579 } |
580 | 580 |
581 bool TempogramPlugin::handleParameterValues(){ | 581 bool TempogramPlugin::handleParameterValues(){ |
582 | 582 |
583 if (m_tempogramHopSize <= 0) return false; | 583 if (m_tempogramLog2HopSize <= 0) return false; |
584 if (m_tempogramLog2FftLength <= 0) return false; | 584 if (m_tempogramLog2FftLength <= 0) return false; |
585 | 585 |
586 if (m_tempogramFftLength < m_tempogramWindowLength){ | |
587 m_tempogramFftLength = m_tempogramWindowLength; | |
588 } | |
589 if (m_tempogramMinBPM >= m_tempogramMaxBPM){ | 586 if (m_tempogramMinBPM >= m_tempogramMaxBPM){ |
590 m_tempogramMinBPM = 30; | 587 m_tempogramMinBPM = 30; |
591 m_tempogramMaxBPM = 480; | 588 m_tempogramMaxBPM = 480; |
592 } | 589 } |
593 | 590 |
595 | 592 |
596 m_tempogramWindowLength = pow(2,m_tempogramLog2WindowLength); | 593 m_tempogramWindowLength = pow(2,m_tempogramLog2WindowLength); |
597 m_tempogramHopSize = pow(2,m_tempogramLog2HopSize); | 594 m_tempogramHopSize = pow(2,m_tempogramLog2HopSize); |
598 m_tempogramFftLength = pow(2,m_tempogramLog2FftLength); | 595 m_tempogramFftLength = pow(2,m_tempogramLog2FftLength); |
599 | 596 |
597 if (m_tempogramFftLength < m_tempogramWindowLength){ | |
598 m_tempogramFftLength = m_tempogramWindowLength; | |
599 } | |
600 | |
600 float tempogramInputSampleRate = (float)m_inputSampleRate/m_inputStepSize; | 601 float tempogramInputSampleRate = (float)m_inputSampleRate/m_inputStepSize; |
601 m_tempogramMinBin = (max((int)floor(((m_tempogramMinBPM/60)/tempogramInputSampleRate)*m_tempogramFftLength), 0)); | 602 m_tempogramMinBin = (max((int)floor(((m_tempogramMinBPM/60)/tempogramInputSampleRate)*m_tempogramFftLength), 0)); |
602 m_tempogramMaxBin = (min((int)ceil(((m_tempogramMaxBPM/60)/tempogramInputSampleRate)*m_tempogramFftLength), (int)(m_tempogramFftLength/2))); | 603 m_tempogramMaxBin = (min((int)ceil(((m_tempogramMaxBPM/60)/tempogramInputSampleRate)*m_tempogramFftLength), (int)(m_tempogramFftLength/2))); |
603 | 604 |
604 m_tempogramMinLag = max((int)ceil((60/(m_inputStepSize * m_tempogramMaxBPM))*m_inputSampleRate), 0); | 605 m_tempogramMinLag = max((int)ceil((60/(m_inputStepSize * m_tempogramMaxBPM))*m_inputSampleRate), 0); |