[xiph-cvs] cvs commit: postfish clippanel.c eq.c eq.h eqpanel.c freq.c freq.h mainpanel.c multibar.c multibar.h output.c postfish-gtkrc version.h

Monty xiphmont at xiph.org
Wed Feb 18 16:49:38 PST 2004



xiphmont    04/02/18 19:49:38

  Modified:    .        clippanel.c eq.c eq.h eqpanel.c freq.c freq.h
                        mainpanel.c multibar.c multibar.h output.c
                        postfish-gtkrc version.h
  Log:
  Since I couldn't sleep this morning like a normal hacker...
  
  EQ panel linked in, working, debugged

Revision  Changes    Path
1.11      +4 -2      postfish/clippanel.c

Index: clippanel.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/clippanel.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- clippanel.c	16 Feb 2004 05:00:54 -0000	1.10
+++ clippanel.c	19 Feb 2004 00:49:37 -0000	1.11
@@ -328,8 +328,10 @@
       val[1]=(count?clip[i]*100./count-.1:-1);
       zero[1]=-1.;
       multibar_set(MULTIBAR(feedback_bars[i]),zero,val,2);
-      val[1]=(count?peak[i]:-1);
-      multibar_set(MULTIBAR(trigger_bars[i]),zero,val,2);
+
+      val[0]=(count?peak[i]:-1);
+      multibar_set(MULTIBAR(trigger_bars[i]),zero,val,1);
+
       if(clip[i]){
         multibar_setwarn(MULTIBAR(mainpanel_inbar));
         multibar_setwarn(MULTIBAR(feedback_bars[i]));

<p><p>1.2       +32 -1     postfish/eq.c

Index: eq.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/eq.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- eq.c	17 Feb 2004 11:52:17 -0000	1.1
+++ eq.c	19 Feb 2004 00:49:37 -0000	1.2
@@ -21,6 +21,7 @@
  * 
  */
 
+#include <sys/types.h>
 #include "postfish.h"
 #include "feedback.h"
 #include "freq.h"
@@ -38,7 +39,7 @@
 
 /* called only by initial setup */
 int eq_load(void){
-  return freq_load(&eq,input_size);
+  return freq_load(&eq,input_size*2);
 }
 
 /* called only in playback thread */
@@ -46,8 +47,38 @@
   return freq_reset(&eq);
 }
 
+sig_atomic_t settings[freqs];
+
+void eq_set(int freq, double value){
+  settings[freq]=rint(value*10.);
+}
+  
 static void workfunc(double *data,freq_state *f,
                      double *peak, double *rms){
+  int i,j,k;
+  double work[f->blocksize+1];
+  double sq_mags[f->blocksize+1];
+
+  if(eq_active){
+    memset(work,0,sizeof(work));
+    
+    for(i=0;i<freqs;i++){
+      double set=fromdB(settings[i]*.1);
+      for(k=0,j=f->ho_bin_lo[i];j<f->ho_bin_hi[i];j++,k++)
+	work[j]+=f->ho_window[i][k]*set;
+      peak[i]*=set;
+      rms[i]*=set;
+    }
+    
+    data[0]*=work[0];
+    data[f->blocksize*2-1]*=work[f->blocksize];
+    for(i=1;i<f->blocksize;i++){
+      data[i*2]*=work[i];
+      data[i*2-1]*=work[i];
+    }
+  }
+
+  freq_metric_work(data,f,sq_mags,peak,rms);
 
   return;
 }

<p><p>1.2       +1 -0      postfish/eq.h

Index: eq.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/eq.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- eq.h	17 Feb 2004 11:52:17 -0000	1.1
+++ eq.h	19 Feb 2004 00:49:37 -0000	1.2
@@ -26,4 +26,5 @@
 extern int pull_eq_feedback(double **peak,double **rms);
 extern int eq_load(void);
 extern int eq_reset();
+extern void eq_set(int freq, double value);
 extern time_linkage *eq_read(time_linkage *in);

<p><p>1.2       +30 -26    postfish/eqpanel.c

Index: eqpanel.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/eqpanel.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- eqpanel.c	17 Feb 2004 11:52:17 -0000	1.1
+++ eqpanel.c	19 Feb 2004 00:49:37 -0000	1.2
@@ -53,7 +53,7 @@
   sprintf(buffer,"%+5.1f dB",val);
   readout_set(READOUT(b->readout),buffer);
   
-  //eq_setlevel(val,p->number);
+  eq_set(b->number,val);
 
 }
 
@@ -73,26 +73,27 @@
   GtkWidget *slidertable=gtk_table_new(freqs,3,0);
 
   for(i=0;i<freqs;i++){
-    const char *labeltext="";
-    if((i&1)==0)labeltext=freq_frequency_label(i);
+    const char *labeltext=freq_frequency_label(i);
 
     GtkWidget *label=gtk_label_new(labeltext);
+    gtk_widget_set_name(label,"smallmarker");
+
     bars[i].readout=readout_new("+00.0 dB");
     bars[i].slider=multibar_new(15,labels,levels,1,
-				LO_ATTACK|LO_DECAY|HI_DECAY);
+				LO_DECAY|HI_DECAY|LO_ATTACK|HI_ATTACK);
     bars[i].number=i;
 
     multibar_callback(MULTIBAR(bars[i].slider),slider_change,bars+i);
     multibar_thumb_set(MULTIBAR(bars[i].slider),0.,0);
-    multibar_thumb_bounds(MULTIBAR(bars[i].slider),-60,30);
+    multibar_thumb_bounds(MULTIBAR(bars[i].slider),-40,30);
 
     gtk_misc_set_alignment(GTK_MISC(label),1,.5);
 
     gtk_table_attach(GTK_TABLE(slidertable),label,0,1,i,i+1,
                      GTK_FILL,0,10,0);
-    gtk_table_attach(GTK_TABLE(slidertable),bars[i].readout,1,2,i,i+1,
+    gtk_table_attach(GTK_TABLE(slidertable),bars[i].readout,2,3,i,i+1,
                      GTK_FILL,0,0,0);
-    gtk_table_attach(GTK_TABLE(slidertable),bars[i].slider,2,3,i,i+1,
+    gtk_table_attach(GTK_TABLE(slidertable),bars[i].slider,1,2,i,i+1,
                      GTK_FILL|GTK_EXPAND,GTK_FILL|GTK_EXPAND,0,0);
   }
 
@@ -100,28 +101,25 @@
 
 }
 
+static double **peakfeed=0;
+static double **rmsfeed=0;
+
 void eqpanel_feedback(void){
-#if 0
-  int clip[input_ch],count;
-  double peak[input_ch];
-  if(pull_declip_feedback(clip,peak,&count)){
-    int i;
-    for(i=0;i<input_ch;i++){
-      double val[2],zero[2];
-      val[0]=-1.,zero[0]=-1.;
-      val[1]=(count?clip[i]*100./count-.1:-1);
-      zero[1]=-1.;
-      multibar_set(MULTIBAR(feedback_bars[i]),zero,val,2);
-      val[1]=(count?peak[i]:-1);
-      multibar_set(MULTIBAR(trigger_bars[i]),zero,val,2);
-      if(clip[i]){
-	multibar_setwarn(MULTIBAR(mainpanel_inbar));
-	multibar_setwarn(MULTIBAR(feedback_bars[i]));
-	multibar_setwarn(MULTIBAR(trigger_bars[i]));
-      }
+  int i;
+  if(!peakfeed){
+    peakfeed=malloc(sizeof(*peakfeed)*freqs);
+    rmsfeed=malloc(sizeof(*rmsfeed)*freqs);
+
+    for(i=0;i<freqs;i++){
+      peakfeed[i]=malloc(sizeof(**peakfeed)*input_ch);
+      rmsfeed[i]=malloc(sizeof(**rmsfeed)*input_ch);
     }
   }
-#endif
+  
+  if(pull_eq_feedback(peakfeed,rmsfeed))
+    for(i=0;i<freqs;i++)
+      multibar_set(MULTIBAR(bars[i].slider),rmsfeed[i],peakfeed[i],input_ch);
+
 }
 
 void eqpanel_reset(void){
@@ -129,3 +127,9 @@
   for(i=0;i<freqs;i++)
     multibar_reset(MULTIBAR(bars[i].slider));
 }
+
+
+
+
+
+

<p><p>1.2       +70 -64    postfish/freq.c

Index: freq.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/freq.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- freq.c	17 Feb 2004 11:52:17 -0000	1.1
+++ freq.c	19 Feb 2004 00:49:37 -0000	1.2
@@ -27,32 +27,7 @@
 #include "feedback.h"
 #include "freq.h"
 
-extern int input_rate;
-extern int input_ch;
-extern int input_size;
-
-/* feedback! */
-typedef struct freq_feedback{
-  feedback_generic parent_class;
-  double **peak;
-  double **rms;
-} freq_feedback;
-
-/* accessed only in playback thread/setup */
-static double frequencies[freqs+1];
-static char *freq_labels[freqs]={
-  "31", "37","44","53",
-  "63", "75","88","105",
-  "125","150","180","210",
-  "250","300","350","420",
-  "500","600", "700", "840",
-  "1k", "1.2k", "1.4k", "1.7k",
-  "2k", "2.4k", "2.8k", "3.4k",
-  "4k", "4.8k", "5.6k", "6.7k",
-  "8k", "9.5k", "11k", "13k",
-  "16k","19k",  "22k"
-};
-
+#include <stdio.h>
 void _analysis(char *base,int i,double *v,int n,int bark,int dB){
   int j;
   FILE *of;
@@ -72,10 +47,10 @@
     
     if(dB){
       if(j==0||j==n-1)
-	fprintf(of,"%f\n",todB(v[j]));
+        fprintf(of,"%f\n",todB(v[j]));
       else{
-	fprintf(of,"%f\n",todB(hypot(v[j],v[j+1])));
-	j++;
+        fprintf(of,"%f\n",todB(hypot(v[j],v[j+1])));
+        j++;
       }
     }else{
       fprintf(of,"%f\n",v[j]);
@@ -84,6 +59,33 @@
   fclose(of);
 }
 
+extern int input_rate;
+extern int input_ch;
+extern int input_size;
+
+/* feedback! */
+typedef struct freq_feedback{
+  feedback_generic parent_class;
+  double **peak;
+  double **rms;
+} freq_feedback;
+
+/* accessed only in playback thread/setup */
+static double frequencies[freqs+1]={
+  25,31.5,40,50,63,80,
+  100,125,160,200,250,315,
+  400,500,630,800,1000,1250,1600,
+  2000,2500,3150,4000,5000,6300,
+  8000,10000,12500,16000,20000,9e10};
+
+static char *freq_labels[freqs]={
+  "25","31.5","40","50","63","80",
+  "100","125","160","200","250","315",
+  "400","500","630","800","1k","1.2k","1.6k",
+  "2k","2.5k","3.1k","4k","5k","6.3k",
+  "8k","10k","12.5k","16k","20k"
+};
+
 static feedback_generic *new_freq_feedback(void){
   int i;
   freq_feedback *ret=malloc(sizeof(*ret));
@@ -145,14 +147,6 @@
   for(i=0;i<input_ch;i++)
     f->out.data[i]=malloc(input_size*sizeof(**f->out.data));
 
-  /* fill out the frequencies we potentially offer */
-  /* yes this gets repeated.  it's pre-threading, not a big deal */
-  for(i=0;i<freqs;i++)
-    frequencies[i]=fromOC(i*.25-1.);
-  frequencies[freqs-1]=22000.;
-  frequencies[freqs]=1e20;
-
-
   /* unlike old postfish, we offer all frequencies via smoothly
      supersampling the spectrum */
   /* I'm too lazy to figure out the integral symbolically, use this
@@ -160,10 +154,10 @@
   
   f->ho_window=malloc(freqs*sizeof(*f->ho_window));
   {
-    double lastf=0.;
     double *working=alloca((blocksize+1)*sizeof(*working));
 
     for(i=0;i<freqs;i++){
+      double lastf=(i>0?frequencies[i-1]:0);
       double thisf=frequencies[i];
       double nextf=frequencies[i+1];
 
@@ -237,40 +231,46 @@
   return freq_labels[n];
 }
 
-static void transform_work(double *work,freq_state *f,double *peak,double *rms){
+static void transform_work(double *work,freq_state *f){
   double *workoff=work+f->blocksize/2;
   int i,j,k;
   
   /* window the time data */
-  memset(work,0,sizeof(*work)*f->blocksize);
+  memset(work,0,sizeof(*work)*f->blocksize/2);
   memset(work+f->blocksize*3/2,0,sizeof(*work)*f->blocksize/2);
   for(i=0;i<f->blocksize;i++)workoff[i]*=f->window[i];
   
   /* transform the time data */
   drft_forward(&f->fft,work);
-  for(i=0;i<f->blocksize;i++)workoff[i]*=(1./f->blocksize);
+  for(i=0;i<f->blocksize*2;i++)work[i]*=(.5/f->blocksize);
+}
+
+
+void freq_metric_work(double *work,freq_state *f,
+		      double *sq_mags,double *peak,double *rms){
+  int i,j,k;
 
   /* fill in metrics */
   memset(peak,0,sizeof(*peak)*freqs);
   memset(rms,0,sizeof(*rms)*freqs);
-  {
-    double sq_mags[f->blocksize+1];
-    sq_mags[0]=work[0]*work[0];
-    sq_mags[f->blocksize]=work[f->blocksize*2-1]*work[f->blocksize*2-1];
-    for(i=1;i<f->blocksize;i++)
-      sq_mags[i]=work[i*2]*work[i*2]+work[i*2-1]*work[i*2-1];
+  sq_mags[0]=work[0]*work[0]*44.4444444;
+  sq_mags[f->blocksize]=
+    work[f->blocksize*2-1]*work[f->blocksize*2-1]*44.44444444;
+  for(i=1;i<f->blocksize;i++)
+    sq_mags[i]=(work[i*2]*work[i*2]+work[i*2-1]*work[i*2-1])*44.444444;
+  
+  for(i=0;i<freqs;i++){
+    double *ho_window=f->ho_window[i];
+    for(k=0,j=f->ho_bin_lo[i];j<f->ho_bin_hi[i];j++,k++){
+      double val=sq_mags[j]*ho_window[k];
 
-    for(i=0;i<freqs;i++){
-      double *ho_window=f->ho_window[i];
-      for(k=0,j=f->ho_bin_lo[i];j<f->ho_bin_hi[i];j++,k++){
-	double val=sq_mags[j]*ho_window[k];
-	rms[i]+=val;
-	if(val>peak[i])peak[i]=val;
-      }
-      rms[i]=sqrt(rms[i]*f->ho_area[i]);
-      peak[i]=sqrt(peak[i]);
+      rms[i]+=val;
+      if(val>peak[i])peak[i]=val;
     }
+    rms[i]=sqrt(rms[i]*f->ho_area[i]);
+    peak[i]=sqrt(peak[i]);
   }
+
 }
 
 static void feedback_work(double *peak,double *rms,
@@ -314,21 +314,26 @@
 
   int blocks=0;
 
-  memset(peak,0,sizeof(peak));
-  memset(rms,0,sizeof(rms));
+  memset(feedback_peak,0,sizeof(feedback_peak));
+  memset(feedback_rms,0,sizeof(feedback_rms));
 
   {
     double work[f->blocksize*2];
     
     switch(f->fillstate){
     case 0: /* prime the lapping and cache */
+      if(in->samples==0){
+	f->out.samples=0;
+	return &f->out;
+      }
+
       for(i=0;i<input_ch;i++){
         double *temp=in->data[i];
 
         memset(work+f->blocksize/2,0,sizeof(*work)*f->blocksize/2);
         memcpy(work+f->blocksize,temp,sizeof(*work)*f->blocksize/2);
 
-	transform_work(work,f,peak,rms);
+	transform_work(work,f);
         func(work,f,peak,rms);
         feedback_work(peak,rms,feedback_peak[i],feedback_rms[i]);
         lap_work(work,f->lap[i],0,f);
@@ -357,7 +362,7 @@
           memcpy(work+f->blocksize/2,temp+j,sizeof(*work)*f->blocksize);
           memset(work+f->blocksize*3/2,0,sizeof(*work)*f->blocksize/2);
 
-	  transform_work(work,f,&peak[i],&rms[i]);
+	  transform_work(work,f);
           func(work,f,peak,rms);
           feedback_work(peak,rms,feedback_peak[i],feedback_rms[i]);
           lap_work(work,f->lap[i],f->out.data[i]+j,f);
@@ -369,7 +374,7 @@
         memcpy(work+f->blocksize,in->data[i],sizeof(*work)*f->blocksize/2);
         memset(work+f->blocksize*3/2,0,sizeof(*work)*f->blocksize/2);
         
-	transform_work(work,f,&peak[i],&rms[i]);
+	transform_work(work,f);
         func(work,f,peak,rms);
         feedback_work(peak,rms,feedback_peak[i],feedback_rms[i]);
         lap_work(work,f->lap[i],f->out.data[i]+j,f);
@@ -396,9 +401,10 @@
       (freq_feedback *)feedback_new(&f->feedpool,new_freq_feedback);
 
     for(i=0;i<input_ch;i++)
-      for(j=0;j<freqs;j++)
-	feedback_rms[i][j]=sqrt(feedback_rms[i][j]*scale);
-
+      for(j=0;j<freqs;j++){
+	feedback_rms[i][j]=todB(sqrt(feedback_rms[i][j]*scale));
+	feedback_peak[i][j]=todB(feedback_peak[i][j]);
+      }
       
     for(i=0;i<input_ch;i++){
       memcpy(ff->peak[i],feedback_peak[i],freqs*sizeof(**feedback_peak));

<p><p>1.2       +4 -1      postfish/freq.h

Index: freq.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/freq.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- freq.h	17 Feb 2004 11:52:17 -0000	1.1
+++ freq.h	19 Feb 2004 00:49:37 -0000	1.2
@@ -24,7 +24,7 @@
 #include "postfish.h"
 #include "smallft.h"
 
-#define freqs 39
+#define freqs 30
 
 typedef struct {
   drft_lookup fft;
@@ -53,3 +53,6 @@
 extern time_linkage *freq_read(time_linkage *in, freq_state *f,
                                void (*func)(double *data,freq_state *f,
                                             double *peak, double *rms));
+
+extern void freq_metric_work(double *work,freq_state *f,
+			    double *sq_mags,double *peak,double *rms);

<p><p>1.30      +22 -21    postfish/mainpanel.c

Index: mainpanel.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/mainpanel.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- mainpanel.c	17 Feb 2004 11:52:17 -0000	1.29
+++ mainpanel.c	19 Feb 2004 00:49:37 -0000	1.30
@@ -261,7 +261,7 @@
 static void masterdB_change(GtkWidget *dummy, gpointer in){
   postfish_mainpanel *p=in;
   char buf[80];
-  gdouble val=gtk_range_get_value(GTK_RANGE(p->masterdB_s));
+  gdouble val=multibar_get_value(MULTIBAR(p->masterdB_s),0);
   sprintf(buf,"%.1f dB",val);
   readout_set(READOUT(p->masterdB_r),buf);
 
@@ -398,20 +398,20 @@
     gtk_widget_activate(p->masterdB_a);
     break;
   case GDK_minus:
-    gtk_range_set_value(GTK_RANGE(p->masterdB_s),
-			gtk_range_get_value(GTK_RANGE(p->masterdB_s))-.1);
+    multibar_thumb_set(MULTIBAR(p->masterdB_s),
+		       multibar_get_value(MULTIBAR(p->masterdB_s),0)-.1,0);
     break;
   case GDK_underscore:
-    gtk_range_set_value(GTK_RANGE(p->masterdB_s),
-			gtk_range_get_value(GTK_RANGE(p->masterdB_s))-1.);
+    multibar_thumb_set(MULTIBAR(p->masterdB_s),
+		       multibar_get_value(MULTIBAR(p->masterdB_s),0)-1.,0);
     break;
   case GDK_equal:
-    gtk_range_set_value(GTK_RANGE(p->masterdB_s),
-			gtk_range_get_value(GTK_RANGE(p->masterdB_s))+.1);
+    multibar_thumb_set(MULTIBAR(p->masterdB_s),
+		       multibar_get_value(MULTIBAR(p->masterdB_s),0)+.1,0);
     break;
   case GDK_plus:
-    gtk_range_set_value(GTK_RANGE(p->masterdB_s),
-			gtk_range_get_value(GTK_RANGE(p->masterdB_s))+1.);
+    multibar_thumb_set(MULTIBAR(p->masterdB_s),
+		       multibar_get_value(MULTIBAR(p->masterdB_s),0)+1.,0);
     break;
   case GDK_d:
     gtk_widget_activate(p->buttonactive[0]);
@@ -647,38 +647,39 @@
     gtk_table_attach(GTK_TABLE(ttable),show,0,1,0,1,GTK_FILL|GTK_SHRINK,GTK_FILL|GTK_SHRINK,0,0);
     gtk_table_attach(GTK_TABLE(ttable),in,0,1,1,2,GTK_FILL|GTK_SHRINK,GTK_FILL|GTK_SHRINK,0,0);
     gtk_table_attach(GTK_TABLE(ttable),out,0,1,2,3,GTK_FILL|GTK_SHRINK,GTK_FILL|GTK_SHRINK,0,0);
-    gtk_table_attach_defaults(GTK_TABLE(ttable),panel->inbar,1,3,1,2);
-    gtk_table_attach_defaults(GTK_TABLE(ttable),panel->outbar,1,3,2,3);
+    gtk_table_attach(GTK_TABLE(ttable),panel->inbar,1,3,1,2,GTK_EXPAND|GTK_FILL,GTK_EXPAND|GTK_FILL,0,0);
+    gtk_table_attach(GTK_TABLE(ttable),panel->outbar,1,3,2,3,GTK_EXPAND|GTK_FILL,GTK_EXPAND|GTK_FILL,0,0);
 
+    gtk_table_set_row_spacing(GTK_TABLE(ttable),1,1);
+    gtk_table_set_row_spacing(GTK_TABLE(ttable),2,2);
 
     /* master dB slider */
     {
+      char *sliderlabels[10]={"-40","-30","-20","-10","0","+10","+20","+30","+40","+50"};
+      double sliderlevels[11]={-50,-40,-30,-20,-10,0,10,20,30,40,50};
+      
       GtkWidget *box=gtk_hbox_new(0,0);
 
       GtkWidget *masterlabel=gtk_label_new("master:");
       panel->masterdB_a=gtk_toggle_button_new_with_label("[m] active");
       panel->masterdB_r=readout_new("  0.0 dB");
-      panel->masterdB_s=gtk_hscale_new_with_range(-50,50,.1);
+      panel->masterdB_s=multibar_slider_new(10,sliderlabels,sliderlevels,1);
+      
+      multibar_thumb_set(MULTIBAR(panel->masterdB_s),0.,0);
 
       gtk_misc_set_alignment(GTK_MISC(masterlabel),1,.5);
-
-      gtk_range_set_value(GTK_RANGE(panel->masterdB_s),0);
-      gtk_scale_set_draw_value(GTK_SCALE(panel->masterdB_s),FALSE);
     
       gtk_table_attach(GTK_TABLE(ttable),masterlabel,0,1,3,4,
                        GTK_FILL,GTK_FILL,0,0);
       
       gtk_box_pack_start(GTK_BOX(box),panel->masterdB_a,0,0,2);
-      gtk_box_pack_start(GTK_BOX(box),panel->masterdB_r,0,0,0);
       gtk_box_pack_start(GTK_BOX(box),panel->masterdB_s,1,1,0);
+      gtk_box_pack_start(GTK_BOX(box),panel->masterdB_r,0,0,0);
       
       gtk_table_attach_defaults(GTK_TABLE(ttable),box,1,3,3,4);
 
-      g_signal_connect (G_OBJECT (panel->masterdB_s), "key-press-event",
-			G_CALLBACK (slider_keymodify), NULL);
-
-      g_signal_connect_after (G_OBJECT(panel->masterdB_s), "value-changed",
-			G_CALLBACK(masterdB_change), (gpointer)panel);
+      multibar_callback(MULTIBAR(panel->masterdB_s),
+			masterdB_change,(gpointer)panel);
 
       g_signal_connect_after (G_OBJECT(panel->masterdB_a), "clicked",
                         G_CALLBACK(masterdB_change), (gpointer)panel);

<p><p>1.19      +299 -267  postfish/multibar.c

Index: multibar.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/multibar.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- multibar.c	17 Feb 2004 11:52:17 -0000	1.18
+++ multibar.c	19 Feb 2004 00:49:37 -0000	1.19
@@ -30,9 +30,10 @@
 static GdkBitmap *stipple=NULL;
 static GdkBitmap *stippleB=NULL;
 
-static double compute_dampening(double target,double current,double delta,int zerodamp){
+static double compute_dampening(double width, double target,double current,double delta,int zerodamp){
   double raw_delta=target-current;
-  
+  double testdelta=delta+(raw_delta*.2);
+
   if(target<0 && !zerodamp){
     if(current>0)
       raw_delta=target-current;
@@ -42,13 +43,13 @@
     if(delta>0){
       raw_delta=0.;
     }else{
-      if(raw_delta<delta-1)raw_delta=delta-1;
+      if(raw_delta<testdelta)raw_delta=testdelta;
     }
   }else{
     if(delta<0){
       raw_delta=0.;
     }else{
-      if(raw_delta>delta+1)raw_delta=delta+1;
+      if(raw_delta>testdelta)raw_delta=testdelta;
     }
   }
   return raw_delta;
@@ -61,6 +62,7 @@
   Multibar *m=MULTIBAR(widget);
   double max=-400;
   int height=widget->allocation.height;
+  int width=widget->allocation.width;
 
   /* figure out the x padding */
   if(m->thumbs<1){
@@ -73,113 +75,115 @@
   }
   m->xpad=xpad;
 
-  if(n>m->bars){
-    if(!m->bartrackers)
-      m->bartrackers=calloc(n,sizeof(*m->bartrackers));
+  if(m->readout){
+    if(n>m->bars){
+      if(!m->bartrackers)
+	m->bartrackers=calloc(n,sizeof(*m->bartrackers));
+      else{
+	m->bartrackers=realloc(m->bartrackers,
+			       n*sizeof(*m->bartrackers));
+	memset(m->bartrackers+m->bars,0,
+	       sizeof(*m->bartrackers)*(n-m->bars));
+      }
+      
+      for(i=m->bars;i<n;i++){
+	m->bartrackers[i].pixelposlo=-400;
+	m->bartrackers[i].pixelposhi=-400;
+	m->bartrackers[i].pixeldeltalo=0;
+	m->bartrackers[i].pixeldeltahi=0;
+      }
+      
+      m->bars=n;
+    }else if(n<m->bars)
+      m->bars=n;
+    
+    for(i=0;i<n;i++)
+      if(highvals[i]>max)max=highvals[i];
+    
+    if(m->clipdelay>0)
+      m->clipdelay--;
+    else
+      m->clipdelay=0;
+    
+    if(m->peakdelay>0)
+      m->peakdelay--;
     else{
-      m->bartrackers=realloc(m->bartrackers,
-			     n*sizeof(*m->bartrackers));
-      memset(m->bartrackers+m->bars,0,
-	     sizeof(*m->bartrackers)*(n-m->bars));
+      m->peakdelay=0;
+      m->peakdelta--;
+      m->peak+=m->peakdelta;
     }
     
-    for(i=m->bars;i<n;i++){
-      m->bartrackers[i].pixelposlo=-400;
-      m->bartrackers[i].pixelposhi=-400;
-      m->bartrackers[i].pixeldeltalo=0;
-      m->bartrackers[i].pixeldeltahi=0;
+    if(max>m->peak){
+      m->peak=max;
+      m->peakdelay=15*2; /* ~2 second hold */
+      m->peakdelta=0;
     }
     
-    m->bars=n;
-  }else if(n<m->bars)
-    m->bars=n;
-  
-   for(i=0;i<n;i++)
-    if(highvals[i]>max)max=highvals[i];
-
-  if(m->clipdelay>0)
-    m->clipdelay--;
-  else
-    m->clipdelay=0;
-
-  if(m->peakdelay>0)
-    m->peakdelay--;
-  else{
-    m->peakdelay=0;
-    m->peakdelta--;
-    m->peak+=m->peakdelta;
-  }
-
-  if(max>m->peak){
-    m->peak=max;
-    m->peakdelay=15*2; /* ~2 second hold */
-    m->peakdelta=0;
-  }
-
-  {
-    int *pixhi=alloca(n*sizeof(*pixhi));
-    int *pixlo=alloca(n*sizeof(*pixlo));
-    
-    for(i=0;i<n;i++){
-      pixlo[i]=-1;
-      for(j=0;j<=m->labels;j++)
-	if(lowvals[i]>=m->levels[j]){
-	  if(lowvals[i]<=m->levels[j+1]){
-	    double del=(lowvals[i]-m->levels[j])/(m->levels[j+1]-m->levels[j]);
-	    pixlo[i]=(j+del)/m->labels*(widget->allocation.width-xpad*2)-xpad;
+    {
+      int *pixhi=alloca(n*sizeof(*pixhi));
+      int *pixlo=alloca(n*sizeof(*pixlo));
+      
+      for(i=0;i<n;i++){
+	pixlo[i]=-1;
+	for(j=0;j<=m->labels;j++)
+	  if(lowvals[i]>=m->levels[j]){
+	    if(lowvals[i]<=m->levels[j+1]){
+	      double del=(lowvals[i]-m->levels[j])/(m->levels[j+1]-m->levels[j]);
+	      pixlo[i]=(j+del)/m->labels*(widget->allocation.width-xpad*2)-xpad;
+	      break;
+	    }else if(j==m->labels){
+	      pixlo[i]=widget->allocation.width-xpad+1;
+	    }
+	  }else
             break;
-	  }else if(j==m->labels){
-	    pixlo[i]=widget->allocation.width-xpad+1;
-	  }
-	}else
-	  break;
-
-      pixhi[i]=pixlo[i];
-      for(;j<=m->labels;j++)
-	if(highvals[i]>=m->levels[j]){
-	  if(highvals[i]<=m->levels[j+1]){
-	    double del=(highvals[i]-m->levels[j])/(m->levels[j+1]-m->levels[j]);
-	    pixhi[i]=(j+del)/m->labels*(widget->allocation.width-xpad*2)+xpad;
+	
+	pixhi[i]=pixlo[i];
+	for(;j<=m->labels;j++)
+	  if(highvals[i]>=m->levels[j]){
+	    if(highvals[i]<=m->levels[j+1]){
+	      double del=(highvals[i]-m->levels[j])/(m->levels[j+1]-m->levels[j]);
+	      pixhi[i]=(j+del)/m->labels*(widget->allocation.width-xpad*2)+xpad;
+	      break;
+	    }else if(j==m->labels){
+	      pixhi[i]=widget->allocation.width-xpad+1;
+	    }
+	  }else
             break;
-	  }else if(j==m->labels){
-	    pixhi[i]=widget->allocation.width-xpad+1;
-	  }
-	}else
-	  break;
-
-    }
-
-    /* dampen movement according to setup */
-
-    for(i=0;i<n;i++){
-      double trackhi=m->bartrackers[i].pixelposhi;
-      double tracklo=m->bartrackers[i].pixelposlo;
-      double delhi=m->bartrackers[i].pixeldeltahi;
-      double dello=m->bartrackers[i].pixeldeltalo;
-
-      /* hi */
-      delhi = compute_dampening(pixhi[i],trackhi,delhi,m->dampen_flags & ZERO_DAMP);
-
-      if(pixhi[i]>trackhi){
-	if(m->dampen_flags & HI_ATTACK)pixhi[i]=trackhi+delhi;
-      }else{
-	if(m->dampen_flags & HI_DECAY)pixhi[i]=trackhi+delhi;
-      }
-      m->bartrackers[i].pixelposhi=pixhi[i];
-      m->bartrackers[i].pixeldeltahi=delhi;
-
-      /* lo */
-      dello = compute_dampening(pixlo[i],tracklo,dello,m->dampen_flags & ZERO_DAMP);
-      if(pixlo[i]>tracklo){
-	if(m->dampen_flags & LO_ATTACK)pixlo[i]=tracklo+dello;
-      }else{
-	if(m->dampen_flags & LO_DECAY)pixlo[i]=tracklo+dello;
+	
       }
-      m->bartrackers[i].pixelposlo=pixlo[i];
-      m->bartrackers[i].pixeldeltalo=dello;
-
+      
+      /* dampen movement according to setup */
+      
+      for(i=0;i<n;i++){
+	double trackhi=m->bartrackers[i].pixelposhi;
+	double tracklo=m->bartrackers[i].pixelposlo;
+	double delhi=m->bartrackers[i].pixeldeltahi;
+	double dello=m->bartrackers[i].pixeldeltalo;
+	
+	/* hi */
+	delhi = compute_dampening(width-xpad*2,pixhi[i],trackhi,delhi,m->dampen_flags & ZERO_DAMP);
+	
+	if(pixhi[i]>trackhi){
+	  if(m->dampen_flags & HI_ATTACK)pixhi[i]=trackhi+delhi;
+	}else{
+	  if(m->dampen_flags & HI_DECAY)pixhi[i]=trackhi+delhi;
+	}
+	m->bartrackers[i].pixelposhi=pixhi[i];
+	m->bartrackers[i].pixeldeltahi=delhi;
+	
+	/* lo */
+	dello = compute_dampening(width-xpad*2,pixlo[i],tracklo,dello,m->dampen_flags & ZERO_DAMP);
+	if(pixlo[i]>tracklo){
+	  if(m->dampen_flags & LO_ATTACK)pixlo[i]=tracklo+dello;
+	}else{
+	  if(m->dampen_flags & LO_DECAY)pixlo[i]=tracklo+dello;
+	}
+	m->bartrackers[i].pixelposlo=pixlo[i];
+	m->bartrackers[i].pixeldeltalo=dello;
+	
+      }
+      
     }
-
   }
 }
 
@@ -188,6 +192,7 @@
   Multibar *m=MULTIBAR(widget);
   int xpad=m->xpad,upad=2,lpad=2;
   int height=widget->allocation.height;
+  GtkWidget *parent=gtk_widget_get_parent(widget);
 
   if(m->thumbs>0){
     int leftover=height-widget->requisition.height;
@@ -201,172 +206,183 @@
     m->boxcolor=gdk_gc_new(m->backing);
     gdk_gc_copy(m->boxcolor,widget->style->black_gc);
   }
-
-  /* draw the pixel positions */
-  while(x<widget->allocation.width){
-    int r=0xffff,g=0xffff,b=0xffff;
-    GdkColor rgb={0,0,0,0};
-    int next=widget->allocation.width;
-    for(i=0;i<n;i++){
-      if(m->bartrackers[i].pixelposlo>x && m->bartrackers[i].pixelposlo<next)
-	next=m->bartrackers[i].pixelposlo;
-      if(m->bartrackers[i].pixelposhi>x && m->bartrackers[i].pixelposhi<next)
-	next=m->bartrackers[i].pixelposhi;
-    }
+    
+  if(m->readout){
+    /* draw the pixel positions */
+    while(x<widget->allocation.width){
+      int r=0xffff,g=0xffff,b=0xffff;
+      GdkColor rgb={0,0,0,0};
+      int next=widget->allocation.width;
+      for(i=0;i<n;i++){
+	if(m->bartrackers[i].pixelposlo>x && m->bartrackers[i].pixelposlo<next)
+	  next=m->bartrackers[i].pixelposlo;
+	if(m->bartrackers[i].pixelposhi>x && m->bartrackers[i].pixelposhi<next)
+	  next=m->bartrackers[i].pixelposhi;
+      }
       
-    for(i=0;i<n;i++){
-      if(m->bartrackers[i].pixelposlo<=x && m->bartrackers[i].pixelposhi>=next){
-	switch(i%8){
-	case 0:
-	  r*=.65;
-	  g*=.65;
-	  b*=.65;
-	  break;
-	case 1:
-	  r*=1.;
-	  g*=.5;
-	  b*=.5;
-	  break;
-	case 2:
-	  r*=.6;
-	  g*=.6;
-	  b*=1.;
-	  break;
-	case 3:
-	  r*=.4;
-	  g*=.9;
-	  b*=.4;
-	  break;
-	case 4:
-	  r*=.7;
-	  g*=.6;
-	  b*=.3;
-	  break;
-	case 5:
-	  r*=.7;
-	  g*=.4;
-	  b*=.8;
-	  break;
-	case 6:
-	  r*=.3;
-	  g*=.7;
-	  b*=.7;
-	  break;
-	case 7:
-	  r*=.4;
-	  g*=.4;
-	  b*=.4;
-	  break;
+      for(i=0;i<n;i++){
+	if(m->bartrackers[i].pixelposlo<=x && m->bartrackers[i].pixelposhi>=next){
+	  switch(i%8){
+	  case 0:
+	    r*=.65;
+	    g*=.65;
+	    b*=.65;
+	    break;
+	  case 1:
+	    r*=1.;
+	    g*=.5;
+	    b*=.5;
+	    break;
+	  case 2:
+	    r*=.6;
+	    g*=.6;
+	    b*=1.;
+	    break;
+	  case 3:
+	    r*=.4;
+	    g*=.9;
+	    b*=.4;
+	    break;
+	  case 4:
+	    r*=.7;
+	    g*=.6;
+	    b*=.3;
+	    break;
+	  case 5:
+	    r*=.7;
+	    g*=.4;
+	    b*=.8;
+	    break;
+	  case 6:
+	    r*=.3;
+	    g*=.7;
+	    b*=.7;
+	    break;
+	  case 7:
+	    r*=.4;
+	    g*=.4;
+	    b*=.4;
+	    break;
+	  }
         }
       }
+      rgb.red=r;
+      rgb.green=g;
+      rgb.blue=b;
+      gdk_gc_set_rgb_fg_color(m->boxcolor,&rgb);
+      
+      gdk_draw_rectangle(m->backing,m->boxcolor,1,x+1,upad+1,next-x,widget->allocation.height-lpad-upad-3);
+      
+      x=next;
     }
-    rgb.red=r;
-    rgb.green=g;
-    rgb.blue=b;
-    gdk_gc_set_rgb_fg_color(m->boxcolor,&rgb);
-
-    gdk_draw_rectangle(m->backing,m->boxcolor,1,x+1,upad+1,next-x,widget->allocation.height-lpad-upad-3);
-    
-    x=next;
-  }
-
-  gdk_draw_line (m->backing,
-		 widget->style->white_gc,
-		 xpad, widget->allocation.height-lpad-1, 
-		 widget->allocation.width-1-xpad, 
-		 widget->allocation.height-lpad-1);
-
-  if(m->clipdelay){
-    gdk_draw_line (m->backing,
-		   widget->style->fg_gc[1],
-		   xpad, upad, widget->allocation.width-1-xpad, upad);
     
     gdk_draw_line (m->backing,
-		   widget->style->fg_gc[1],
-		   xpad, widget->allocation.height-lpad-2, 
-		   widget->allocation.width-1-xpad, 
-		   widget->allocation.height-lpad-2);
-  }else{
-    gdk_draw_line (m->backing,
                    widget->style->white_gc,
-		   xpad, upad, widget->allocation.width-1-xpad, upad);
-    
-    gdk_draw_line (m->backing,
-		   widget->style->white_gc,
-		   xpad, widget->allocation.height-lpad-2, 
+		   xpad, widget->allocation.height-lpad-1, 
                    widget->allocation.width-1-xpad, 
-		   widget->allocation.height-lpad-2);
-  }
-  
-  /* peak follower */
-  if(m->dampen_flags & PEAK_FOLLOW){
-    int x=-10;
-    for(j=0;j<=m->labels+1;j++)
-      if(m->peak>=m->levels[j]){
-	if(m->peak<=m->levels[j+1]){
-	  double del=(m->peak-m->levels[j])/(m->levels[j+1]-m->levels[j]);
-	  x=(j+del)/m->labels*(widget->allocation.width-xpad*2)+xpad;
-	  break;
-	}else if (j==m->labels){
-	  x=widget->allocation.width-xpad+1;
-	}
-      }else
-	break;
+		   widget->allocation.height-lpad-1);
     
-    for(j=0;j<n;j++)
-      if(x<m->bartrackers[j].pixelposhi)
-	x=m->bartrackers[j].pixelposhi;
+    if(m->clipdelay){
+      gdk_draw_line (m->backing,
+		     widget->style->fg_gc[1],
+		     xpad, upad, widget->allocation.width-1-xpad, upad);
+      
+      gdk_draw_line (m->backing,
+		     widget->style->fg_gc[1],
+		     xpad, widget->allocation.height-lpad-2, 
+		     widget->allocation.width-1-xpad, 
+		     widget->allocation.height-lpad-2);
+    }else{
+      gdk_draw_line (m->backing,
+		     widget->style->white_gc,
+		     xpad, upad, widget->allocation.width-1-xpad, upad);
+      
+      gdk_draw_line (m->backing,
+		     widget->style->white_gc,
+		     xpad, widget->allocation.height-lpad-2, 
+		     widget->allocation.width-1-xpad, 
+		     widget->allocation.height-lpad-2);
+    }
     
-    {
-      int y=widget->allocation.height-lpad-1;
+    /* peak follower */
+    if(m->dampen_flags & PEAK_FOLLOW){
+      int x=-10;
+      for(j=0;j<=m->labels+1;j++)
+	if(m->peak>=m->levels[j]){
+	  if(m->peak<=m->levels[j+1]){
+	    double del=(m->peak-m->levels[j])/(m->levels[j+1]-m->levels[j]);
+	    x=(j+del)/m->labels*(widget->allocation.width-xpad*2)+xpad;
+	    break;
+	  }else if (j==m->labels){
+	    x=widget->allocation.width-xpad+1;
+	  }
+	}else
+	  break;
       
-      gdk_draw_line(m->backing,widget->style->fg_gc[0],
-		    x-3,upad,x+3,upad);
-      gdk_draw_line(m->backing,widget->style->fg_gc[0],
-		    x-2,upad+1,x+2,upad+1);
-      gdk_draw_line(m->backing,widget->style->fg_gc[0],
-		    x-1,upad+2,x+1,upad+2);
-      gdk_draw_line(m->backing,widget->style->fg_gc[0],
-		    x-3,y-1,x+3,y-1);
-      gdk_draw_line(m->backing,widget->style->fg_gc[0],
-		    x-2,y-2,x+2,y-2);
-      gdk_draw_line(m->backing,widget->style->fg_gc[0],
-		    x-1,y-3,x+1,y-3);
+      for(j=0;j<n;j++)
+	if(x<m->bartrackers[j].pixelposhi)
+	  x=m->bartrackers[j].pixelposhi;
       
-      gdk_draw_line(m->backing,widget->style->fg_gc[1],
-		    x,upad+1,x,y-2);
+      {
+	int y=widget->allocation.height-lpad-1;
+	
+	gdk_draw_line(m->backing,widget->style->fg_gc[0],
+		      x-3,upad,x+3,upad);
+	gdk_draw_line(m->backing,widget->style->fg_gc[0],
+		      x-2,upad+1,x+2,upad+1);
+	gdk_draw_line(m->backing,widget->style->fg_gc[0],
+		      x-1,upad+2,x+1,upad+2);
+	gdk_draw_line(m->backing,widget->style->fg_gc[0],
+		      x-3,y-1,x+3,y-1);
+	gdk_draw_line(m->backing,widget->style->fg_gc[0],
+		      x-2,y-2,x+2,y-2);
+	gdk_draw_line(m->backing,widget->style->fg_gc[0],
+		      x-1,y-3,x+1,y-3);
+	
+	gdk_draw_line(m->backing,widget->style->fg_gc[1],
+		      x,upad+1,x,y-2);
+      }
     }
+  }else{
+
+    int width=widget->allocation.width-xpad;
+    int height=widget->allocation.height;
+    GdkGC *gc=parent->style->bg_gc[0];
+
+    /* blank scale to bg of parent */
+    gdk_draw_rectangle(m->backing,gc,1,xpad,0,width-xpad+1,height-lpad);
+
   }
 
-  for(i=0;i<m->labels;i++){
-    int x=rint((i+1.)/m->labels*(widget->allocation.width-xpad*2)+xpad);
+  for(i=0;i<m->labels+1;i++){
+    int x=rint(((double)i)/m->labels*(widget->allocation.width-xpad*2)+xpad);
     int y=widget->allocation.height-lpad-upad;
     int px,py;
     int gc=0;
     
-    if(m->levels[i+1]>=0)gc=1;
+    if(m->levels[i]>=0)gc=1;
     
     gdk_draw_line (m->backing,
                    widget->style->text_gc[gc],
                    x, upad, x, y+upad);
     
-    pango_layout_get_pixel_size(m->layout[i],&px,&py);
-    x-=px+2;
-    y-=py;
-    y/=2;
-
-    gdk_draw_layout (m->backing,
-		     widget->style->text_gc[gc],
-		     x, y+upad,
-		     m->layout[i]);
-
+    if(i>0){
+      pango_layout_get_pixel_size(m->layout[i-1],&px,&py);
+      x-=px+2;
+      y-=py;
+      y/=2;
+      
+      gdk_draw_layout (m->backing,
+		       widget->style->text_gc[gc],
+		       x, y+upad,
+		       m->layout[i-1]);
+    }
   }
 
   /* draw frame */
   {
     int width=widget->allocation.width-xpad;
     int height=widget->allocation.height;
-    GtkWidget *parent=gtk_widget_get_parent(widget);
     GdkGC *gc=parent->style->bg_gc[0];
     GdkGC *light_gc=parent->style->light_gc[0];
     GdkGC *dark_gc=parent->style->dark_gc[0];
@@ -374,54 +390,60 @@
 
     /* blank side padding to bg of parent */
     gdk_draw_rectangle(m->backing,gc,1,0,0,xpad,height);
-    gdk_draw_rectangle(m->backing,gc,1,width,0,xpad,height);
+    gdk_draw_rectangle(m->backing,gc,1,width+1,0,xpad-1,height);
 
 
     /* blank sides of trough */
     gdk_draw_rectangle(m->backing,gc,1,
                        0,height-lpad,
-		       m->thumblo_x+xpad,lpad);
+		       m->thumblo_x+xpad-1,lpad);
     gdk_draw_rectangle(m->backing,gc,1,
                        m->thumbhi_x+xpad,height-lpad,
                        width-m->thumbhi_x,lpad);
     
     /* frame */
-    gdk_draw_line(m->backing,dark_gc,xpad-1,0,width,0);
-    gdk_draw_line(m->backing,dark_gc,xpad-1,0,xpad-1,height-lpad);
-    gdk_draw_line(m->backing,dark_gc,xpad,height-lpad,width,height-lpad);
-    gdk_draw_line(m->backing,dark_gc,width,height-lpad,width,1);
-
-    gdk_draw_line(m->backing,light_gc,xpad-1,height-lpad+1,
-		  width+1,height-lpad+1);
-    gdk_draw_line(m->backing,light_gc,width+1,0,width+1,height-lpad+1);
-    gdk_draw_line(m->backing,light_gc,xpad,1,width-1,1);
-    gdk_draw_line(m->backing,light_gc,xpad,1,xpad,height-lpad-1);
-
+    if(m->readout){
+      gdk_draw_line(m->backing,dark_gc,xpad-1,0,width,0);
+      gdk_draw_line(m->backing,dark_gc,xpad-1,0,xpad-1,height-lpad);
+      gdk_draw_line(m->backing,dark_gc,xpad,height-lpad,width,height-lpad);
+      gdk_draw_line(m->backing,dark_gc,width,height-lpad,width,1);
+      
+      gdk_draw_line(m->backing,light_gc,xpad-1,height-lpad+1,
+		    width+1,height-lpad+1);
+      gdk_draw_line(m->backing,light_gc,width+1,0,width+1,height-lpad+1);
+      gdk_draw_line(m->backing,light_gc,xpad,1,width-1,1);
+      gdk_draw_line(m->backing,light_gc,xpad,1,xpad,height-lpad-1);
+    }
 
 
     /* dark trough */
-    if(lpad>2){
-      gdk_draw_rectangle(m->backing,mid_gc,1,
-			 xpad+m->thumblo_x,height-lpad+1,
-			 m->thumbhi_x-m->thumblo_x+1,lpad-1);
-
-      gdk_draw_line(m->backing,dark_gc,
-		    m->thumblo_x+xpad-1,height-lpad+1,
-		    m->thumblo_x+xpad-1,height-1);
+    if(lpad>2 || m->readout==0){
+      if(lpad>2){
+	gdk_draw_rectangle(m->backing,mid_gc,1,
+			   xpad+m->thumblo_x,height-lpad+1,
+			   m->thumbhi_x-m->thumblo_x+1,lpad-1);
+	
+	gdk_draw_line(m->backing,dark_gc,
+		      m->thumblo_x+xpad-1,height-lpad,
+		      m->thumblo_x+xpad-1,height-1);
+	
+      }
 
       gdk_draw_line(m->backing,light_gc,
                     m->thumblo_x+xpad-1,height-1,
                     m->thumbhi_x+xpad+1,height-1);
 
-      gdk_draw_line(m->backing,light_gc,
-		    m->thumbhi_x+xpad+1,height-1,
-		    m->thumbhi_x+xpad+1,height-lpad+1);
-
       dark_gc=widget->style->dark_gc[GTK_STATE_ACTIVE];
+
       gdk_draw_line(m->backing,dark_gc,
-		    m->thumblo_x+xpad,height-lpad,
-		    m->thumbhi_x+xpad,height-lpad);
+		    m->thumblo_x+xpad-1,height-lpad,
+		    m->thumbhi_x+xpad+1,height-lpad);
       
+      if(lpad>2)
+	gdk_draw_line(m->backing,light_gc,
+		      m->thumbhi_x+xpad+1,height-1,
+		      m->thumbhi_x+xpad+1,height-lpad);
+
 
     }
 
@@ -1058,6 +1080,18 @@
                           GDK_FOCUS_CHANGE_MASK  );
   }
 
+  m->readout=1;
+  return ret;
+}
+
+GtkWidget* multibar_slider_new (int n, char **labels, double *levels, 
+				int thumbs){
+  int i;
+  GtkWidget *ret= multibar_new(n,labels,levels,thumbs,0);
+  Multibar *m=MULTIBAR(ret);
+  m->readout=0;
+  gtk_widget_set_name(ret,"Multislide");
+
   return ret;
 }
 
@@ -1165,5 +1199,3 @@
   draw_and_expose(w);
 }
 
-
-

<p><p>1.11      +4 -0      postfish/multibar.h

Index: multibar.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/multibar.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- multibar.h	17 Feb 2004 11:52:18 -0000	1.10
+++ multibar.h	19 Feb 2004 00:49:37 -0000	1.11
@@ -64,6 +64,7 @@
   GdkPixmap *backing;
 
   int labels;
+  int readout;
   PangoLayout **layout;
   double       *levels;
 
@@ -107,6 +108,9 @@
 GType          multibar_get_type        (void);
 GtkWidget*     multibar_new             (int n, char **labels, double *levels,
                                          int thumbs, int flags);
+GtkWidget*     multibar_slider_new (int n, char **labels, double *levels, 
+				    int thumbs);
+
 void	       multibar_clear           (Multibar *m);
 void	       multibar_set             (Multibar *m,double *lo,double *hi, int n);
 void	       multibar_thumb_set       (Multibar *m,double v, int n);

<p><p>1.13      +18 -1     postfish/output.c

Index: output.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/output.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- output.c	13 Feb 2004 18:11:35 -0000	1.12
+++ output.c	19 Feb 2004 00:49:37 -0000	1.13
@@ -29,7 +29,9 @@
 #include "input.h"
 #include "output.h"
 #include "declip.h"
+#include "eq.h"
 
+extern int input_size;
 sig_atomic_t playback_active=0;
 sig_atomic_t playback_exit=0;
 sig_atomic_t playback_seeking=0;
@@ -51,6 +53,7 @@
 
   input_reset();  /* clear any persistent lapping state */
   declip_reset();  /* clear any persistent lapping state */
+  eq_reset();      /* clear any persistent lapping state */
   output_reset(); /* clear any persistent lapping state */
 }
 
@@ -124,6 +127,16 @@
   return 0;
 }
 
+static int ilog(long x){
+  int ret=-1;
+
+  while(x>0){
+    x>>=1;
+    ret++;
+  }
+  return ret;
+}
+
 static int outbytes;
 static FILE *playback_startup(int outfileno, int ch, int r, int *bep){
   FILE *playback_fd=NULL;
@@ -142,9 +155,11 @@
 
   /* is this file a block device? */
   if(isachr(playback_fd)){
-    int fragment=0x0004000d;
+    long bytesperframe=input_size*ch*2;
     int fd=fileno(playback_fd);
     int format=AFMT_S16_NE;
+    int fraglog=ilog(bytesperframe);
+    int fragment=0x00040000|fraglog;
     outbytes=2;
 
     /* try to lower the DSP delay; this ioctl may fail gracefully */
@@ -209,6 +224,8 @@
     result=link->samples;
     link=declip_read(link);
     result|=link->samples;
+    link=eq_read(link);
+    result|=link->samples;
     
     if(!result)break;
     /************/

<p><p>1.7       +21 -5     postfish/postfish-gtkrc

Index: postfish-gtkrc
===================================================================
RCS file: /usr/local/cvsroot/postfish/postfish-gtkrc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- postfish-gtkrc	17 Feb 2004 12:09:02 -0000	1.6
+++ postfish-gtkrc	19 Feb 2004 00:49:37 -0000	1.7
@@ -19,6 +19,10 @@
         font_name = "sans 9"
 }
 
+style "small-marker" {
+	font_name = "sans 8"
+}
+
 style "frame-label" {
         font_name = "sans bold 10"
 }
@@ -58,6 +62,20 @@
         font_name = "sans 6"    
 }
 
+style "multislide" {
+        bg[NORMAL]="#80a0ff" 
+        bg[ACTIVE]="#b0b0b0" 
+        bg[PRELIGHT]="#c0f0ff" 
+
+        fg[NORMAL]="#000000" 
+        fg[ACTIVE]="#ff8080" 
+        fg[PRELIGHT]="#f0f080" 
+
+        text[NORMAL]="#707070" 
+        text[ACTIVE]="#905050" 
+        font_name = "sans 6"    
+}
+
 style "clipbar" {
         fg[NORMAL]="#404040" 
         fg[ACTIVE]="#ff8080" 
@@ -72,7 +90,7 @@
         bg[NORMAL]="#ffffff" 
         bg[ACTIVE]="#ffffff" 
 
-	font_name = "Nimbus Mono L, Courier, Monospace 9"	
+	font_name = "Fixed, Nimbus Mono L, Courier, Monospace 10"	
 }
 
 style "darkpanel" {
@@ -120,6 +138,7 @@
 }
 
 widget "*.GtkLabel" style "panel-text"
+widget "*.smallmarker" style "small-marker"
 
 widget "*.color0" style "left"
 widget "*.color1" style "right"
@@ -146,10 +165,7 @@
 widget "*.panelbutton*" style "button-poppy"
 widget "*.panelbutton*.GtkLabel" style "panel-label"
 widget "*.Multibar*" style "multibar"
+widget "*.Multislide*" style "multislide"
 
 widget "*.clipbar*" style "clipbar"
 
-
-
-
-

<p><p>1.32      +2 -2      postfish/version.h

Index: version.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/version.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- version.h	17 Feb 2004 12:09:03 -0000	1.31
+++ version.h	19 Feb 2004 00:49:37 -0000	1.32
@@ -1,2 +1,2 @@
-#define VERSION "$Id: version.h,v 1.31 2004/02/17 12:09:03 xiphmont Exp $ "
-/* DO NOT EDIT: Automated versioning hack [Tue Feb 17 07:07:58 EST 2004] */
+#define VERSION "$Id: version.h,v 1.32 2004/02/19 00:49:37 xiphmont Exp $ "
+/* DO NOT EDIT: Automated versioning hack [Wed Feb 18 19:47:18 EST 2004] */

<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