diff NNLSBase.cpp @ 76:d398e73b46e0 matthiasm-plugin

it's broken at the moment, work in progress (makeing bins per semitone variable, ie not necessarily 3)
author Matthias Mauch <mail@matthiasmauch.net>
date Wed, 10 Nov 2010 22:52:46 +0900
parents 9a1f83057e84
children ba930176df5b
line wrap: on
line diff
--- a/NNLSBase.cpp	Tue Nov 02 10:05:48 2010 +0000
+++ b/NNLSBase.cpp	Wed Nov 10 22:52:46 2010 +0900
@@ -28,8 +28,6 @@
 
 const bool debug_on = false;
 
-const vector<float> hw(hammingwind, hammingwind+19);
-
 NNLSBase::NNLSBase(float inputSampleRate) :
     Plugin(inputSampleRate),
     m_logSpectrum(0),
@@ -354,6 +352,14 @@
         cerr << "--> initialise";
     }
 	
+	int hamwinlength = nBPS * 6 + 1;
+    float hamwinsum = 0;
+    for (int i = 0; i < hamwinlength; ++i) { 
+        hw.push_back(0.54 - 0.46 * cos((2*M_PI*i)/(hamwinlength-1)));    
+        hamwinsum += 0.54 - 0.46 * cos((2*M_PI*i)/(hamwinlength-1));
+    }
+    for (int i = 0; i < hamwinlength; ++i) hw[i] = round(hw[i] / hamwinsum * 10000)*1.0/10000;
+	
     if (channels < getMinChannelCount() ||
 	channels > getMaxChannelCount()) return false;
     m_blockSize = blockSize;