Commit a1a9e00d authored by Monty Montgomery's avatar Monty Montgomery

Weekend dabbling in postfish

fromdB_a approximation guarding fix
bounds fix in subband filter setup
Altivec underflow exception disabling
mixdown block implementation
reverberation driver (untested)



git-svn-id: https://svn.xiph.org/trunk/postfish@6712 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 578e63ef
...@@ -2,26 +2,34 @@ ...@@ -2,26 +2,34 @@
# Fuck the horse it rode in on # Fuck the horse it rode in on
# and Fuck its little dog Libtool too # and Fuck its little dog Libtool too
ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1
ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 -maltivec
# use for PPC with altivec. IF YOU HAVE ALTIVEC, YOU MUST USE THIS
# LINE, otherwise FFTW3 will randomly crash whenever it uses Altivec
# and any math denormalizes.
#ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 -maltivec
CC=gcc CC=gcc
LD=gcc LD=gcc
INSTALL=install INSTALL=install
PREFIX=/usr/local PREFIX=/usr/local
BINDIR=$PREFIX/bin BINDIR=$PREFIX/bin
ETCDIR=/etc ETCDIR=/etc/postfish
MANDIR=$PREFIX/man MANDIR=$PREFIX/man
SRC = main.c mainpanel.c multibar.c readout.c input.c output.c clippanel.c \ 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 \ declip.c reconstruct.c multicompand.c windowbutton.c subpanel.c \
feedback.c freq.c eq.c eqpanel.c compandpanel.c subband.c lpc.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 suppresspanel.c suppress.c singlecomp.c singlepanel.c \
limit.c limitpanel.c mute.c mutedummy.c limit.c limitpanel.c mute.c mixpanel.c mix.c reverb.c
OBJ = main.o mainpanel.o multibar.o readout.o input.o output.o clippanel.o \ 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 \ declip.o reconstruct.o multicompand.o windowbutton.o subpanel.o \
feedback.o freq.o eq.o eqpanel.o compandpanel.o subband.o lpc.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 suppresspanel.o suppress.o singlecomp.o singlepanel.o \
limit.o limitpanel.o mute.o mutedummy.o limit.o limitpanel.o mute.o mixpanel.o mix.o reverb.o
GCF = `pkg-config --cflags gtk+-2.0` -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED GCF = -DETCDIR=\\\"$(ETCDIR)\\\" `pkg-config --cflags gtk+-2.0` -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
all: all:
$(MAKE) target CFLAGS="-O3 -ffast-math -fomit-frame-pointer $(GCF) $(ADD_DEF)" $(MAKE) target CFLAGS="-O3 -ffast-math -fomit-frame-pointer $(GCF) $(ADD_DEF)"
...@@ -30,27 +38,44 @@ debug: ...@@ -30,27 +38,44 @@ debug:
$(MAKE) target CFLAGS="-g -Wall -W -Wno-unused-parameter -D__NO_MATH_INLINES $(GCF) $(ADD_DEF)" $(MAKE) target CFLAGS="-g -Wall -W -Wno-unused-parameter -D__NO_MATH_INLINES $(GCF) $(ADD_DEF)"
profile: profile:
$(MAKE) target CFLAGS="-pg -g -O3 -ffast-math $(GCF) $(ADD_DEF)" LIBS="-lgprof-helper" $(MAKE) target CFLAGS="-pg -g -O3 -ffast-math $(GCF) $(ADD_DEF)" LIBS="-lgprof-helper "
clean: clean:
rm -f $(OBJ) *.d *.d.* gmon.out rm -f $(OBJ) *.d *.d.* gmon.out postfish
distclean: clean
rm -f postfish-wisdomrc
%.d: %.c %.d: %.c
$(CC) -M $(GCF) $< > $@.$$$$; sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$ $(CC) -M $(CFLAGS) $< > $@.$$$$; sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$
postfish-wisdomrc:
fftwf-wisdom -v -o postfish-wisdomrc \
rif32 rof32 rib32 rob32 \
rif64 rof64 rib64 rob64 \
rif128 rof128 rib128 rob128 \
rif256 rof256 rib256 rob256 \
rif512 rof512 rib512 rob512 \
rif1024 rof1024 rib1024 rob1024 \
rif2048 rof2048 rib2048 rob2048 \
rif4096 rof4096 rib4096 rob4096 \
rif8192 rof8192 rib8192 rob8192 \
rif16384 rof16384 rib16384 rob16384
ifneq ($(MAKECMDGOALS),clean) ifeq ($(MAKECMDGOALS),target)
include $(SRC:.c=.d) include $(SRC:.c=.d)
endif endif
target: $(OBJ) target: $(OBJ) postfish-wisdomrc
./touch-version ./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
install: install: target
$(INSTALL) -d -m 0755 $(BINDIR) $(INSTALL) -d -m 0755 $(BINDIR)
$(INSTALL) -m 0755 postfish $(BINDIR) $(INSTALL) -m 0755 postfish $(BINDIR)
$(INSTALL) -d -m 0755 $(ETCDIR) $(INSTALL) -d -m 0755 $(ETCDIR)
$(INSTALL) -m 0644 postfish-gtkrc $(ETCDIR) $(INSTALL) -m 0644 postfish-gtkrc $(ETCDIR)
$(INSTALL) -m 0644 postfish-wisdomrc $(ETCDIR)
# $(INSTALL) -d -m 0755 $(MANDIR) # $(INSTALL) -d -m 0755 $(MANDIR)
# $(INSTALL) -d -m 0755 $(MANDIR)/man1 # $(INSTALL) -d -m 0755 $(MANDIR)/man1
# $(INSTALL) -m 0644 postfish.1 $(MANDIR)/man1 # $(INSTALL) -m 0644 postfish.1 $(MANDIR)/man1
...@@ -302,6 +302,39 @@ void compute_iir_freefall2(float *x, int n, iir_state *is, ...@@ -302,6 +302,39 @@ void compute_iir_freefall2(float *x, int n, iir_state *is,
} }
void compute_iir_decayonly2(float *x, int n, iir_state *is,
iir_filter *decay){
double d_c0=decay->c[0];
double d_c1=decay->c[1];
double d_g=decay->g;
double x0=is->x[0];
double x1=is->x[1];
double y0=is->y[0];
double y1=is->y[1];
int i=0;
while(i<n){
double yd;
if(y1<y0)y1=y0; // slope fixup
yd = (x[i]+x0*2.+x1)/d_g + y0*d_c0+y1*d_c1;
if(x[i]>yd)yd=x[i];
x1=x0;x0=x[i];
y1=y0;x[i]=y0=yd;
i++;
}
is->x[0]=x0;
is->x[1]=x1;
is->y[0]=y0;
is->y[1]=y1;
}
void compute_iir_freefall3(float *x, int n, iir_state *is, void compute_iir_freefall3(float *x, int n, iir_state *is,
iir_filter *decay){ iir_filter *decay){
double d_c0=decay->c[0]; double d_c0=decay->c[0];
......
...@@ -33,6 +33,7 @@ typedef struct { ...@@ -33,6 +33,7 @@ typedef struct {
float alpha; float alpha;
float Hz; float Hz;
float ms; float ms;
int samples;
} iir_filter; } iir_filter;
static inline long impulse_ahead2(float alpha){ static inline long impulse_ahead2(float alpha){
...@@ -84,6 +85,8 @@ extern void compute_iir_freefall1(float *x, int n, iir_state *is, ...@@ -84,6 +85,8 @@ extern void compute_iir_freefall1(float *x, int n, iir_state *is,
iir_filter *decay); iir_filter *decay);
extern void compute_iir_freefall2(float *x, int n, iir_state *is, extern void compute_iir_freefall2(float *x, int n, iir_state *is,
iir_filter *decay); iir_filter *decay);
extern void compute_iir_decayonly2(float *x, int n, iir_state *is,
iir_filter *decay);
extern void compute_iir_freefall3(float *x, int n, iir_state *is, extern void compute_iir_freefall3(float *x, int n, iir_state *is,
iir_filter *decay); iir_filter *decay);
extern void compute_iir_freefall4(float *x, int n, iir_state *is, extern void compute_iir_freefall4(float *x, int n, iir_state *is,
......
...@@ -116,7 +116,7 @@ void clippanel_create(postfish_mainpanel *mp, ...@@ -116,7 +116,7 @@ void clippanel_create(postfish_mainpanel *mp,
GtkWidget **windowbutton, GtkWidget **windowbutton,
GtkWidget **activebutton){ GtkWidget **activebutton){
int i; int i;
char *labels[2]={"10%","100%"}; char *labels[3]={"","10%","100%"};
float levels[3]={0.,10.,100.}; float levels[3]={0.,10.,100.};
int block_choices=0; int block_choices=0;
...@@ -151,13 +151,13 @@ void clippanel_create(postfish_mainpanel *mp, ...@@ -151,13 +151,13 @@ void clippanel_create(postfish_mainpanel *mp,
for(i=64;i<=input_size*2;i*=2)block_choices++; for(i=64;i<=input_size*2;i*=2)block_choices++;
{ {
float levels[9]={0,1,2,3,4,5,6,7,8}; float levels[9]={0,1,2,3,4,5,6,7,8};
char *labels[8]={"128","256","512","1024","2048","4096","8192","16384"}; char *labels[9]={"","128","256","512","1024","2048","4096","8192","16384"};
GtkWidget *table=gtk_table_new(4,2,0); GtkWidget *table=gtk_table_new(4,2,0);
GtkWidget *sliderbox=gtk_hbox_new(0,0); GtkWidget *sliderbox=gtk_hbox_new(0,0);
GtkWidget *fastlabel=gtk_label_new("fastest"); GtkWidget *fastlabel=gtk_label_new("fastest");
GtkWidget *qualitylabel=gtk_label_new("best"); GtkWidget *qualitylabel=gtk_label_new("best");
GtkWidget *slider=multibar_slider_new(block_choices-1,labels,levels,1); GtkWidget *slider=multibar_slider_new(block_choices,labels,levels,1);
GtkWidget *samplelabel=gtk_label_new("window sample width"); GtkWidget *samplelabel=gtk_label_new("window sample width");
GtkWidget *mslabel=gtk_label_new("window time width"); GtkWidget *mslabel=gtk_label_new("window time width");
GtkWidget *hzlabel=gtk_label_new("approximate lowest response"); GtkWidget *hzlabel=gtk_label_new("approximate lowest response");
...@@ -193,12 +193,12 @@ void clippanel_create(postfish_mainpanel *mp, ...@@ -193,12 +193,12 @@ void clippanel_create(postfish_mainpanel *mp,
/* set up convergence config */ /* set up convergence config */
{ {
float levels[7]={20,40,60,80,100,120,140}; float levels[7]={20,40,60,80,100,120,140};
char *labels[6]={"40","60","80","100","120","140"}; char *labels[7]={"","40","60","80","100","120","140"};
GtkWidget *table=gtk_table_new(2,2,0); GtkWidget *table=gtk_table_new(2,2,0);
GtkWidget *sliderbox=gtk_hbox_new(0,0); GtkWidget *sliderbox=gtk_hbox_new(0,0);
GtkWidget *fastlabel=gtk_label_new("fastest"); GtkWidget *fastlabel=gtk_label_new("fastest");
GtkWidget *qualitylabel=gtk_label_new("best"); GtkWidget *qualitylabel=gtk_label_new("best");
GtkWidget *slider=multibar_slider_new(6,labels,levels,1); GtkWidget *slider=multibar_slider_new(7,labels,levels,1);
GtkWidget *label=gtk_label_new("solution depth"); GtkWidget *label=gtk_label_new("solution depth");
depth_readout=readout_new("000dB"); depth_readout=readout_new("000dB");
...@@ -223,12 +223,12 @@ void clippanel_create(postfish_mainpanel *mp, ...@@ -223,12 +223,12 @@ void clippanel_create(postfish_mainpanel *mp,
/* set up limit config */ /* set up limit config */
{ {
float levels[7]={1,5,10,20,40,60,100}; float levels[7]={1,5,10,20,40,60,100};
char *labels[6]={"5","10","20","40","60","100"}; char *labels[7]={"","5","10","20","40","60","100"};
GtkWidget *table=gtk_table_new(2,2,0); GtkWidget *table=gtk_table_new(2,2,0);
GtkWidget *sliderbox=gtk_hbox_new(0,0); GtkWidget *sliderbox=gtk_hbox_new(0,0);
GtkWidget *fastlabel=gtk_label_new("fastest"); GtkWidget *fastlabel=gtk_label_new("fastest");
GtkWidget *qualitylabel=gtk_label_new("best"); GtkWidget *qualitylabel=gtk_label_new("best");
GtkWidget *slider=multibar_slider_new(6,labels,levels,1); GtkWidget *slider=multibar_slider_new(7,labels,levels,1);
GtkWidget *label=gtk_label_new("hard iteration limit"); GtkWidget *label=gtk_label_new("hard iteration limit");
limit_readout=readout_new("000%"); limit_readout=readout_new("000%");
...@@ -250,7 +250,7 @@ void clippanel_create(postfish_mainpanel *mp, ...@@ -250,7 +250,7 @@ void clippanel_create(postfish_mainpanel *mp,
} }
for(i=0;i<input_ch;i++){ for(i=0;i<input_ch;i++){
char *slabels[8]={".05",".1",".2",".3",".4", char *slabels[9]={"",".05",".1",".2",".3",".4",
".6",".8","1."}; ".6",".8","1."};
float slevels[9]={.01,.05,.1,.2,.3,.4,.6, float slevels[9]={.01,.05,.1,.2,.3,.4,.6,
.8,1.}; .8,1.};
...@@ -258,11 +258,11 @@ void clippanel_create(postfish_mainpanel *mp, ...@@ -258,11 +258,11 @@ void clippanel_create(postfish_mainpanel *mp,
char buffer[80]; char buffer[80];
clipslider *cs=calloc(1,sizeof(*cs)); clipslider *cs=calloc(1,sizeof(*cs));
GtkWidget *label; GtkWidget *label;
GtkWidget *slider=multibar_new(8,slabels,slevels,1, GtkWidget *slider=multibar_new(9,slabels,slevels,1,
HI_DECAY|ZERO_DAMP); HI_DECAY|ZERO_DAMP);
GtkWidget *readout=readout_new("0.00"); GtkWidget *readout=readout_new("0.00");
GtkWidget *readoutdB=readout_new("-40dB"); GtkWidget *readoutdB=readout_new("-40dB");
GtkWidget *bar=multibar_new(2,labels,levels,0, GtkWidget *bar=multibar_new(3,labels,levels,0,
HI_DECAY|ZERO_DAMP); HI_DECAY|ZERO_DAMP);
cs->slider=slider; cs->slider=slider;
......
...@@ -495,19 +495,19 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -495,19 +495,19 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
subpanel_generic *panel, subpanel_generic *panel,
multicompand_settings *ms){ multicompand_settings *ms){
int i; int i;
char *labels[14]={"130","120","110","100","90","80","70", char *labels[15]={"","130","120","110","100","90","80","70",
"60","50","40","30","20","10","0"}; "60","50","40","30","20","10","0"};
float levels[15]={-140,-130,-120,-110,-100,-90,-80,-70,-60,-50,-40, float levels[15]={-140,-130,-120,-110,-100,-90,-80,-70,-60,-50,-40,
-30,-20,-10,0}; -30,-20,-10,0};
float compand_levels[9]={.1,.25,.5,.6667,1,1.5,2,4,10}; float compand_levels[9]={.1,.25,.5,.6667,1,1.5,2,4,10};
char *compand_labels[8]={"4:1","2:1","1:1.5","1:1","1:1.5","1:2","1:4","1:10"}; char *compand_labels[89]={"","4:1","2:1","1:1.5","1:1","1:1.5","1:2","1:4","1:10"};
float timing_levels[6]={.5,1,10,100,1000,10000}; float timing_levels[6]={.5,1,10,100,1000,10000};
char *timing_labels[5]={"1ms","10ms","100ms","1s","10s"}; char *timing_labels[6]={"","1ms","10ms","100ms","1s","10s"};
float per_levels[9]={0,12.5,25,37.5,50,62.5,75,87.5,100}; float per_levels[9]={0,12.5,25,37.5,50,62.5,75,87.5,100};
char *per_labels[8]={"","25%","","50%","","75%","","100%"}; char *per_labels[9]={"0%","","25%","","50%","","75%","","100%"};
multi_panel_state *ps=calloc(1,sizeof(multi_panel_state)); multi_panel_state *ps=calloc(1,sizeof(multi_panel_state));
ps->inactive_updatep=1; ps->inactive_updatep=1;
...@@ -644,7 +644,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -644,7 +644,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("compand ratio:"); GtkWidget *label=gtk_label_new("compand ratio:");
GtkWidget *readout=readout_new("1.55:1"); GtkWidget *readout=readout_new("1.55:1");
GtkWidget *slider=multibar_slider_new(8,compand_labels,compand_levels,1); GtkWidget *slider=multibar_slider_new(9,compand_labels,compand_levels,1);
ps->under_compand.r=READOUT(readout); ps->under_compand.r=READOUT(readout);
ps->under_compand.v=&ps->ms->under_ratio; ps->under_compand.v=&ps->ms->under_ratio;
...@@ -667,7 +667,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -667,7 +667,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("attack/decay:"); GtkWidget *label=gtk_label_new("attack/decay:");
GtkWidget *readout0=readout_new(" 100ms"); GtkWidget *readout0=readout_new(" 100ms");
GtkWidget *readout1=readout_new(" 100ms"); GtkWidget *readout1=readout_new(" 100ms");
GtkWidget *slider=multibar_slider_new(5,timing_labels,timing_levels,2); GtkWidget *slider=multibar_slider_new(6,timing_labels,timing_levels,2);
ps->under_timing.r0=READOUT(readout0); ps->under_timing.r0=READOUT(readout0);
ps->under_timing.r1=READOUT(readout1); ps->under_timing.r1=READOUT(readout1);
...@@ -693,7 +693,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -693,7 +693,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("lookahead:"); GtkWidget *label=gtk_label_new("lookahead:");
GtkWidget *readout=readout_new("100%"); GtkWidget *readout=readout_new("100%");
GtkWidget *slider=multibar_slider_new(8,per_labels,per_levels,1); GtkWidget *slider=multibar_slider_new(9,per_labels,per_levels,1);
ps->under_lookahead.r=READOUT(readout); ps->under_lookahead.r=READOUT(readout);
ps->under_lookahead.v=&ps->ms->under_lookahead; ps->under_lookahead.v=&ps->ms->under_lookahead;
...@@ -740,7 +740,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -740,7 +740,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("compand ratio:"); GtkWidget *label=gtk_label_new("compand ratio:");
GtkWidget *readout=readout_new("1.55:1"); GtkWidget *readout=readout_new("1.55:1");
GtkWidget *slider=multibar_slider_new(8,compand_labels,compand_levels,1); GtkWidget *slider=multibar_slider_new(9,compand_labels,compand_levels,1);
ps->over_compand.r=READOUT(readout); ps->over_compand.r=READOUT(readout);
ps->over_compand.v=&ps->ms->over_ratio; ps->over_compand.v=&ps->ms->over_ratio;
...@@ -763,7 +763,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -763,7 +763,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("attack/decay:"); GtkWidget *label=gtk_label_new("attack/decay:");
GtkWidget *readout0=readout_new(" 100ms"); GtkWidget *readout0=readout_new(" 100ms");
GtkWidget *readout1=readout_new(" 100ms"); GtkWidget *readout1=readout_new(" 100ms");
GtkWidget *slider=multibar_slider_new(5,timing_labels,timing_levels,2); GtkWidget *slider=multibar_slider_new(6,timing_labels,timing_levels,2);
ps->over_timing.r0=READOUT(readout0); ps->over_timing.r0=READOUT(readout0);
ps->over_timing.r1=READOUT(readout1); ps->over_timing.r1=READOUT(readout1);
...@@ -789,7 +789,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -789,7 +789,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("lookahead:"); GtkWidget *label=gtk_label_new("lookahead:");
GtkWidget *readout=readout_new("100%"); GtkWidget *readout=readout_new("100%");
GtkWidget *slider=multibar_slider_new(8,per_labels,per_levels,1); GtkWidget *slider=multibar_slider_new(9,per_labels,per_levels,1);
ps->over_lookahead.r=READOUT(readout); ps->over_lookahead.r=READOUT(readout);
ps->over_lookahead.v=&ps->ms->over_lookahead; ps->over_lookahead.v=&ps->ms->over_lookahead;
...@@ -832,7 +832,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -832,7 +832,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("compand ratio:"); GtkWidget *label=gtk_label_new("compand ratio:");
GtkWidget *readout=readout_new("1.55:1"); GtkWidget *readout=readout_new("1.55:1");
GtkWidget *slider=multibar_slider_new(8,compand_labels,compand_levels,1); GtkWidget *slider=multibar_slider_new(9,compand_labels,compand_levels,1);
ps->base_compand.r=READOUT(readout); ps->base_compand.r=READOUT(readout);
ps->base_compand.v=&ps->ms->base_ratio; ps->base_compand.v=&ps->ms->base_ratio;
...@@ -855,7 +855,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -855,7 +855,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("attack/decay:"); GtkWidget *label=gtk_label_new("attack/decay:");
GtkWidget *readout0=readout_new(" 100ms"); GtkWidget *readout0=readout_new(" 100ms");
GtkWidget *readout1=readout_new(" 100ms"); GtkWidget *readout1=readout_new(" 100ms");
GtkWidget *slider=multibar_slider_new(5,timing_labels,timing_levels,2); GtkWidget *slider=multibar_slider_new(6,timing_labels,timing_levels,2);
ps->base_timing.r0=READOUT(readout0); ps->base_timing.r0=READOUT(readout0);
ps->base_timing.r1=READOUT(readout1); ps->base_timing.r1=READOUT(readout1);
...@@ -884,7 +884,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -884,7 +884,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
ps->bars[i].readoutu=readout_new(" +0"); ps->bars[i].readoutu=readout_new(" +0");
ps->bars[i].readouto=readout_new(" +0"); ps->bars[i].readouto=readout_new(" +0");
ps->bars[i].slider=multibar_new(14,labels,levels,2,HI_DECAY|LO_DECAY|LO_ATTACK); ps->bars[i].slider=multibar_new(15,labels,levels,2,HI_DECAY|LO_DECAY|LO_ATTACK);
ps->bars[i].number=i; ps->bars[i].number=i;
ps->bars[i].mp=ps; ps->bars[i].mp=ps;
ps->bars[i].label=label; ps->bars[i].label=label;
...@@ -911,7 +911,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp, ...@@ -911,7 +911,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
{ {
GtkWidget *label=gtk_label_new("average"); GtkWidget *label=gtk_label_new("average");
ps->bars[multicomp_freqs_max].slider=multibar_slider_new(14,labels,levels,2); ps->bars[multicomp_freqs_max].slider=multibar_slider_new(15,labels,levels,2);
multibar_callback(MULTIBAR(ps->bars[multicomp_freqs_max].slider),average_change,ps); multibar_callback(MULTIBAR(ps->bars[multicomp_freqs_max].slider),average_change,ps);
...@@ -982,15 +982,15 @@ void compandpanel_feedback(int displayit){ ...@@ -982,15 +982,15 @@ void compandpanel_feedback(int displayit){
rmsfeed=malloc(sizeof(*rmsfeed)*multicomp_freqs_max); rmsfeed=malloc(sizeof(*rmsfeed)*multicomp_freqs_max);
for(i=0;i<multicomp_freqs_max;i++){ for(i=0;i<multicomp_freqs_max;i++){
peakfeed[i]=malloc(sizeof(**peakfeed)*input_ch); peakfeed[i]=malloc(sizeof(**peakfeed)*max(input_ch,OUTPUT_CHANNELS));
rmsfeed[i]=malloc(sizeof(**rmsfeed)*input_ch); rmsfeed[i]=malloc(sizeof(**rmsfeed)*max(input_ch,OUTPUT_CHANNELS));
} }
} }
if(pull_multicompand_feedback_master(peakfeed,rmsfeed,&bands)==1) if(pull_multicompand_feedback_master(peakfeed,rmsfeed,&bands)==1)
for(i=0;i<bands;i++) for(i=0;i<bands;i++)
multibar_set(MULTIBAR(master_panel->bars[i].slider),rmsfeed[i],peakfeed[i], multibar_set(MULTIBAR(master_panel->bars[i].slider),rmsfeed[i],peakfeed[i],
input_ch,(displayit && multi_master_set.panel_visible)); OUTPUT_CHANNELS,(displayit && multi_master_set.panel_visible));
/* channel panels are a bit different; we want each in its native color */ /* channel panels are a bit different; we want each in its native color */
if(pull_multicompand_feedback_channel(peakfeed,rmsfeed,&bands)==1){ if(pull_multicompand_feedback_channel(peakfeed,rmsfeed,&bands)==1){
......
...@@ -156,9 +156,7 @@ int declip_load(void){ ...@@ -156,9 +156,7 @@ int declip_load(void){
for(i=0;i<input_ch;i++) for(i=0;i<input_ch;i++)
chtrigger[i]=1.; chtrigger[i]=1.;
out.size=input_size;
out.channels=input_ch; out.channels=input_ch;
out.rate=input_rate;
out.data=malloc(input_ch*sizeof(*out.data)); out.data=malloc(input_ch*sizeof(*out.data));
for(i=0;i<input_ch;i++) for(i=0;i<input_ch;i++)
out.data[i]=malloc(input_size*sizeof(**out.data)); out.data[i]=malloc(input_size*sizeof(**out.data));
...@@ -363,7 +361,7 @@ time_linkage *declip_read(time_linkage *in){ ...@@ -363,7 +361,7 @@ time_linkage *declip_read(time_linkage *in){
memcpy(lap[i],work+blocksize,sizeof(*work)*blocksize/2); memcpy(lap[i],work+blocksize,sizeof(*work)*blocksize/2);
/* now iterate the pieces purely within in */ /* now iterate the pieces purely within in */
for(j=0;j+blocksize<=in->size;j+=blocksize/2){ for(j=0;j+blocksize<=input_size;j+=blocksize/2){
memset(work,0,sizeof(*work)*blocksize); memset(work,0,sizeof(*work)*blocksize);
memcpy(work+blocksize/2,in->data[i]+j,sizeof(*work)*blocksize); memcpy(work+blocksize/2,in->data[i]+j,sizeof(*work)*blocksize);
memset(work+blocksize+blocksize/2,0,sizeof(*work)*blocksize/2); memset(work+blocksize+blocksize/2,0,sizeof(*work)*blocksize/2);
...@@ -394,10 +392,10 @@ time_linkage *declip_read(time_linkage *in){ ...@@ -394,10 +392,10 @@ time_linkage *declip_read(time_linkage *in){
cache_active=in->active; cache_active=in->active;
fillstate=1; fillstate=1;
out.samples=0; out.samples=0;
if(in->samples==in->size)break; if(in->samples==input_size)break;
for(i=0;i<input_ch;i++) for(i=0;i<input_ch;i++)
memset(in->data[i],0,sizeof(**in->data)*in->size); memset(in->data[i],0,sizeof(**in->data)*input_size);
in->samples=0; in->samples=0;
/* fall through */ /* fall through */
...@@ -589,7 +587,7 @@ time_linkage *declip_read(time_linkage *in){ ...@@ -589,7 +587,7 @@ time_linkage *declip_read(time_linkage *in){
/* declip */ /* declip */
if(declip_prev_active[i]){ if(declip_prev_active[i]){
for(j=0;j+blocksize<=in->size;j+=blocksize/2){ for(j=0;j+blocksize<=input_size;j+=blocksize/2){
memset(work,0,sizeof(*work)*blocksize); memset(work,0,sizeof(*work)*blocksize);
memcpy(work+blocksize/2,cache[i]+j,sizeof(*work)*blocksize); memcpy(work+blocksize/2,cache[i]+j,sizeof(*work)*blocksize);
memset(work+blocksize+blocksize/2,0,sizeof(*work)*blocksize/2); memset(work+blocksize+blocksize/2,0,sizeof(*work)*blocksize/2);
...@@ -607,7 +605,7 @@ time_linkage *declip_read(time_linkage *in){ ...@@ -607,7 +605,7 @@ time_linkage *declip_read(time_linkage *in){
} }
} }
} }
if(out.samples<out.size)fillstate=2; if(out.samples<input_size)fillstate=2;
break; break;
case 2: /* we've pushed out EOF already */ case 2: /* we've pushed out EOF already */
out.samples=0; out.samples=0;
...@@ -622,7 +620,7 @@ time_linkage *declip_read(time_linkage *in){ ...@@ -622,7 +620,7 @@ time_linkage *declip_read(time_linkage *in){
comes in */ comes in */
{ {
int tozero=out.size-out.samples;