changeset 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 f795b84c1ff2 c8dd1049b2d3
files TempogramPlugin.cpp
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/TempogramPlugin.cpp	Tue Sep 02 11:40:48 2014 +0100
+++ b/TempogramPlugin.cpp	Wed Sep 03 13:50:02 2014 +0100
@@ -288,10 +288,10 @@
         m_tempogramLog2WindowLength = value;
     }
     else if (identifier == "log2HopSize"){
-        m_tempogramHopSize = pow(2,value);
+        m_tempogramLog2HopSize = value;
     }
     else if (identifier == "log2FftLength"){
-        m_tempogramFftLength = pow(2,value);
+        m_tempogramLog2FftLength = value;
     }
     else if (identifier == "minBPM") {
         m_tempogramMinBPM = value;
@@ -580,12 +580,9 @@
 
 bool TempogramPlugin::handleParameterValues(){
     
-    if (m_tempogramHopSize <= 0) return false;
+    if (m_tempogramLog2HopSize <= 0) return false;
     if (m_tempogramLog2FftLength <= 0) return false;
     
-    if (m_tempogramFftLength < m_tempogramWindowLength){
-        m_tempogramFftLength = m_tempogramWindowLength;
-    }
     if (m_tempogramMinBPM >= m_tempogramMaxBPM){
         m_tempogramMinBPM = 30;
         m_tempogramMaxBPM = 480;
@@ -597,6 +594,10 @@
     m_tempogramHopSize = pow(2,m_tempogramLog2HopSize);
     m_tempogramFftLength = pow(2,m_tempogramLog2FftLength);
     
+    if (m_tempogramFftLength < m_tempogramWindowLength){
+        m_tempogramFftLength = m_tempogramWindowLength;
+    }
+    
     float tempogramInputSampleRate = (float)m_inputSampleRate/m_inputStepSize;
     m_tempogramMinBin = (max((int)floor(((m_tempogramMinBPM/60)/tempogramInputSampleRate)*m_tempogramFftLength), 0));
     m_tempogramMaxBin = (min((int)ceil(((m_tempogramMaxBPM/60)/tempogramInputSampleRate)*m_tempogramFftLength), (int)(m_tempogramFftLength/2)));