Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv11085/src

Modified Files:
        TrackPanel.cpp 
Log Message:
Fix for a bug zooming in at high frequencies.

Index: TrackPanel.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackPanel.cpp,v
retrieving revision 1.336
retrieving revision 1.337
diff -u -d -r1.336 -r1.337
--- TrackPanel.cpp      16 Jan 2007 00:45:03 -0000      1.336
+++ TrackPanel.cpp      28 Jan 2007 15:45:51 -0000      1.337
@@ -2406,7 +2406,7 @@
 
    float min, max, c, l, binSize;
    bool spectrum;
-   int windowSize;
+   int windowSize, minBins;
    double rate = ((WaveTrack *)track)->GetRate();
    ((WaveTrack *) track)->GetDisplay() == WaveTrack::SpectrumDisplay ? 
spectrum = true : spectrum = false;
    if(spectrum) {
@@ -2414,8 +2414,11 @@
       if(min < 0)
          min = 0;
       max = gPrefs->Read(wxT("/Spectrum/MaxFreq"), 8000L);
+      if(max > rate/2.)
+         max = rate/2.;
       windowSize = gPrefs->Read(wxT("/Spectrum/FFTSize"), 256);
       binSize = rate / windowSize;
+      minBins = wxMin(10, windowSize/2); //minimum 10 freq bins, unless there 
are less
    }
    else
       track->GetDisplayBounds(&min, &max);
@@ -2435,8 +2438,12 @@
       if(spectrum) {
          if(min < 0.)
             min = 0.;
-         if(max < min + 10. * binSize) //minimum 10 freq bins
-            max = min + 10. * binSize;
+         if(max < min + minBins * binSize)
+            max = min + minBins * binSize;
+         if(max > rate/2.) {
+            max = rate/2.;
+            min = max - minBins * binSize;
+         }
       }
       else {
          if (max - min < 0.2) {


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to