[xiph-cvs] cvs commit: postfish multibar.c multibar.h output.c version.h
Monty
xiphmont at xiph.org
Tue Oct 14 21:50:27 PDT 2003
xiphmont 03/10/15 00:50:27
Modified: . multibar.c multibar.h output.c version.h
Log:
Refine clipping and peak support toward simply timing update events
Revision Changes Path
1.7 +37 -53 postfish/multibar.c
Index: multibar.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/multibar.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- multibar.c 15 Oct 2003 03:25:19 -0000 1.6
+++ multibar.c 15 Oct 2003 04:50:27 -0000 1.7
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include "multibar.h"
+/* call me roughly 10-20fps */
static void draw(GtkWidget *widget,double *lowvals, double *highvals, int n){
int i,j;
Multibar *m=MULTIBAR(widget);
@@ -12,26 +13,18 @@
gdk_gc_copy(m->boxcolor,widget->style->black_gc);
}
- if(m->cliptimer.tv_sec){
- struct timeval tv;
- gettimeofday(&tv,NULL);
-
- long val=(tv.tv_sec-m->cliptimer.tv_sec)*1000+(tv.tv_usec-m->cliptimer.tv_usec)/1000;
- if(val>2000)memset(&m->cliptimer,0,sizeof(m->cliptimer));
- }
-
if(m->peaktimer.tv_sec){
struct timeval tv;
gettimeofday(&tv,NULL);
long val=(tv.tv_sec-m->peaktimer.tv_sec)*1000+(tv.tv_usec-m->peaktimer.tv_usec)/1000;
- if(val>1500) max = m->peak -= (val-1500)*.01;
+ if(val>2000) max = m->peak -= (val-2000)*.001;
}
for(i=0;i<n;i++)
if(highvals[i]>=0.){
- gettimeofday(&m->cliptimer,NULL);
+ clipdelay=15*10; /* ~ ten second hold */
break;
}
for(i=0;i<n;i++)
@@ -39,7 +32,8 @@
if(max>m->peak){
m->peak=max;
- gettimeofday(&m->peaktimer,NULL);
+ peakdelay=15*2; /* ~2 second hold */
+ peakdelta=0;
}
{
@@ -103,28 +97,20 @@
/* hi */
if(pixhi[i]>trackhi){
/* hi attack */
+ if(delhi<0.)delhi=0.;
if(m->dampen_flags & HI_ATTACK){
/* damp the attack */
- if(delhi<0.)
- delhi=1.;
- else
- delhi+=2;
+ delhi+=1;
pixhi[i]=trackhi+delhi;
- }else
- if(delhi<0.)delhi=0.;
-
+ }
}else{
/* hi decay */
+ if(delhi>0.)delhi=0.;
if(m->dampen_flags & HI_DECAY){
/* damp the decay */
- if(delhi>0.)
- delhi=-1.;
- else
- delhi-=2;
+ delhi-=1;
pixhi[i]=trackhi+delhi;
- }else
- if(delhi>0.)delhi=0.;
-
+ }
}
m->bartrackers[i].pixelposhi=pixhi[i];
m->bartrackers[i].pixeldeltahi=delhi;
@@ -132,28 +118,20 @@
/* lo */
if(pixlo[i]>tracklo){
/* lo attack */
+ if(dello<0.)dello=0.;
if(m->dampen_flags & LO_ATTACK){
/* damp the attack */
- if(dello<0.)
- dello=1.;
- else
- dello+=2;
+ dello+=1;
pixlo[i]=tracklo+dello;
- }else
- if(dello<0.)dello=0.;
-
+ }
}else{
/* lo decay */
+ if(dello>0.)dello=0.;
if(m->dampen_flags & LO_DECAY){
/* damp the decay */
- if(dello>0.)
- dello=-1.;
- else
- dello-=2;
+ dello-=1;
pixlo[i]=tracklo+dello;
- }else
- if(dello>0.)dello=0.;
-
+ }
}
m->bartrackers[i].pixelposlo=pixlo[i];
m->bartrackers[i].pixeldeltalo=dello;
@@ -170,11 +148,6 @@
if(pixhi[i]>x && pixhi[i]<next)next=pixhi[i];
}
- if(m->cliptimer.tv_sec!=0){
- g=0x6000;
- b=0x6000;
- }
-
for(i=0;i<n;i++){
if(pixlo[i]<=x && pixhi[i]>=next){
switch(i%8){
@@ -231,14 +204,25 @@
}
}
- gdk_draw_line (m->backing,
- widget->style->white_gc,
- 0, 0, widget->allocation.width-1, 0);
-
- gdk_draw_line (m->backing,
- widget->style->white_gc,
- 0, widget->allocation.height-1,
- widget->allocation.width-1, widget->allocation.height-1);
+ if(m->clipdelay){
+ gdk_draw_line (m->backing,
+ widget->style->fg_gc[1],
+ 0, 0, widget->allocation.width-1, 0);
+
+ gdk_draw_line (m->backing,
+ widget->style->fg_gc[1],
+ 0, widget->allocation.height-1,
+ widget->allocation.width-1, widget->allocation.height-1);
+ }else{
+ gdk_draw_line (m->backing,
+ widget->style->white_gc,
+ 0, 0, widget->allocation.width-1, 0);
+
+ gdk_draw_line (m->backing,
+ widget->style->white_gc,
+ 0, widget->allocation.height-1,
+ widget->allocation.width-1, widget->allocation.height-1);
+ }
/* peak follower */
{
@@ -262,7 +246,7 @@
{x-5,widget->allocation.height}},3);
- gdk_draw_line(m->backing,widget->style->fg_gc[1],x,0,x,widget->allocation.height-1);
+ gdk_draw_line(m->backing,widget->style->fg_gc[0],x,0,x,widget->allocation.height-1);
}
<p><p>1.5 +3 -2 postfish/multibar.h
Index: multibar.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/multibar.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- multibar.h 15 Oct 2003 02:01:46 -0000 1.4
+++ multibar.h 15 Oct 2003 04:50:27 -0000 1.5
@@ -43,9 +43,10 @@
GdkGC *boxcolor;
double peak;
+ int peakdelay;
+ double peakdelta;
- struct timeval cliptimer;
- struct timeval peaktimer;
+ int clipdelay;
bartrack *bartrackers;
int bars;
<p><p>1.3 +1 -1 postfish/output.c
Index: output.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/output.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- output.c 14 Oct 2003 08:39:08 -0000 1.2
+++ output.c 15 Oct 2003 04:50:27 -0000 1.3
@@ -181,7 +181,7 @@
struct timeval tv;
long foo;
gettimeofday(&tv,NULL);
- foo=tv.tv_sec*20+tv.tv_usec/50000;
+ foo=tv.tv_sec*15+tv.tv_usec*15/100000;
if(last!=foo)
write(eventpipe[1],"",1);
last=foo;
<p><p>1.6 +2 -2 postfish/version.h
Index: version.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/version.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- version.h 15 Oct 2003 03:25:19 -0000 1.5
+++ version.h 15 Oct 2003 04:50:27 -0000 1.6
@@ -1,2 +1,2 @@
-#define VERSION "$Id: version.h,v 1.5 2003/10/15 03:25:19 xiphmont Exp $ "
-/* DO NOT EDIT: Automated versioning hack [Tue Oct 14 23:22:34 EDT 2003] */
+#define VERSION "$Id: version.h,v 1.6 2003/10/15 04:50:27 xiphmont Exp $ "
+/* DO NOT EDIT: Automated versioning hack [Tue Oct 14 23:37:00 EDT 2003] */
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list