changeset 1056:b4fd6c67fce5 3.0-integration

Comments and minor tidy
author Chris Cannam
date Mon, 13 Jun 2016 11:44:08 +0100
parents 00891cfaa4d3
children 218be6cf2d4f 74f2706995b7
files layer/SpectrogramLayer.cpp
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Mon Jun 13 11:44:03 2016 +0100
+++ b/layer/SpectrogramLayer.cpp	Mon Jun 13 11:44:08 2016 +0100
@@ -2436,11 +2436,13 @@
     
     for (int x = start; x != finish; x += step) {
 
+        // x is the on-canvas pixel coord; sx (later) will be the
+        // source column index
+        
         ++columnCount;
         
         if (binforx[x] < 0) continue;
 
-//        float columnGain = m_gain;
         float columnMax = 0.f;
 
         int sx0 = binforx[x] / divisor;
@@ -2472,9 +2474,9 @@
                     } else if (m_normalization == NormalizeColumns) {
                         fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
                     } else if (m_normalization == NormalizeHybrid) {
-                        float max = fft->getNormalizedMagnitudesAt(sx, autoarray, minbin, maxbin - minbin + 1);
+                        float max = fft->getNormalizedMagnitudesAt
+                            (sx, autoarray, minbin, maxbin - minbin + 1);
                         float scale = log10f(max + 1.f);
-//                        cout << "sx = " << sx << ", max = " << max << ", log10(max) = " << log10(max) << ", scale = " << scale << endl;
                         for (int i = minbin; i <= maxbin; ++i) {
                             autoarray[i - minbin] *= scale;
                         }
@@ -2586,6 +2588,13 @@
             }
         }
 
+        // at this point we have updated m_columnMags and overallMag
+        // -- used elsewhere for calculating the overall view range
+        // for NormalizeVisibleArea mode -- and calculated "peaks"
+        // (the possibly scaled and interpolated value array from
+        // which we actually draw the column) and "columnMax" (maximum
+        // value used for normalisation)
+        
         for (int y = 0; y < h; ++y) {
 
             double peak = peaks[y];