[xiph-commits] r17698 - trunk/squishyball

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Wed Dec 1 11:11:52 PST 2010


Author: xiphmont
Date: 2010-12-01 11:11:50 -0800 (Wed, 01 Dec 2010)
New Revision: 17698

Modified:
   trunk/squishyball/main.c
   trunk/squishyball/mincurses.c
   trunk/squishyball/tty.c
Log:
better rounding in make_time_string
Keep length computation consistent to forestall cosmetic rounding errors
Add a kludge for rxvt and other terminals that don't clear acs mode when
unsetting other term attributes



Modified: trunk/squishyball/main.c
===================================================================
--- trunk/squishyball/main.c	2010-12-01 18:24:15 UTC (rev 17697)
+++ trunk/squishyball/main.c	2010-12-01 19:11:50 UTC (rev 17698)
@@ -600,7 +600,8 @@
     off_t end_pos=(end>0?rint(end*rate*bpf):size);
     off_t current_pos;
     int paused=0;
-    double len=pcm[0]->size/((pcm[0]->bits+7)/8)/pcm[0]->ch/(double)pcm[0]->rate;
+    double base = 1.f/(rate*bpf);
+    double len = pcm[0]->size*base;
     fragsize=fragsamples*bpf;
 
     /* guard start/end params */
@@ -837,10 +838,8 @@
 
       /* update terminal */
       {
-        double base = 1.f/(rate*bpf);
         double current = current_pos*base;
         double start = start_pos*base;
-        double len = pcm[0]->size*base;
         double end = end_pos>0?end_pos*base:len;
 
         pthread_mutex_unlock(&state.mutex);

Modified: trunk/squishyball/mincurses.c
===================================================================
--- trunk/squishyball/mincurses.c	2010-12-01 18:24:15 UTC (rev 17697)
+++ trunk/squishyball/mincurses.c	2010-12-01 19:11:50 UTC (rev 17698)
@@ -489,9 +489,16 @@
 static int ul=0;
 
 static int unset(){
+  int ret=0;
+  /* some terminals do not consider acs mode an attribute to be cleared, some do */
+  if(exit_alt_charset_mode){
+     min_putp(exit_alt_charset_mode);
+  }else
+    ret|=1;
   if(exit_attribute_mode){
     min_putp(exit_attribute_mode);
-    return 0;
+    min_putp(exit_alt_charset_mode);
+    return ret;
   }else
     return 1;
 }

Modified: trunk/squishyball/tty.c
===================================================================
--- trunk/squishyball/tty.c	2010-12-01 18:24:15 UTC (rev 17697)
+++ trunk/squishyball/tty.c	2010-12-01 19:11:50 UTC (rev 17698)
@@ -43,7 +43,7 @@
 
 static char timebuffer[80];
 char *make_time_string(double is,int pad){
-  double s=is+1e-6f;
+  double s = rint(is*100)/100.;
   long hrs=s/60/60;
   long min=s/60-hrs*60;
   long sec=s-hrs*60*60-min*60;
@@ -302,7 +302,7 @@
   }
 
   if(columns<70){
-    fprintf(stderr,"Squishball requires a >=70 column terminal to run.\n");
+    fprintf(stderr,"Squisyhball requires a >=70 column terminal to run.\n");
     exit(102);
   }
 



More information about the commits mailing list