diff base/FFTCache.cpp @ 128:f47f4c7c158c

* Add FFT data server class to provide a file cache mapping for each required set of FFT parameters and source model. Make use of it in feature extraction plugin transform, though not in other places yet. * Add zero-pad option to spectrogram layer and remove window shape option from the property box. To be revised.
author Chris Cannam
date Mon, 26 Jun 2006 16:12:11 +0000
parents c4e163f911dd
children 4b2ea82fd0ed
line wrap: on
line diff
--- a/base/FFTCache.cpp	Mon Jun 26 16:08:01 2006 +0000
+++ b/base/FFTCache.cpp	Mon Jun 26 16:12:11 2006 +0000
@@ -99,3 +99,20 @@
     }
 }	    
 
+void
+FFTMemoryCache::setColumnAt(size_t x, float *reals, float *imags)
+{
+    float max = 0.0;
+
+    for (size_t y = 0; y < m_height; ++y) {
+        float mag = sqrtf(reals[y] * reals[y] + imags[y] * imags[y]);
+        float phase = atan2f(imags[y], reals[y]);
+        phase = princargf(phase);
+        reals[y] = mag;
+        imags[y] = phase;
+        if (mag > max) max = mag;
+    }
+
+    setColumnAt(x, reals, imags, max);
+}
+