[xiph-commits] r7875 - trunk/postfish

xiphmont at motherfish-iii.xiph.org xiphmont at motherfish-iii.xiph.org
Fri Sep 24 21:30:46 PDT 2004


Author: xiphmont
Date: 2004-09-24 21:30:46 -0700 (Fri, 24 Sep 2004)
New Revision: 7875

Added:
   trunk/postfish/deverb.c
   trunk/postfish/deverb.h
   trunk/postfish/deverbpanel.c
   trunk/postfish/deverbpanel.h
   trunk/postfish/window.c
   trunk/postfish/window.h
Removed:
   trunk/postfish/suppress.c
   trunk/postfish/suppress.h
   trunk/postfish/suppresspanel.c
   trunk/postfish/suppresspanel.h
Modified:
   trunk/postfish/Makefile
   trunk/postfish/main.c
   trunk/postfish/mainpanel.c
   trunk/postfish/mainpanel.h
   trunk/postfish/mute.c
   trunk/postfish/output.c
   trunk/postfish/postfish.h
   trunk/postfish/version.h
Log:
Begin adding common window function storage

Finish the job begun long ago of renaming the 'Reverberation
Suppressor' to 'Deverber' (a much better name I'm sure you all agree).

Begin work on proper centralized mute handling



Modified: trunk/postfish/Makefile
===================================================================
--- trunk/postfish/Makefile	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/Makefile	2004-09-25 04:30:46 UTC (rev 7875)
@@ -10,7 +10,7 @@
 
 # use the below for x86 and most other platforms where 'float' is 32 bit IEEE754
 
-#ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 
+ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 -march=athlon-mp
 
 # use the below for anything without IEE754 floats (eg, VAX)
 
@@ -28,15 +28,15 @@
 SRC = main.c mainpanel.c multibar.c readout.c input.c output.c clippanel.c \
 	declip.c reconstruct.c multicompand.c windowbutton.c subpanel.c \
 	feedback.c freq.c eq.c eqpanel.c compandpanel.c subband.c lpc.c \
-	bessel.c suppresspanel.c suppress.c singlecomp.c singlepanel.c \
+	bessel.c deverbpanel.c deverb.c singlecomp.c singlepanel.c \
 	limit.c limitpanel.c mute.c mixpanel.c mix.c reverb.c reverbpanel.c \
-	outpanel.c config.c
+	outpanel.c config.c window.c
 OBJ = main.o mainpanel.o multibar.o readout.o input.o output.o clippanel.o \
 	declip.o reconstruct.o multicompand.o windowbutton.o subpanel.o \
 	feedback.o freq.o eq.o eqpanel.o compandpanel.o subband.o lpc.o \
-	bessel.o suppresspanel.o suppress.o singlecomp.o singlepanel.o \
+	bessel.o deverbpanel.o deverb.o singlecomp.o singlepanel.o \
 	limit.o limitpanel.o mute.o mixpanel.o mix.o reverb.o reverbpanel.o \
-	outpanel.o config.o
+	outpanel.o config.o window.o
 GCF = -DETCDIR=\\\"$(ETCDIR)\\\" `pkg-config --cflags gtk+-2.0` -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
 
 all:	
@@ -76,7 +76,7 @@
 
 target:  $(OBJ) postfish-wisdomrc
 	./touch-version
-	$(LD) $(OBJ) $(CFLAGS) -o postfish $(LIBS) `pkg-config --libs gtk+-2.0` -lpthread -lfftw3f -lm
+	$(LD) $(OBJ) $(CFLAGS) -o postfish $(LIBS) `pkg-config --libs gtk+-2.0` -lpthread -lfftw3f -lm #/home/xiphmont/electric-fence-2.1.4/libefence.a 
 
 install: target
 	$(INSTALL) -d -m 0755 $(BINDIR)

Copied: trunk/postfish/deverb.c (from rev 7874, trunk/postfish/suppress.c)
===================================================================
--- trunk/postfish/suppress.c	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/deverb.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -0,0 +1,269 @@
+/*
+ *
+ *  postfish
+ *    
+ *      Copyright (C) 2002-2004 Monty and Xiph.Org
+ *
+ *  Postfish is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *   
+ *  Postfish is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *   
+ *  You should have received a copy of the GNU General Public License
+ *  along with Postfish; see the file COPYING.  If not, write to the
+ *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * 
+ */
+
+#include "postfish.h"
+#include "feedback.h"
+#include <fftw3.h>
+#include "subband.h"
+#include "bessel.h"
+#include "deverb.h"
+
+/* (since this one is kinda unique) The Deverberation Filter....
+   
+   Reverberation in a measurably live environment displays
+   log amplitude decay with time (linear decay when plotted on a dB
+   scale).
+   
+   In its simplest form, the deverber follows actual RMS amplitude
+   attacks but chooses a slower-than-actual decay, then expands
+   according to the dB distance between the slow and actual decay.
+   
+   Thus, the deverber can be used to 'dry out' a very 'wet'
+   reverberative track. */
+    
+extern int input_size;
+extern int input_rate;
+extern int input_ch;
+
+typedef struct {
+  subband_state ss;
+  
+  iir_filter smooth;
+  iir_filter release;
+  
+  iir_state *iirS[deverb_freqs];
+  iir_state *iirR[deverb_freqs];
+
+  float prevratio[deverb_freqs];
+
+} deverb_state;
+
+deverb_settings deverb_channel_set;
+static deverb_state channel_state;
+static subband_window sw;
+
+void deverb_reset(){
+  int i,j;
+  
+  subband_reset(&channel_state.ss);
+  
+  for(i=0;i<deverb_freqs;i++){
+    for(j=0;j<input_ch;j++){
+      memset(&channel_state.iirS[i][j],0,sizeof(iir_state));
+      memset(&channel_state.iirR[i][j],0,sizeof(iir_state));
+    }
+  }
+}
+
+static void filter_set(subband_state *ss,
+		       float msec,
+		       iir_filter *filter,
+		       int attackp,
+		       int order){
+  float alpha;
+  float corner_freq= 500./msec;
+  
+  /* make sure the chosen frequency doesn't require a lookahead
+     greater than what's available */
+  if(impulse_freq2(input_size*2-ss->qblocksize*3)*1.01>corner_freq && 
+     attackp)
+    corner_freq=impulse_freq2(input_size*2-ss->qblocksize*3);
+  
+  alpha=corner_freq/input_rate;
+  filter->g=mkbessel(alpha,order,filter->c);
+  filter->alpha=alpha;
+  filter->Hz=alpha*input_rate;
+  filter->ms=msec;
+}
+
+int deverb_load(void){
+  int i;
+  int qblocksize=input_size/16;
+  memset(&channel_state,0,sizeof(channel_state));
+
+  deverb_channel_set.active=calloc(input_ch,sizeof(*deverb_channel_set.active));
+
+  subband_load(&channel_state.ss,deverb_freqs,qblocksize,input_ch);
+  subband_load_freqs(&channel_state.ss,&sw,deverb_freq_list,deverb_freqs);
+   
+  for(i=0;i<deverb_freqs;i++){
+    channel_state.iirS[i]=calloc(input_ch,sizeof(iir_state));
+    channel_state.iirR[i]=calloc(input_ch,sizeof(iir_state));
+  }
+  return 0;
+}
+
+static void _analysis(char *base,int seq, float *data, int n,int dB, 
+		      off_t offset){
+
+  FILE *f;
+  char buf[80];
+  sprintf(buf,"%s_%d.m",base,seq);
+
+  f=fopen(buf,"a");
+  if(f){
+    int i;
+    for(i=0;i<n;i++)
+      if(dB)
+	fprintf(f,"%d %f\n",(int)(i+offset),todB(data[i]));
+      else
+	fprintf(f,"%d %f\n",(int)(i+offset),(data[i]));
+
+  }
+  fclose(f);
+}
+
+
+static void deverb_work_helper(void *vs, deverb_settings *sset){
+  deverb_state *sss=(deverb_state *)vs;
+  subband_state *ss=&sss->ss;
+  int i,j,k,l;
+  float smoothms=sset->smooth*.1;
+  float releasems=sset->release*.1;
+  iir_filter *smooth=&sss->smooth;
+  iir_filter *release=&sss->release;
+  int ahead;
+  static off_t offset=0;
+
+  if(smoothms!=smooth->ms)filter_set(ss,smoothms,smooth,1,2);
+  if(releasems!=release->ms)filter_set(ss,releasems,release,0,1);
+
+  ahead=impulse_ahead2(smooth->alpha);
+  
+  for(i=0;i<deverb_freqs;i++){
+    int firstlink=0;
+    float fast[input_size];
+    float slow[input_size];
+    float multiplier = 1.-1000./sset->ratio[i];
+    
+    for(j=0;j<input_ch;j++){
+      int active=(ss->effect_active1[j] || 
+		  ss->effect_active0[j] || 
+		  ss->effect_activeC[j]);
+      
+      if(active){
+	if(sset->linkp){
+	  if(!firstlink){
+	    firstlink++;
+	    memset(fast,0,sizeof(fast));
+	    float scale=1./input_ch;
+	    for(l=0;l<input_ch;l++){
+	      float *x=sss->ss.lap[i][l]+ahead;
+	      for(k=0;k<input_size;k++)
+		fast[k]+=x[k]*x[k];
+	    }
+	    for(k=0;k<input_size;k++)
+	      fast[k]*=scale;
+	    
+	  }
+	  
+	}else{
+	  float *x=sss->ss.lap[i][j]+ahead;
+	  for(k=0;k<input_size;k++)
+	    fast[k]=x[k]*x[k];
+	}
+	
+	
+	if(sset->linkp==0 || firstlink==1){
+	  
+	  //memcpy(slow,fast,sizeof(slow));
+
+	  
+	  compute_iir_symmetric_freefall2(fast, input_size, &sss->iirS[i][j],
+				smooth);
+	  memcpy(slow,fast,sizeof(slow));
+	  compute_iir_only_freefall1(slow, input_size, &sss->iirR[i][j],
+				release);
+	  
+	  //_analysis("fast",i,fast,input_size,1,offset);
+	  //_analysis("slow",i,slow,input_size,1,offset);
+
+	  if(multiplier==sss->prevratio[i]){
+
+	    for(k=0;k<input_size;k++)
+	      fast[k]=fromdB_a((todB_a(slow+k)-todB_a(fast+k))*.5*multiplier);
+
+	  }else{
+	    float multiplier_add=(multiplier-sss->prevratio[i])/input_size;
+	    multiplier=sss->prevratio[i];
+
+	    for(k=0;k<input_size;k++){
+	      fast[k]=fromdB_a((todB_a(slow+k)-todB_a(fast+k))*.5*multiplier);
+	      multiplier+=multiplier_add;
+	    }
+
+	  }
+
+	  //_analysis("adj",i,fast,input_size,1,offset);
+
+	  if(sset->linkp && firstlink==1){
+
+	    for(l=0;l<input_ch;l++){
+	      if(l!=j){
+		memcpy(&sss->iirS[i][l],&sss->iirS[i][j],sizeof(iir_state));
+		memcpy(&sss->iirR[i][l],&sss->iirR[i][j],sizeof(iir_state));
+	      }
+	    }
+	  }
+
+	  firstlink++;
+	}
+	
+	
+	{
+	  float *x=sss->ss.lap[i][j];
+	  for(k=0;k<input_size;k++)
+	    if(fast[k]<1.)
+	      x[k]*=fast[k];
+	}
+      }else{
+	/* reset filters to sane inactive default */
+	memset(&sss->iirS[i][j],0,sizeof(iir_state));
+	memset(&sss->iirR[i][j],0,sizeof(iir_state));
+      }
+    }
+
+    sss->prevratio[i]=multiplier;
+  }
+  offset+=input_size;
+}
+
+static void deverb_work_channel(void *vs){
+  deverb_work_helper(vs,&deverb_channel_set);
+}
+
+time_linkage *deverb_read_channel(time_linkage *in){
+  int visible[input_ch];
+  int active [input_ch];
+  subband_window *w[input_ch];
+  int i;
+  
+  for(i=0;i<input_ch;i++){
+    visible[i]=0;
+    active[i]=deverb_channel_set.active[i];
+    w[i]=&sw;
+  }
+  
+  return subband_read(in, &channel_state.ss, w, visible, active, 
+		      deverb_work_channel, &channel_state);
+}

Copied: trunk/postfish/deverb.h (from rev 7783, trunk/postfish/suppress.h)
===================================================================
--- trunk/postfish/suppress.h	2004-09-17 22:52:57 UTC (rev 7783)
+++ trunk/postfish/deverb.h	2004-09-25 04:30:46 UTC (rev 7875)
@@ -0,0 +1,51 @@
+/*
+ *
+ *  postfish
+ *    
+ *      Copyright (C) 2002-2004 Monty and Xiph.Org
+ *
+ *  Postfish is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *   
+ *  Postfish is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *   
+ *  You should have received a copy of the GNU General Public License
+ *  along with Postfish; see the file COPYING.  If not, write to the
+ *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * 
+ */
+
+#include "postfish.h"
+
+#define deverb_freqs 8
+static const float deverb_freq_list[deverb_freqs+1]={
+  125,250,500,1000,2000,4000,8000,16000,9e10
+};
+
+static char * const deverb_freq_labels[deverb_freqs]={
+  "125","250","500","1k","2k","4k","8k","16k"
+};
+
+typedef struct {
+  sig_atomic_t ratio[deverb_freqs];
+  sig_atomic_t smooth;
+  sig_atomic_t trigger;
+  sig_atomic_t release;
+  sig_atomic_t linkp;
+
+  sig_atomic_t *active;
+  sig_atomic_t panel_visible;
+} deverb_settings;
+
+extern void deverb_reset();
+extern int deverb_load(void);
+extern time_linkage *deverb_read_channel(time_linkage *in);
+
+extern deverb_settings deverb_channel_set;
+

Copied: trunk/postfish/deverbpanel.c (from rev 7783, trunk/postfish/suppresspanel.c)
===================================================================
--- trunk/postfish/suppresspanel.c	2004-09-17 22:52:57 UTC (rev 7783)
+++ trunk/postfish/deverbpanel.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -0,0 +1,274 @@
+/*
+ *
+ *  postfish
+ *    
+ *      Copyright (C) 2002-2004 Monty
+ *
+ *  Postfish is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *   
+ *  Postfish is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *   
+ *  You should have received a copy of the GNU General Public License
+ *  along with Postfish; see the file COPYING.  If not, write to the
+ *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * 
+ */
+
+#include "postfish.h"
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include "readout.h"
+#include "multibar.h"
+#include "mainpanel.h"
+#include "subpanel.h"
+#include "feedback.h"
+#include "deverb.h"
+#include "deverbpanel.h"
+#include "config.h"
+
+typedef struct {
+  GtkWidget *cslider;
+  Readout *readoutc;
+  struct deverb_panel_state *sp;
+  sig_atomic_t *v;
+  int number;
+} tbar;
+
+typedef struct{
+  Multibar *s;
+  Readout *r0;
+  Readout *r1;
+  sig_atomic_t *v0;
+  sig_atomic_t *v1;
+} callback_arg_rv2;
+
+typedef struct deverb_panel_state{
+  subpanel_generic *panel;
+
+  GtkWidget        *link;
+  callback_arg_rv2  timing;
+  tbar              bars[deverb_freqs];
+} deverb_panel_state;
+
+static deverb_panel_state *channel_panel;
+
+void deverbpanel_state_to_config(int bank){
+  config_set_vector("deverbpanel_active",bank,0,0,0,input_ch,deverb_channel_set.active);
+  config_set_vector("deverbpanel_ratio",bank,0,0,0,deverb_freqs,deverb_channel_set.ratio);
+  config_set_integer("deverbpanel_set",bank,0,0,0,0,deverb_channel_set.linkp);
+  config_set_integer("deverbpanel_set",bank,0,0,0,1,deverb_channel_set.smooth);
+  config_set_integer("deverbpanel_set",bank,0,0,0,3,deverb_channel_set.release);
+}
+
+void deverbpanel_state_from_config(int bank){
+  int i;
+
+  config_get_vector("deverbpanel_active",bank,0,0,0,input_ch,deverb_channel_set.active);
+  for(i=0;i<input_ch;i++)
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(channel_panel->panel->subpanel_activebutton[i]),
+				 deverb_channel_set.active[i]);
+
+  config_get_vector("deverbpanel_ratio",bank,0,0,0,deverb_freqs,deverb_channel_set.ratio);
+  for(i=0;i<deverb_freqs;i++)
+    multibar_thumb_set(MULTIBAR(channel_panel->bars[i].cslider),
+		       1000./deverb_channel_set.ratio[i],0);
+
+  config_get_sigat("deverbpanel_set",bank,0,0,0,0,&deverb_channel_set.linkp);
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(channel_panel->link),deverb_channel_set.linkp);
+  
+  config_get_sigat("deverbpanel_set",bank,0,0,0,1,&deverb_channel_set.smooth);
+  multibar_thumb_set(MULTIBAR(channel_panel->timing.s),deverb_channel_set.smooth*.1,0);
+
+  config_get_sigat("deverbpanel_set",bank,0,0,0,3,&deverb_channel_set.release);
+  multibar_thumb_set(MULTIBAR(channel_panel->timing.s),deverb_channel_set.release*.1,1);
+}
+
+static void compand_change(GtkWidget *w,gpointer in){
+  char buffer[80];
+  tbar *bar=(tbar *)in;
+  float val=multibar_get_value(MULTIBAR(w),0);
+
+  if(val==1.){
+    sprintf(buffer,"   off");
+  }else 
+    sprintf(buffer,"%4.2f",val);
+
+  readout_set(bar->readoutc,buffer);
+  
+  *bar->v=1000./val;
+}
+
+static void timing_change(GtkWidget *w,gpointer in){
+  callback_arg_rv2 *ca=(callback_arg_rv2 *)in;
+  char buffer[80];
+  float smooth=multibar_get_value(MULTIBAR(w),0);
+  float release=multibar_get_value(MULTIBAR(w),1);
+  
+  if(smooth<100){
+    sprintf(buffer,"%4.1fms",smooth);
+  }else if (smooth<1000){
+    sprintf(buffer,"%4.0fms",smooth);
+  }else if (smooth<10000){
+    sprintf(buffer," %4.2fs",smooth/1000.);
+  }else{
+    sprintf(buffer," %4.1fs",smooth/1000.);
+  }
+  readout_set(ca->r0,buffer);
+
+  if(release<100){
+    sprintf(buffer,"%4.1fms",release);
+  }else if (release<1000){
+    sprintf(buffer,"%4.0fms",release);
+  }else if (release<10000){
+    sprintf(buffer," %4.2fs",release/1000.);
+  }else{
+    sprintf(buffer," %4.1fs",release/1000.);
+  }
+  readout_set(ca->r1,buffer);
+
+  *ca->v0=rint(smooth*10.);
+  *ca->v1=rint(release*10.);
+}
+
+static void deverb_link(GtkToggleButton *b,gpointer in){
+  int mode=gtk_toggle_button_get_active(b);
+  *((sig_atomic_t *)in)=mode;
+}
+
+static deverb_panel_state *deverbpanel_create_helper(postfish_mainpanel *mp,
+							 subpanel_generic *panel,
+							 deverb_settings *sset){
+  int i;
+  float compand_levels[5]={1,1.5,2,3,5};
+  char  *compand_labels[5]={"","1.5","2","3","5"};
+
+  float timing_levels[5]={1, 10, 100, 1000, 10000};
+  char  *timing_labels[5]={"","10ms","     100ms","1s","10s"};
+
+  GtkWidget *table=gtk_table_new(deverb_freqs+4,4,0);
+  GtkWidget *timinglabel=gtk_label_new("deverberator filter timing");
+  GtkWidget *releaselabel=gtk_label_new("release");
+  GtkWidget *smoothlabel=gtk_label_new("smooth");
+  GtkWidget *compandlabel=gtk_label_new("deverb depth");
+
+  GtkWidget *linkbutton=
+    gtk_check_button_new_with_mnemonic("_link channels into single image");
+  GtkWidget *linkbox=gtk_hbox_new(0,0);
+
+  deverb_panel_state *ps=calloc(1,sizeof(deverb_panel_state));
+  ps->panel=panel;
+
+  gtk_container_add(GTK_CONTAINER(panel->subpanel_box),table);
+
+  gtk_box_pack_end(GTK_BOX(linkbox),linkbutton,0,0,0);
+
+  gtk_table_attach(GTK_TABLE(table),timinglabel,0,2,0,1,
+		   GTK_EXPAND|GTK_FILL,
+		   GTK_EXPAND|GTK_FILL,
+		   0,5);
+  gtk_table_attach(GTK_TABLE(table),smoothlabel,2,3,0,1,
+		   GTK_EXPAND|GTK_FILL,
+		   GTK_EXPAND|GTK_FILL,
+		   0,0);
+  gtk_table_attach(GTK_TABLE(table),releaselabel,3,4,0,1,
+		   GTK_EXPAND|GTK_FILL,
+		   GTK_EXPAND|GTK_FILL,
+		   0,0);
+  gtk_table_attach(GTK_TABLE(table),compandlabel,0,3,2,3,
+		   GTK_EXPAND|GTK_FILL,
+		   GTK_EXPAND|GTK_FILL,
+		   0,5);
+  if(input_ch>1)
+    gtk_table_attach(GTK_TABLE(table),linkbox,0,4,deverb_freqs+3,
+		     deverb_freqs+4,GTK_FILL|GTK_EXPAND,0,0,10);
+
+  gtk_table_set_row_spacing(GTK_TABLE(table),1,5);
+  
+  gtk_misc_set_alignment(GTK_MISC(timinglabel),0,1.);
+  gtk_widget_set_name(timinglabel,"framelabel");
+  gtk_misc_set_alignment(GTK_MISC(smoothlabel),.5,1.);
+  gtk_widget_set_name(smoothlabel,"scalemarker");
+  gtk_misc_set_alignment(GTK_MISC(releaselabel),.5,1.);
+  gtk_widget_set_name(releaselabel,"scalemarker");
+  gtk_misc_set_alignment(GTK_MISC(compandlabel),0,1.);
+  gtk_widget_set_name(compandlabel,"framelabel");
+
+  g_signal_connect (G_OBJECT (linkbutton), "clicked",
+		    G_CALLBACK (deverb_link), &sset->linkp);
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linkbutton),1);
+  ps->link=linkbutton;
+
+  /* timing controls */
+  {
+    GtkWidget *slider=multibar_slider_new(5,timing_labels,timing_levels,2);
+
+    ps->timing.s=MULTIBAR(slider);
+
+    ps->timing.r0=READOUT(readout_new("10.0ms"));
+    ps->timing.r1=READOUT(readout_new("10.0ms"));
+
+    ps->timing.v0=&sset->smooth;
+    ps->timing.v1=&sset->release;
+
+    multibar_callback(MULTIBAR(slider),timing_change,&ps->timing);
+    
+    multibar_thumb_set(MULTIBAR(slider),80,0);
+    multibar_thumb_set(MULTIBAR(slider),400,2);
+
+    gtk_table_attach(GTK_TABLE(table),slider,1,2,1,2,
+		     GTK_FILL|GTK_EXPAND,GTK_EXPAND,5,0);
+    gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->timing.r0),2,3,1,2,
+		     0,0,0,0);
+    gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->timing.r1),3,4,1,2,
+		     0,0,0,0);
+  }
+
+  /* threshold controls */
+
+  for(i=0;i<deverb_freqs;i++){
+    GtkWidget *label=gtk_label_new(deverb_freq_labels[i]);
+    gtk_widget_set_name(label,"scalemarker");
+    
+    ps->bars[i].readoutc=READOUT(readout_new("1.55:1"));
+    ps->bars[i].cslider=multibar_slider_new(5,compand_labels,compand_levels,1);
+    ps->bars[i].sp=ps;
+    ps->bars[i].v=sset->ratio+i;
+    ps->bars[i].number=i;
+
+    multibar_callback(MULTIBAR(ps->bars[i].cslider),compand_change,ps->bars+i);
+    multibar_thumb_set(MULTIBAR(ps->bars[i].cslider),1,0);
+    
+    gtk_misc_set_alignment(GTK_MISC(label),1,.5);
+      
+    gtk_table_attach(GTK_TABLE(table),label,0,1,i+3,i+4,
+		     GTK_FILL,0,0,0);
+
+    gtk_table_attach(GTK_TABLE(table),ps->bars[i].cslider,1,3,i+3,i+4,
+		     GTK_FILL|GTK_EXPAND,GTK_EXPAND,5,0);
+    gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->bars[i].readoutc),3,4,
+		     i+3,i+4,0,0,0,0);
+  }
+  subpanel_show_all_but_toplevel(panel);
+
+  return ps;
+}
+
+void deverbpanel_create_channel(postfish_mainpanel *mp,
+				  GtkWidget **windowbutton,
+				  GtkWidget **activebutton){
+	     
+  subpanel_generic *panel=subpanel_create(mp,windowbutton[0],activebutton,
+					  deverb_channel_set.active,
+					  &deverb_channel_set.panel_visible,
+					  "De_verberation filter",0,
+					  0,input_ch);
+  
+  channel_panel=deverbpanel_create_helper(mp,panel,&deverb_channel_set);
+}

Copied: trunk/postfish/deverbpanel.h (from rev 7783, trunk/postfish/suppresspanel.h)
===================================================================
--- trunk/postfish/suppresspanel.h	2004-09-17 22:52:57 UTC (rev 7783)
+++ trunk/postfish/deverbpanel.h	2004-09-25 04:30:46 UTC (rev 7875)
@@ -0,0 +1,29 @@
+/*
+ *
+ *  postfish
+ *    
+ *      Copyright (C) 2002-2004 Monty
+ *
+ *  Postfish is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *   
+ *  Postfish is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *   
+ *  You should have received a copy of the GNU General Public License
+ *  along with Postfish; see the file COPYING.  If not, write to the
+ *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * 
+ */
+
+extern void deverbpanel_create_channel(postfish_mainpanel *mp,
+					 GtkWidget **windowbutton,
+					 GtkWidget **activebutton);
+
+extern void deverbpanel_state_to_config(int bank);
+extern void deverbpanel_state_from_config(int bank);

Modified: trunk/postfish/main.c
===================================================================
--- trunk/postfish/main.c	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/main.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -37,7 +37,7 @@
 #include "output.h"
 #include "declip.h"
 #include "eq.h"
-#include "suppress.h"
+#include "deverb.h"
 #include "multicompand.h"
 #include "singlecomp.h"
 #include "limit.h"
@@ -336,7 +336,7 @@
   /* set up filter chains */
   if(declip_load())exit(1);
   if(eq_load(OUTPUT_CHANNELS))exit(1);
-  if(suppress_load())exit(1);
+  if(deverb_load())exit(1);
   if(multicompand_load(OUTPUT_CHANNELS))exit(1);
   if(singlecomp_load(OUTPUT_CHANNELS))exit(1);
   if(limit_load(OUTPUT_CHANNELS))exit(1);

Modified: trunk/postfish/mainpanel.c
===================================================================
--- trunk/postfish/mainpanel.c	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/mainpanel.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -64,7 +64,7 @@
   clippanel_state_to_config(bank);
   compandpanel_state_to_config(bank);
   singlepanel_state_to_config(bank);
-  suppresspanel_state_to_config(bank);
+  deverbpanel_state_to_config(bank);
   eqpanel_state_to_config(bank);
   reverbpanel_state_to_config(bank);
   limitpanel_state_to_config(bank);
@@ -99,7 +99,7 @@
   clippanel_state_from_config(bank);
   compandpanel_state_from_config(bank);
   singlepanel_state_from_config(bank);
-  suppresspanel_state_from_config(bank);
+  deverbpanel_state_from_config(bank);
   eqpanel_state_from_config(bank);
   reverbpanel_state_from_config(bank);
   limitpanel_state_from_config(bank);
@@ -1060,7 +1060,7 @@
   }
 
   mainpanel_chentry(panel,channeltable,"_Declip ",0,clippanel_create,0);
-  mainpanel_chentry(panel,channeltable,"De_verb ",1,suppresspanel_create_channel,0);
+  mainpanel_chentry(panel,channeltable,"De_verb ",1,deverbpanel_create_channel,0);
   mainpanel_chentry(panel,channeltable,"_Multicomp ",2,0,compandpanel_create_channel);
   mainpanel_chentry(panel,channeltable,"_Singlecomp ",3,0,singlepanel_create_channel);
   mainpanel_chentry(panel,channeltable,"_EQ ",4,0,eqpanel_create_channel);

Modified: trunk/postfish/mainpanel.h
===================================================================
--- trunk/postfish/mainpanel.h	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/mainpanel.h	2004-09-25 04:30:46 UTC (rev 7875)
@@ -30,7 +30,7 @@
 #include "eqpanel.h"
 #include "compandpanel.h"
 #include "singlepanel.h"
-#include "suppresspanel.h"
+#include "deverbpanel.h"
 #include "limitpanel.h"
 #include "mixpanel.h"
 #include "reverbpanel.h"

Modified: trunk/postfish/mute.c
===================================================================
--- trunk/postfish/mute.c	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/mute.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -25,11 +25,24 @@
 #include "postfish.h"
 #include "mix.h"
 #include "mute.h"
+#include "window.h"
 
 extern int input_ch;
 extern sig_atomic_t *mixpanel_active;
 
+typedef struct {
+  u_int32_t active_prev;
+  int active_ch;
+  int init_state;
+  float *leftwindow;
+} mute_state;
+
+static mute_state channel_state;
+
 int mute_load(void){
+  memset(&channel_state,0,sizeof(channel_state));
+  channel_state.active_ch=input_ch;
+  channel_state.leftwindow=window_get(1,input_size);
   return 0;
 }
 
@@ -38,13 +51,45 @@
 }
 
 time_linkage *mute_read(time_linkage *in){
-  u_int32_t val=0;
-  int i;
+  u_int32_t preval=0,retval=0;
+  int i,j;
+  
+  if(!channel_state.init_state)
+    channel_state.active_prev=in->active;
 
+  /* the mute module is responsible for smoothly ramping audio levels
+     to/from zero and unity upon mute state change */
+
   for(i=0;i<input_ch;i++)
     if(mixpanel_active[i])
-      val|= (1<<i);
+      preval|= (1<<i);
 
-  in->active=val;
+  /* the mute module is responsible for smoothly ramping audio levels
+     to/from zero and unity upon mute state change */
+  for(i=0;i<input_ch;i++){
+    float *x=in->data[i];
+    if(mixpanel_active[i]){
+      retval|= (1<<i);
+      
+      if(mute_channel_muted(channel_state.active_prev,i)){
+	/* mute->active */
+	for(j=0;j<input_size;j++)
+	  x[j]*=channel_state.leftwindow[j];
+	
+      }
+    }else{
+      if(!mute_channel_muted(channel_state.active_prev,i)){
+	/* active->mute; ramp to zero and temporarily keep this
+           channel active for this frame while ramping */
+	retval|= (1<<i);
+	for(j=0;j<input_size;j++)
+	  x[j]*=channel_state.leftwindow[input_size-j]; 
+	
+      }
+    }
+  }
+
+  in->active=retval;
+  channel_state.active_prev=preval;
   return(in);
 }

Modified: trunk/postfish/output.c
===================================================================
--- trunk/postfish/output.c	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/output.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -32,7 +32,7 @@
 #include "eq.h"
 #include "multicompand.h"
 #include "singlecomp.h"
-#include "suppress.h"
+#include "deverb.h"
 #include "limit.h"
 #include "mute.h"
 #include "mix.h"
@@ -67,7 +67,7 @@
   eq_reset();      /* clear any persistent lapping state */
   multicompand_reset(); /* clear any persistent lapping state */
   singlecomp_reset(); /* clear any persistent lapping state */
-  suppress_reset(); /* clear any persistent lapping state */
+  deverb_reset(); /* clear any persistent lapping state */
   limit_reset(); /* clear any persistent lapping state */
   output_reset(); /* clear any persistent lapping state */
   mix_reset();
@@ -833,7 +833,7 @@
     result|=link->samples;
     link=declip_read(link);
     result|=link->samples;
-    link=suppress_read_channel(link);
+    link=deverb_read_channel(link);
     result|=link->samples;
     link=multicompand_read_channel(link);
     result|=link->samples;

Modified: trunk/postfish/postfish.h
===================================================================
--- trunk/postfish/postfish.h	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/postfish.h	2004-09-25 04:30:46 UTC (rev 7875)
@@ -50,6 +50,20 @@
 #include <signal.h>
 #include <fcntl.h>
 
+#if 0
+extern void ef_free(void * address);
+extern void *ef_realloc(void * oldBuffer, size_t newSize);
+extern void *ef_malloc(size_t size);
+extern void *ef_calloc(size_t nelem, size_t elsize);
+extern void *ef_valloc (size_t size);
+
+#define free ef_free
+#define realloc ef_realloc
+#define malloc ef_malloc
+#define calloc ef_calloc
+#define valloc ef_valloc
+#endif 
+
 #define OUTPUT_CHANNELS 8     // UI code assumes this is <=8
 #define MAX_INPUT_CHANNELS 32 // engine code requires <= 32 
 

Deleted: trunk/postfish/suppress.c
===================================================================
--- trunk/postfish/suppress.c	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/suppress.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -1,269 +0,0 @@
-/*
- *
- *  postfish
- *    
- *      Copyright (C) 2002-2004 Monty and Xiph.Org
- *
- *  Postfish is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *   
- *  Postfish is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *   
- *  You should have received a copy of the GNU General Public License
- *  along with Postfish; see the file COPYING.  If not, write to the
- *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * 
- */
-
-#include "postfish.h"
-#include "feedback.h"
-#include <fftw3.h>
-#include "subband.h"
-#include "bessel.h"
-#include "suppress.h"
-
-/* (since this one is kinda unique) The Reverberation Suppressor....
-   
-   Reverberation in a measurably live environment displays
-   log amplitude decay with time (linear decay when plotted on a dB
-   scale).
-   
-   In its simplest form, the suppressor follows actual RMS amplitude
-   attacks but chooses a slower-than-actual decay, then expands
-   according to the dB distance between the slow and actual decay.
-   
-   Thus, the suppressor can be used to 'dry out' a very 'wet'
-   reverberative track. */
-    
-extern int input_size;
-extern int input_rate;
-extern int input_ch;
-
-typedef struct {
-  subband_state ss;
-  
-  iir_filter smooth;
-  iir_filter release;
-  
-  iir_state *iirS[suppress_freqs];
-  iir_state *iirR[suppress_freqs];
-
-  float prevratio[suppress_freqs];
-
-} suppress_state;
-
-suppress_settings suppress_channel_set;
-static suppress_state channel_state;
-static subband_window sw;
-
-void suppress_reset(){
-  int i,j;
-  
-  subband_reset(&channel_state.ss);
-  
-  for(i=0;i<suppress_freqs;i++){
-    for(j=0;j<input_ch;j++){
-      memset(&channel_state.iirS[i][j],0,sizeof(iir_state));
-      memset(&channel_state.iirR[i][j],0,sizeof(iir_state));
-    }
-  }
-}
-
-static void filter_set(subband_state *ss,
-		       float msec,
-		       iir_filter *filter,
-		       int attackp,
-		       int order){
-  float alpha;
-  float corner_freq= 500./msec;
-  
-  /* make sure the chosen frequency doesn't require a lookahead
-     greater than what's available */
-  if(impulse_freq2(input_size*2-ss->qblocksize*3)*1.01>corner_freq && 
-     attackp)
-    corner_freq=impulse_freq2(input_size*2-ss->qblocksize*3);
-  
-  alpha=corner_freq/input_rate;
-  filter->g=mkbessel(alpha,order,filter->c);
-  filter->alpha=alpha;
-  filter->Hz=alpha*input_rate;
-  filter->ms=msec;
-}
-
-int suppress_load(void){
-  int i;
-  int qblocksize=input_size/16;
-  memset(&channel_state,0,sizeof(channel_state));
-
-  suppress_channel_set.active=calloc(input_ch,sizeof(*suppress_channel_set.active));
-
-  subband_load(&channel_state.ss,suppress_freqs,qblocksize,input_ch);
-  subband_load_freqs(&channel_state.ss,&sw,suppress_freq_list,suppress_freqs);
-   
-  for(i=0;i<suppress_freqs;i++){
-    channel_state.iirS[i]=calloc(input_ch,sizeof(iir_state));
-    channel_state.iirR[i]=calloc(input_ch,sizeof(iir_state));
-  }
-  return 0;
-}
-
-static void _analysis(char *base,int seq, float *data, int n,int dB, 
-		      off_t offset){
-
-  FILE *f;
-  char buf[80];
-  sprintf(buf,"%s_%d.m",base,seq);
-
-  f=fopen(buf,"a");
-  if(f){
-    int i;
-    for(i=0;i<n;i++)
-      if(dB)
-	fprintf(f,"%d %f\n",(int)(i+offset),todB(data[i]));
-      else
-	fprintf(f,"%d %f\n",(int)(i+offset),(data[i]));
-
-  }
-  fclose(f);
-}
-
-
-static void suppress_work_helper(void *vs, suppress_settings *sset){
-  suppress_state *sss=(suppress_state *)vs;
-  subband_state *ss=&sss->ss;
-  int i,j,k,l;
-  float smoothms=sset->smooth*.1;
-  float releasems=sset->release*.1;
-  iir_filter *smooth=&sss->smooth;
-  iir_filter *release=&sss->release;
-  int ahead;
-  static off_t offset=0;
-
-  if(smoothms!=smooth->ms)filter_set(ss,smoothms,smooth,1,2);
-  if(releasems!=release->ms)filter_set(ss,releasems,release,0,1);
-
-  ahead=impulse_ahead2(smooth->alpha);
-  
-  for(i=0;i<suppress_freqs;i++){
-    int firstlink=0;
-    float fast[input_size];
-    float slow[input_size];
-    float multiplier = 1.-1000./sset->ratio[i];
-    
-    for(j=0;j<input_ch;j++){
-      int active=(ss->effect_active1[j] || 
-		  ss->effect_active0[j] || 
-		  ss->effect_activeC[j]);
-      
-      if(active){
-	if(sset->linkp){
-	  if(!firstlink){
-	    firstlink++;
-	    memset(fast,0,sizeof(fast));
-	    float scale=1./input_ch;
-	    for(l=0;l<input_ch;l++){
-	      float *x=sss->ss.lap[i][l]+ahead;
-	      for(k=0;k<input_size;k++)
-		fast[k]+=x[k]*x[k];
-	    }
-	    for(k=0;k<input_size;k++)
-	      fast[k]*=scale;
-	    
-	  }
-	  
-	}else{
-	  float *x=sss->ss.lap[i][j]+ahead;
-	  for(k=0;k<input_size;k++)
-	    fast[k]=x[k]*x[k];
-	}
-	
-	
-	if(sset->linkp==0 || firstlink==1){
-	  
-	  //memcpy(slow,fast,sizeof(slow));
-
-	  
-	  compute_iir_symmetric_freefall2(fast, input_size, &sss->iirS[i][j],
-				smooth);
-	  memcpy(slow,fast,sizeof(slow));
-	  compute_iir_freefall1(slow, input_size, &sss->iirR[i][j],
-				release);
-	  
-	  //_analysis("fast",i,fast,input_size,1,offset);
-	  //_analysis("slow",i,slow,input_size,1,offset);
-
-	  if(multiplier==sss->prevratio[i]){
-
-	    for(k=0;k<input_size;k++)
-	      fast[k]=fromdB_a((todB_a(slow+k)-todB_a(fast+k))*.5*multiplier);
-
-	  }else{
-	    float multiplier_add=(multiplier-sss->prevratio[i])/input_size;
-	    multiplier=sss->prevratio[i];
-
-	    for(k=0;k<input_size;k++){
-	      fast[k]=fromdB_a((todB_a(slow+k)-todB_a(fast+k))*.5*multiplier);
-	      multiplier+=multiplier_add;
-	    }
-
-	  }
-
-	  //_analysis("adj",i,fast,input_size,1,offset);
-
-	  if(sset->linkp && firstlink==1){
-
-	    for(l=0;l<input_ch;l++){
-	      if(l!=j){
-		memcpy(&sss->iirS[i][l],&sss->iirS[i][j],sizeof(iir_state));
-		memcpy(&sss->iirR[i][l],&sss->iirR[i][j],sizeof(iir_state));
-	      }
-	    }
-	  }
-
-	  firstlink++;
-	}
-	
-	
-	{
-	  float *x=sss->ss.lap[i][j];
-	  for(k=0;k<input_size;k++)
-	    if(fast[k]<1.)
-	      x[k]*=fast[k];
-	}
-      }else{
-	/* reset filters to sane inactive default */
-	memset(&sss->iirS[i][j],0,sizeof(iir_state));
-	memset(&sss->iirR[i][j],0,sizeof(iir_state));
-      }
-    }
-
-    sss->prevratio[i]=multiplier;
-  }
-  offset+=input_size;
-}
-
-static void suppress_work_channel(void *vs){
-  suppress_work_helper(vs,&suppress_channel_set);
-}
-
-time_linkage *suppress_read_channel(time_linkage *in){
-  int visible[input_ch];
-  int active [input_ch];
-  subband_window *w[input_ch];
-  int i;
-  
-  for(i=0;i<input_ch;i++){
-    visible[i]=0;
-    active[i]=suppress_channel_set.active[i];
-    w[i]=&sw;
-  }
-  
-  return subband_read(in, &channel_state.ss, w, visible, active, 
-		      suppress_work_channel, &channel_state);
-}

Deleted: trunk/postfish/suppress.h
===================================================================
--- trunk/postfish/suppress.h	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/suppress.h	2004-09-25 04:30:46 UTC (rev 7875)
@@ -1,51 +0,0 @@
-/*
- *
- *  postfish
- *    
- *      Copyright (C) 2002-2004 Monty and Xiph.Org
- *
- *  Postfish is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *   
- *  Postfish is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *   
- *  You should have received a copy of the GNU General Public License
- *  along with Postfish; see the file COPYING.  If not, write to the
- *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * 
- */
-
-#include "postfish.h"
-
-#define suppress_freqs 8
-static const float suppress_freq_list[suppress_freqs+1]={
-  125,250,500,1000,2000,4000,8000,16000,9e10
-};
-
-static char * const suppress_freq_labels[suppress_freqs]={
-  "125","250","500","1k","2k","4k","8k","16k"
-};
-
-typedef struct {
-  sig_atomic_t ratio[suppress_freqs];
-  sig_atomic_t smooth;
-  sig_atomic_t trigger;
-  sig_atomic_t release;
-  sig_atomic_t linkp;
-
-  sig_atomic_t *active;
-  sig_atomic_t panel_visible;
-} suppress_settings;
-
-extern void suppress_reset();
-extern int suppress_load(void);
-extern time_linkage *suppress_read_channel(time_linkage *in);
-
-extern suppress_settings suppress_channel_set;
-

Deleted: trunk/postfish/suppresspanel.c
===================================================================
--- trunk/postfish/suppresspanel.c	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/suppresspanel.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -1,274 +0,0 @@
-/*
- *
- *  postfish
- *    
- *      Copyright (C) 2002-2004 Monty
- *
- *  Postfish is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *   
- *  Postfish is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *   
- *  You should have received a copy of the GNU General Public License
- *  along with Postfish; see the file COPYING.  If not, write to the
- *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * 
- */
-
-#include "postfish.h"
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include "readout.h"
-#include "multibar.h"
-#include "mainpanel.h"
-#include "subpanel.h"
-#include "feedback.h"
-#include "suppress.h"
-#include "suppresspanel.h"
-#include "config.h"
-
-typedef struct {
-  GtkWidget *cslider;
-  Readout *readoutc;
-  struct suppress_panel_state *sp;
-  sig_atomic_t *v;
-  int number;
-} tbar;
-
-typedef struct{
-  Multibar *s;
-  Readout *r0;
-  Readout *r1;
-  sig_atomic_t *v0;
-  sig_atomic_t *v1;
-} callback_arg_rv2;
-
-typedef struct suppress_panel_state{
-  subpanel_generic *panel;
-
-  GtkWidget        *link;
-  callback_arg_rv2  timing;
-  tbar              bars[suppress_freqs];
-} suppress_panel_state;
-
-static suppress_panel_state *channel_panel;
-
-void suppresspanel_state_to_config(int bank){
-  config_set_vector("suppresspanel_active",bank,0,0,0,input_ch,suppress_channel_set.active);
-  config_set_vector("suppresspanel_ratio",bank,0,0,0,suppress_freqs,suppress_channel_set.ratio);
-  config_set_integer("suppresspanel_set",bank,0,0,0,0,suppress_channel_set.linkp);
-  config_set_integer("suppresspanel_set",bank,0,0,0,1,suppress_channel_set.smooth);
-  config_set_integer("suppresspanel_set",bank,0,0,0,3,suppress_channel_set.release);
-}
-
-void suppresspanel_state_from_config(int bank){
-  int i;
-
-  config_get_vector("suppresspanel_active",bank,0,0,0,input_ch,suppress_channel_set.active);
-  for(i=0;i<input_ch;i++)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(channel_panel->panel->subpanel_activebutton[i]),
-				 suppress_channel_set.active[i]);
-
-  config_get_vector("suppresspanel_ratio",bank,0,0,0,suppress_freqs,suppress_channel_set.ratio);
-  for(i=0;i<suppress_freqs;i++)
-    multibar_thumb_set(MULTIBAR(channel_panel->bars[i].cslider),
-		       1000./suppress_channel_set.ratio[i],0);
-
-  config_get_sigat("suppresspanel_set",bank,0,0,0,0,&suppress_channel_set.linkp);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(channel_panel->link),suppress_channel_set.linkp);
-  
-  config_get_sigat("suppresspanel_set",bank,0,0,0,1,&suppress_channel_set.smooth);
-  multibar_thumb_set(MULTIBAR(channel_panel->timing.s),suppress_channel_set.smooth*.1,0);
-
-  config_get_sigat("suppresspanel_set",bank,0,0,0,3,&suppress_channel_set.release);
-  multibar_thumb_set(MULTIBAR(channel_panel->timing.s),suppress_channel_set.release*.1,1);
-}
-
-static void compand_change(GtkWidget *w,gpointer in){
-  char buffer[80];
-  tbar *bar=(tbar *)in;
-  float val=multibar_get_value(MULTIBAR(w),0);
-
-  if(val==1.){
-    sprintf(buffer,"   off");
-  }else 
-    sprintf(buffer,"%4.2f",val);
-
-  readout_set(bar->readoutc,buffer);
-  
-  *bar->v=1000./val;
-}
-
-static void timing_change(GtkWidget *w,gpointer in){
-  callback_arg_rv2 *ca=(callback_arg_rv2 *)in;
-  char buffer[80];
-  float smooth=multibar_get_value(MULTIBAR(w),0);
-  float release=multibar_get_value(MULTIBAR(w),1);
-  
-  if(smooth<100){
-    sprintf(buffer,"%4.1fms",smooth);
-  }else if (smooth<1000){
-    sprintf(buffer,"%4.0fms",smooth);
-  }else if (smooth<10000){
-    sprintf(buffer," %4.2fs",smooth/1000.);
-  }else{
-    sprintf(buffer," %4.1fs",smooth/1000.);
-  }
-  readout_set(ca->r0,buffer);
-
-  if(release<100){
-    sprintf(buffer,"%4.1fms",release);
-  }else if (release<1000){
-    sprintf(buffer,"%4.0fms",release);
-  }else if (release<10000){
-    sprintf(buffer," %4.2fs",release/1000.);
-  }else{
-    sprintf(buffer," %4.1fs",release/1000.);
-  }
-  readout_set(ca->r1,buffer);
-
-  *ca->v0=rint(smooth*10.);
-  *ca->v1=rint(release*10.);
-}
-
-static void suppress_link(GtkToggleButton *b,gpointer in){
-  int mode=gtk_toggle_button_get_active(b);
-  *((sig_atomic_t *)in)=mode;
-}
-
-static suppress_panel_state *suppresspanel_create_helper(postfish_mainpanel *mp,
-							 subpanel_generic *panel,
-							 suppress_settings *sset){
-  int i;
-  float compand_levels[5]={1,1.5,2,3,5};
-  char  *compand_labels[5]={"","1.5","2","3","5"};
-
-  float timing_levels[5]={1, 10, 100, 1000, 10000};
-  char  *timing_labels[5]={"","10ms","     100ms","1s","10s"};
-
-  GtkWidget *table=gtk_table_new(suppress_freqs+4,4,0);
-  GtkWidget *timinglabel=gtk_label_new("suppressor filter timing");
-  GtkWidget *releaselabel=gtk_label_new("release");
-  GtkWidget *smoothlabel=gtk_label_new("smooth");
-  GtkWidget *compandlabel=gtk_label_new("suppression depth");
-
-  GtkWidget *linkbutton=
-    gtk_check_button_new_with_mnemonic("_link channels into single image");
-  GtkWidget *linkbox=gtk_hbox_new(0,0);
-
-  suppress_panel_state *ps=calloc(1,sizeof(suppress_panel_state));
-  ps->panel=panel;
-
-  gtk_container_add(GTK_CONTAINER(panel->subpanel_box),table);
-
-  gtk_box_pack_end(GTK_BOX(linkbox),linkbutton,0,0,0);
-
-  gtk_table_attach(GTK_TABLE(table),timinglabel,0,2,0,1,
-		   GTK_EXPAND|GTK_FILL,
-		   GTK_EXPAND|GTK_FILL,
-		   0,5);
-  gtk_table_attach(GTK_TABLE(table),smoothlabel,2,3,0,1,
-		   GTK_EXPAND|GTK_FILL,
-		   GTK_EXPAND|GTK_FILL,
-		   0,0);
-  gtk_table_attach(GTK_TABLE(table),releaselabel,3,4,0,1,
-		   GTK_EXPAND|GTK_FILL,
-		   GTK_EXPAND|GTK_FILL,
-		   0,0);
-  gtk_table_attach(GTK_TABLE(table),compandlabel,0,3,2,3,
-		   GTK_EXPAND|GTK_FILL,
-		   GTK_EXPAND|GTK_FILL,
-		   0,5);
-  if(input_ch>1)
-    gtk_table_attach(GTK_TABLE(table),linkbox,0,4,suppress_freqs+3,
-		     suppress_freqs+4,GTK_FILL|GTK_EXPAND,0,0,10);
-
-  gtk_table_set_row_spacing(GTK_TABLE(table),1,5);
-  
-  gtk_misc_set_alignment(GTK_MISC(timinglabel),0,1.);
-  gtk_widget_set_name(timinglabel,"framelabel");
-  gtk_misc_set_alignment(GTK_MISC(smoothlabel),.5,1.);
-  gtk_widget_set_name(smoothlabel,"scalemarker");
-  gtk_misc_set_alignment(GTK_MISC(releaselabel),.5,1.);
-  gtk_widget_set_name(releaselabel,"scalemarker");
-  gtk_misc_set_alignment(GTK_MISC(compandlabel),0,1.);
-  gtk_widget_set_name(compandlabel,"framelabel");
-
-  g_signal_connect (G_OBJECT (linkbutton), "clicked",
-		    G_CALLBACK (suppress_link), &sset->linkp);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linkbutton),1);
-  ps->link=linkbutton;
-
-  /* timing controls */
-  {
-    GtkWidget *slider=multibar_slider_new(5,timing_labels,timing_levels,2);
-
-    ps->timing.s=MULTIBAR(slider);
-
-    ps->timing.r0=READOUT(readout_new("10.0ms"));
-    ps->timing.r1=READOUT(readout_new("10.0ms"));
-
-    ps->timing.v0=&sset->smooth;
-    ps->timing.v1=&sset->release;
-
-    multibar_callback(MULTIBAR(slider),timing_change,&ps->timing);
-    
-    multibar_thumb_set(MULTIBAR(slider),80,0);
-    multibar_thumb_set(MULTIBAR(slider),400,2);
-
-    gtk_table_attach(GTK_TABLE(table),slider,1,2,1,2,
-		     GTK_FILL|GTK_EXPAND,GTK_EXPAND,5,0);
-    gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->timing.r0),2,3,1,2,
-		     0,0,0,0);
-    gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->timing.r1),3,4,1,2,
-		     0,0,0,0);
-  }
-
-  /* threshold controls */
-
-  for(i=0;i<suppress_freqs;i++){
-    GtkWidget *label=gtk_label_new(suppress_freq_labels[i]);
-    gtk_widget_set_name(label,"scalemarker");
-    
-    ps->bars[i].readoutc=READOUT(readout_new("1.55:1"));
-    ps->bars[i].cslider=multibar_slider_new(5,compand_labels,compand_levels,1);
-    ps->bars[i].sp=ps;
-    ps->bars[i].v=sset->ratio+i;
-    ps->bars[i].number=i;
-
-    multibar_callback(MULTIBAR(ps->bars[i].cslider),compand_change,ps->bars+i);
-    multibar_thumb_set(MULTIBAR(ps->bars[i].cslider),1,0);
-    
-    gtk_misc_set_alignment(GTK_MISC(label),1,.5);
-      
-    gtk_table_attach(GTK_TABLE(table),label,0,1,i+3,i+4,
-		     GTK_FILL,0,0,0);
-
-    gtk_table_attach(GTK_TABLE(table),ps->bars[i].cslider,1,3,i+3,i+4,
-		     GTK_FILL|GTK_EXPAND,GTK_EXPAND,5,0);
-    gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->bars[i].readoutc),3,4,
-		     i+3,i+4,0,0,0,0);
-  }
-  subpanel_show_all_but_toplevel(panel);
-
-  return ps;
-}
-
-void suppresspanel_create_channel(postfish_mainpanel *mp,
-				  GtkWidget **windowbutton,
-				  GtkWidget **activebutton){
-	     
-  subpanel_generic *panel=subpanel_create(mp,windowbutton[0],activebutton,
-					  suppress_channel_set.active,
-					  &suppress_channel_set.panel_visible,
-					  "De_verberation filter",0,
-					  0,input_ch);
-  
-  channel_panel=suppresspanel_create_helper(mp,panel,&suppress_channel_set);
-}

Deleted: trunk/postfish/suppresspanel.h
===================================================================
--- trunk/postfish/suppresspanel.h	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/suppresspanel.h	2004-09-25 04:30:46 UTC (rev 7875)
@@ -1,29 +0,0 @@
-/*
- *
- *  postfish
- *    
- *      Copyright (C) 2002-2004 Monty
- *
- *  Postfish is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *   
- *  Postfish is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *   
- *  You should have received a copy of the GNU General Public License
- *  along with Postfish; see the file COPYING.  If not, write to the
- *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * 
- */
-
-extern void suppresspanel_create_channel(postfish_mainpanel *mp,
-					 GtkWidget **windowbutton,
-					 GtkWidget **activebutton);
-
-extern void suppresspanel_state_to_config(int bank);
-extern void suppresspanel_state_from_config(int bank);

Modified: trunk/postfish/version.h
===================================================================
--- trunk/postfish/version.h	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/version.h	2004-09-25 04:30:46 UTC (rev 7875)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Thu Sep 16 00:53:42 EDT 2004] */
+/* DO NOT EDIT: Automated versioning hack [Sat Sep 25 00:44:50 EDT 2004] */

Added: trunk/postfish/window.c
===================================================================
--- trunk/postfish/window.c	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/window.c	2004-09-25 04:30:46 UTC (rev 7875)
@@ -0,0 +1,78 @@
+/*
+ *
+ *  postfish
+ *    
+ *      Copyright (C) 2002-2004 Monty and Xiph.Org
+ *
+ *  Postfish is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *   
+ *  Postfish is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *   
+ *  You should have received a copy of the GNU General Public License
+ *  along with Postfish; see the file COPYING.  If not, write to the
+ *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * 
+ */
+
+#include "postfish.h"
+#include "window.h"
+
+static float ***window_func=0; /* sin(), sin()^2, sin(sin()^2),sin(sin^2)^2 
+				  
+				  1,2,4,8,16,32,64,128,256,512,1024,
+				  2048,4096,8192,16384,32768,65536 */
+
+/* type is one of 0==sin(x),
+                  1==sin(x)^2,
+		  2==sin(sin(x)^2),
+		  3==sin(sin(x)^2)^2 */
+/* returns quarter-cycle (left half) n+1 samples of a window from 0. to 1. */
+static int ilog(long x){
+  int ret=-1;
+
+  while(x>0){
+    x>>=1;
+    ret++;
+  }
+  return ret;
+}
+
+float *window_get(int type,int n){
+  int bits=ilog(n),i;
+  if((1<<bits)!=n)return 0;
+  
+  if(bits<0)return 0;
+  if(bits>=17)return 0;
+  
+  if(type<0)return 0;
+  if(type>3)return 0;
+
+  if(!window_func)
+    window_func=calloc(4,sizeof(*window_func));
+
+  if(!window_func[type])
+    window_func[type]=calloc(17,sizeof(**window_func));
+
+  if(!window_func[type][bits]){
+    window_func[type][bits]=malloc((n+1)*sizeof(***window_func));
+    for(i=0;i<n+1;i++)window_func[type][bits][i]=sin(M_PIl*.5*i/n);
+    if(type>0)
+      for(i=0;i<n+1;i++)window_func[type][bits][i]*=
+			   window_func[type][bits][i];
+    if(type>1)
+      for(i=0;i<n+1;i++)window_func[type][bits][i]=
+			   sin(window_func[type][bits][i]*M_PIl*.5);
+    if(type>2)
+      for(i=0;i<n+1;i++)window_func[type][bits][i]*=
+			   window_func[type][bits][i];
+  }
+
+  return window_func[type][bits];
+}

Added: trunk/postfish/window.h
===================================================================
--- trunk/postfish/window.h	2004-09-25 04:18:12 UTC (rev 7874)
+++ trunk/postfish/window.h	2004-09-25 04:30:46 UTC (rev 7875)
@@ -0,0 +1,24 @@
+/*
+ *
+ *  postfish
+ *    
+ *      Copyright (C) 2002-2004 Monty and Xiph.Org
+ *
+ *  Postfish is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *   
+ *  Postfish is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *   
+ *  You should have received a copy of the GNU General Public License
+ *  along with Postfish; see the file COPYING.  If not, write to the
+ *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * 
+ */
+
+extern float *window_get(int type,int n);



More information about the commits mailing list