Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28055

Modified Files:
        FreqWindow.cpp 
Log Message:
Attempt at making different windows give the same resulting peak value.  Works 
well for noise-like signals.

Index: FreqWindow.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/FreqWindow.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- FreqWindow.cpp      15 Apr 2009 23:09:20 -0000      1.70
+++ FreqWindow.cpp      19 Apr 2009 22:55:33 -0000      1.71
@@ -313,7 +313,7 @@
    vRuler->ruler.SetRange(10.0, -dBRange);
    vRuler->ruler.SetFormat(Ruler::LinearDBFormat);
    vRuler->ruler.SetUnits(_("dB"));
-   vRuler->ruler.SetLabelEdges(true);
+   vRuler->ruler.SetLabelEdges(false);
 
    int w, h;
    vRuler->ruler.GetMaxSize(&w, NULL);
@@ -1003,6 +1003,10 @@
    for(int i=0; i<mWindowSize; i++)
       win[i] = 1.0;
    WindowFunc(windowFunc, mWindowSize, win);
+   double wss = 0.;
+   for(int i=0; i<mWindowSize; i++)
+      wss += win[i]*win[i];
+   wss *= mWindowSize;
 
    int start = 0;
    int windows = 0;
@@ -1081,7 +1085,7 @@
       // Convert to decibels
       mYMin = 1000000.;
       mYMax = -1000000.;
-      scale = (double)mWindowSize * (double)mWindowSize * (double)windows;
+      scale = (double)windows * wss;
       for (i = 0; i < half; i++)
       {
          mProcessed[i] = 10 * log10(mProcessed[i] / scale);


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to