[xiph-commits] r18424 - trunk/spectrum

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sun Jun 24 23:20:46 PDT 2012


Author: xiphmont
Date: 2012-06-24 23:20:46 -0700 (Sun, 24 Jun 2012)
New Revision: 18424

Modified:
   trunk/spectrum/spec_panel.c
   trunk/spectrum/version.h
Log:
Correct minor autoscale ranging bug; if the new ymax target was less
than 10% off, it would never trigger even if the real, unclamped ymax
was well below



Modified: trunk/spectrum/spec_panel.c
===================================================================
--- trunk/spectrum/spec_panel.c	2012-06-21 21:36:01 UTC (rev 18423)
+++ trunk/spectrum/spec_panel.c	2012-06-25 06:20:46 UTC (rev 18424)
@@ -193,7 +193,7 @@
     break;
   }
 
-  if(ymax<plot_depth - plot_ymax_limit) ymax=plot_depth-plot_ymax_limit;
+  if(ymax<-plot_ymax_limit) ymax=-plot_ymax_limit;
   if(ymax>plot_ymax_limit)ymax=plot_ymax_limit;
 
   pmax+=10;
@@ -241,7 +241,13 @@
   }
 
   if(request_reset){
-    pp->ymax=plot_ymax_target=ymax;
+    plot_ymax_target=ymax;
+
+    /* clamp target range *here* */
+    if(plot_ymax_target<plot_depth - plot_ymax_limit)
+      plot_ymax_target=plot_depth-plot_ymax_limit;
+
+    pp->ymax=plot_ymax_target;
     filter_reset(&plot_ymax_damp,pp->ymax);
     plot_ymaxtimer=HYSTERESIS_TIMERFRAMES;
 
@@ -265,6 +271,10 @@
     if(ymax > plot_ymax_target || plot_ymaxtimer<=0)
       plot_ymax_target=ymax;
 
+    /* ...and *here* */
+    if(plot_ymax_target<plot_depth - plot_ymax_limit)
+      plot_ymax_target=plot_depth-plot_ymax_limit;
+
     /* update ymax through scale damping filter */
     pp->ymax = filter_filter(plot_ymax_target,&plot_ymax_damp);
 

Modified: trunk/spectrum/version.h
===================================================================
--- trunk/spectrum/version.h	2012-06-21 21:36:01 UTC (rev 18423)
+++ trunk/spectrum/version.h	2012-06-25 06:20:46 UTC (rev 18424)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Wed Jun 20 01:44:39 EDT 2012] */
+/* DO NOT EDIT: Automated versioning hack [Mon Jun 25 02:18:07 EDT 2012] */



More information about the commits mailing list