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 @@
# Fuck the horse it rode in on
# 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
LD=gcc
INSTALL=install
PREFIX=/usr/local
BINDIR=$PREFIX/bin
ETCDIR=/etc
ETCDIR=/etc/postfish
MANDIR=$PREFIX/man
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 \
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 \
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 \
limit.o limitpanel.o mute.o mutedummy.o
GCF = `pkg-config --cflags gtk+-2.0` -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
limit.o limitpanel.o mute.o mixpanel.o mix.o reverb.o
GCF = -DETCDIR=\\\"$(ETCDIR)\\\" `pkg-config --cflags gtk+-2.0` -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
all:
$(MAKE) target CFLAGS="-O3 -ffast-math -fomit-frame-pointer $(GCF) $(ADD_DEF)"
......@@ -30,27 +38,44 @@ debug:
$(MAKE) target CFLAGS="-g -Wall -W -Wno-unused-parameter -D__NO_MATH_INLINES $(GCF) $(ADD_DEF)"
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:
rm -f $(OBJ) *.d *.d.* gmon.out
rm -f $(OBJ) *.d *.d.* gmon.out postfish
distclean: clean
rm -f postfish-wisdomrc
%.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)
endif
target: $(OBJ)
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
install:
install: target
$(INSTALL) -d -m 0755 $(BINDIR)
$(INSTALL) -m 0755 postfish $(BINDIR)
$(INSTALL) -d -m 0755 $(ETCDIR)
$(INSTALL) -m 0644 postfish-gtkrc $(ETCDIR)
$(INSTALL) -m 0644 postfish-wisdomrc $(ETCDIR)
# $(INSTALL) -d -m 0755 $(MANDIR)
# $(INSTALL) -d -m 0755 $(MANDIR)/man1
# $(INSTALL) -m 0644 postfish.1 $(MANDIR)/man1
......@@ -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,
iir_filter *decay){
double d_c0=decay->c[0];
......
......@@ -33,6 +33,7 @@ typedef struct {
float alpha;
float Hz;
float ms;
int samples;
} iir_filter;
static inline long impulse_ahead2(float alpha){
......@@ -84,6 +85,8 @@ extern void compute_iir_freefall1(float *x, int n, iir_state *is,
iir_filter *decay);
extern void compute_iir_freefall2(float *x, int n, iir_state *is,
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,
iir_filter *decay);
extern void compute_iir_freefall4(float *x, int n, iir_state *is,
......
......@@ -116,7 +116,7 @@ void clippanel_create(postfish_mainpanel *mp,
GtkWidget **windowbutton,
GtkWidget **activebutton){
int i;
char *labels[2]={"10%","100%"};
char *labels[3]={"","10%","100%"};
float levels[3]={0.,10.,100.};
int block_choices=0;
......@@ -151,13 +151,13 @@ void clippanel_create(postfish_mainpanel *mp,
for(i=64;i<=input_size*2;i*=2)block_choices++;
{
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 *sliderbox=gtk_hbox_new(0,0);
GtkWidget *fastlabel=gtk_label_new("fastest");
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 *mslabel=gtk_label_new("window time width");
GtkWidget *hzlabel=gtk_label_new("approximate lowest response");
......@@ -193,12 +193,12 @@ void clippanel_create(postfish_mainpanel *mp,
/* set up convergence config */
{
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 *sliderbox=gtk_hbox_new(0,0);
GtkWidget *fastlabel=gtk_label_new("fastest");
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");
depth_readout=readout_new("000dB");
......@@ -223,12 +223,12 @@ void clippanel_create(postfish_mainpanel *mp,
/* set up limit config */
{
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 *sliderbox=gtk_hbox_new(0,0);
GtkWidget *fastlabel=gtk_label_new("fastest");
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");
limit_readout=readout_new("000%");
......@@ -250,7 +250,7 @@ void clippanel_create(postfish_mainpanel *mp,
}
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."};
float slevels[9]={.01,.05,.1,.2,.3,.4,.6,
.8,1.};
......@@ -258,11 +258,11 @@ void clippanel_create(postfish_mainpanel *mp,
char buffer[80];
clipslider *cs=calloc(1,sizeof(*cs));
GtkWidget *label;
GtkWidget *slider=multibar_new(8,slabels,slevels,1,
GtkWidget *slider=multibar_new(9,slabels,slevels,1,
HI_DECAY|ZERO_DAMP);
GtkWidget *readout=readout_new("0.00");
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);
cs->slider=slider;
......
......@@ -495,19 +495,19 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
subpanel_generic *panel,
multicompand_settings *ms){
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"};
float levels[15]={-140,-130,-120,-110,-100,-90,-80,-70,-60,-50,-40,
-30,-20,-10,0};
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};
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};
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));
ps->inactive_updatep=1;
......@@ -644,7 +644,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("compand ratio:");
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.v=&ps->ms->under_ratio;
......@@ -667,7 +667,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("attack/decay:");
GtkWidget *readout0=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.r1=READOUT(readout1);
......@@ -693,7 +693,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("lookahead:");
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.v=&ps->ms->under_lookahead;
......@@ -740,7 +740,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("compand ratio:");
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.v=&ps->ms->over_ratio;
......@@ -763,7 +763,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("attack/decay:");
GtkWidget *readout0=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.r1=READOUT(readout1);
......@@ -789,7 +789,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("lookahead:");
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.v=&ps->ms->over_lookahead;
......@@ -832,7 +832,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("compand ratio:");
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.v=&ps->ms->base_ratio;
......@@ -855,7 +855,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new("attack/decay:");
GtkWidget *readout0=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.r1=READOUT(readout1);
......@@ -884,7 +884,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
ps->bars[i].readoutu=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].mp=ps;
ps->bars[i].label=label;
......@@ -911,7 +911,7 @@ static multi_panel_state *compandpanel_create(postfish_mainpanel *mp,
{
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);
......@@ -982,15 +982,15 @@ void compandpanel_feedback(int displayit){
rmsfeed=malloc(sizeof(*rmsfeed)*multicomp_freqs_max);
for(i=0;i<multicomp_freqs_max;i++){
peakfeed[i]=malloc(sizeof(**peakfeed)*input_ch);
rmsfeed[i]=malloc(sizeof(**rmsfeed)*input_ch);
peakfeed[i]=malloc(sizeof(**peakfeed)*max(input_ch,OUTPUT_CHANNELS));
rmsfeed[i]=malloc(sizeof(**rmsfeed)*max(input_ch,OUTPUT_CHANNELS));
}
}
if(pull_multicompand_feedback_master(peakfeed,rmsfeed,&bands)==1)
for(i=0;i<bands;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 */
if(pull_multicompand_feedback_channel(peakfeed,rmsfeed,&bands)==1){
......
......@@ -156,9 +156,7 @@ int declip_load(void){
for(i=0;i<input_ch;i++)
chtrigger[i]=1.;
out.size=input_size;
out.channels=input_ch;
out.rate=input_rate;
out.data=malloc(input_ch*sizeof(*out.data));
for(i=0;i<input_ch;i++)
out.data[i]=malloc(input_size*sizeof(**out.data));
......@@ -363,7 +361,7 @@ time_linkage *declip_read(time_linkage *in){
memcpy(lap[i],work+blocksize,sizeof(*work)*blocksize/2);
/* 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);
memcpy(work+blocksize/2,in->data[i]+j,sizeof(*work)*blocksize);
memset(work+blocksize+blocksize/2,0,sizeof(*work)*blocksize/2);
......@@ -394,10 +392,10 @@ time_linkage *declip_read(time_linkage *in){
cache_active=in->active;
fillstate=1;
out.samples=0;
if(in->samples==in->size)break;
if(in->samples==input_size)break;
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;
/* fall through */
......@@ -589,7 +587,7 @@ time_linkage *declip_read(time_linkage *in){
/* declip */
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);
memcpy(work+blocksize/2,cache[i]+j,sizeof(*work)*blocksize);
memset(work+blocksize+blocksize/2,0,sizeof(*work)*blocksize/2);
......@@ -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;
case 2: /* we've pushed out EOF already */
out.samples=0;
......@@ -622,7 +620,7 @@ time_linkage *declip_read(time_linkage *in){
comes in */
{
int tozero=out.size-out.samples;
int tozero=input_size-out.samples;
if(tozero)
for(i=0;i<out.channels;i++)
memset(out.data[i]+out.samples,0,sizeof(**out.data)*tozero);
......
......@@ -32,6 +32,7 @@ extern int input_size;
typedef struct{
freq_state eq;
int ch;
} eq_state;
......@@ -42,7 +43,6 @@ static freq_class_setup fc;
static eq_state master_state;
static eq_state channel_state;
/* accessed only in playback thread/setup */
int pull_eq_feedback_master(float **peak,float **rms){
return pull_freq_feedback(&master_state.eq,peak,rms);
......@@ -53,15 +53,17 @@ int pull_eq_feedback_channel(float **peak,float **rms){
}
/* called only by initial setup */
int eq_load(void){
int eq_load(int outch){
int i;
eq_channel_set=calloc(input_ch,sizeof(*eq_channel_set));
freq_class_load(&fc,eq_freq_list,eq_freqs);
freq_load(&master_state.eq,&fc);
freq_load(&channel_state.eq,&fc);
freq_load(&master_state.eq,&fc,outch);
master_state.ch=outch;
freq_load(&channel_state.eq,&fc,input_ch);
channel_state.ch=input_ch;
eq_master_set.curve_dirty=1;
......@@ -118,11 +120,12 @@ static void workfunc_m(float *data, int ch){
/* called only by playback thread */
time_linkage *eq_read_master(time_linkage *in){
int active[input_ch];
int visible[input_ch];
eq_state *eq=&master_state;
int active[eq->ch];
int visible[eq->ch];
int i;
for(i=0;i<input_ch;i++){
for(i=0;i<eq->ch;i++){
active[i]=eq_master_set.panel_active;
visible[i]=eq_master_set.panel_visible;
}
......@@ -131,11 +134,12 @@ time_linkage *eq_read_master(time_linkage *in){
}
time_linkage *eq_read_channel(time_linkage *in){
int active[input_ch];
int visible[input_ch];
eq_state *eq=&channel_state;
int active[eq->ch];
int visible[eq->ch];
int i;
for(i=0;i<input_ch;i++){
for(i=0;i<eq->ch;i++){
active[i]=eq_channel_set[i].panel_active;
visible[i]=eq_channel_set[i].panel_visible;
}
......
......@@ -51,7 +51,7 @@ static char * const eq_freq_labels[eq_freqs]={
extern int pull_eq_feedback_master(float **peak,float **rms);
extern int pull_eq_feedback_channel(float **peak,float **rms);
extern int eq_load(void);
extern int eq_load(int ch);
extern int eq_reset();
extern void eq_set(eq_settings *eq,int freq, float value);
extern time_linkage *eq_read_master(time_linkage *in);
......
......@@ -66,7 +66,7 @@ static bar *eqpanel_create_helper(postfish_mainpanel *mp,
eq_settings *es){
int i;
char *labels[15]={"110","100","90","80","70","60","50","40",
char *labels[16]={"","110","100","90","80","70","60","50","40",
"30","20","10","0","+10","+20","+30"};
float levels[16]={-120,-110,-100,-90,-80,-70,-60,-50,-40,
-30,-20,-10,0,10,20,30};
......@@ -81,7 +81,7 @@ static bar *eqpanel_create_helper(postfish_mainpanel *mp,
gtk_widget_set_name(label,"smallmarker");
bars[i].readout=readout_new("+00dB");
bars[i].slider=multibar_new(15,labels,levels,1,
bars[i].slider=multibar_new(16,labels,levels,1,
LO_DECAY|HI_DECAY|LO_ATTACK|HI_ATTACK);
bars[i].number=i;
bars[i].s=es;
......@@ -125,7 +125,7 @@ void eqpanel_create_channel(postfish_mainpanel *mp,
GtkWidget **windowbutton,
GtkWidget **activebutton){
int i;
c_bars=malloc(input_ch*sizeof(*m_bars));
c_bars=malloc(input_ch*sizeof(*c_bars));
/* a panel for each channel */
for(i=0;i<input_ch;i++){
......@@ -154,15 +154,15 @@ void eqpanel_feedback(int displayit){
rmsfeed=malloc(sizeof(*rmsfeed)*eq_freqs);
for(i=0;i<eq_freqs;i++){
peakfeed[i]=malloc(sizeof(**peakfeed)*input_ch);
rmsfeed[i]=malloc(sizeof(**rmsfeed)*input_ch);
peakfeed[i]=malloc(sizeof(**peakfeed)*max(input_ch,OUTPUT_CHANNELS));
rmsfeed[i]=malloc(sizeof(**rmsfeed)*max(input_ch,OUTPUT_CHANNELS));
}
}
if(pull_eq_feedback_master(peakfeed,rmsfeed)==1)
for(i=0;i<eq_freqs;i++)
multibar_set(MULTIBAR(m_bars[i].slider),rmsfeed[i],peakfeed[i],
input_ch,(displayit && eq_master_set.panel_visible));
OUTPUT_CHANNELS,(displayit && eq_master_set.panel_visible));
if(pull_eq_feedback_channel(peakfeed,rmsfeed)==1){
......
This diff is collapsed.
......@@ -71,7 +71,7 @@ typedef struct {
extern int pull_freq_feedback(freq_state *ff,float **peak,float **rms);
extern int freq_class_load(freq_class_setup *f,const float *frequencies, int bands);
extern int freq_load(freq_state *f,freq_class_setup *fc);
extern int freq_load(freq_state *f,freq_class_setup *fc,int ch);
extern int freq_reset(freq_state *f);
extern time_linkage *freq_read(time_linkage *in,
......
......@@ -327,23 +327,23 @@ int input_load(int n,char *list[]){
4000: 256 */
if(rate<6000){
input_size=out.size=256;
input_size=256;
}else if(rate<15000){
input_size=out.size=512;
input_size=512;
}else if(rate<25000){
input_size=out.size=1024;
input_size=1024;
}else if(rate<50000){
input_size=out.size=2048;
input_size=2048;
}else if(rate<100000){
input_size=out.size=4096;
input_size=4096;
}else
input_size=out.size=8192;
input_size=8192;
input_ch=out.channels=ch;
input_rate=out.rate=rate;
input_rate=rate;
out.data=malloc(sizeof(*out.data)*ch);
for(i=0;i<ch;i++)
out.data[i]=malloc(sizeof(*out.data[0])*out.size);
out.data[i]=malloc(sizeof(*out.data[0])*input_size);
return 0;
}
......@@ -423,7 +423,7 @@ int pull_input_feedback(float *peak,float *rms,off_t *cursor){
time_linkage *input_read(void){
int read_b=0,i,j,k;
int toread_b=out.size*out.channels*inbytes;
int toread_b=input_size*out.channels*inbytes;
unsigned char *readbuf;
float *rms=alloca(sizeof(*rms)*(out.channels+2));
float *peak=alloca(sizeof(*peak)*(out.channels+2));
......@@ -551,7 +551,7 @@ time_linkage *input_read(void){
tidy_up:
{
int tozero=out.size-out.samples;
int tozero=input_size-out.samples;
if(tozero)
for(j=0;j<out.channels;j++)
memset(out.data[j]+out.samples,0,sizeof(**out.data)*tozero);
......
......@@ -28,7 +28,6 @@
extern int input_size;
extern int input_rate;
extern int input_ch;
sig_atomic_t limit_active;
sig_atomic_t limit_visible;
......@@ -67,24 +66,22 @@ int pull_limit_feedback(float *peak,float *att){
if(!f)return 0;
if(peak)
memcpy(peak,f->peak,sizeof(*peak)*input_ch);
memcpy(peak,f->peak,sizeof(*peak)*limitstate.out.channels);
if(att)
memcpy(att,f->att,sizeof(*att)*input_ch);
memcpy(att,f->att,sizeof(*att)*limitstate.out.channels);
feedback_old(&limitstate.feedpool,(feedback_generic *)f);
return 1;
}
/* called only by initial setup */
int limit_load(void){
int limit_load(int ch){
int i;
memset(&limitstate,0,sizeof(limitstate));
limitstate.iir=calloc(input_ch,sizeof(*limitstate.iir));
limitstate.out.size=input_size;
limitstate.out.channels=input_ch;
limitstate.out.rate=input_rate;
limitstate.out.data=malloc(input_ch*sizeof(*limitstate.out.data));
for(i=0;i<input_ch;i++)
limitstate.iir=calloc(ch,sizeof(*limitstate.iir));
limitstate.out.channels=ch;
limitstate.out.data=malloc(ch*sizeof(*limitstate.out.data));
for(i=0;i<ch;i++)
limitstate.out.data[i]=malloc(input_size*sizeof(**limitstate.out.data));
window=malloc(input_size*sizeof(*window));
......@@ -109,10 +106,10 @@ static void filter_set(float msec,
}
/* called only in playback thread */
int limit_reset(void ){
int limit_reset(void){
/* reset cached pipe state */
while(pull_limit_feedback(NULL,NULL));
memset(limitstate.iir,0,input_ch*sizeof(&limitstate.iir));
memset(limitstate.iir,0,limitstate.out.channels*sizeof(&limitstate.iir));
limitstate.initted=0;
return 0;
}
......@@ -123,8 +120,9 @@ static inline float limit_knee(float x,float d){
time_linkage *limit_read(time_linkage *in){
float peakfeed[input_ch];
float attfeed[input_ch];
int ch=limitstate.out.channels;
float peakfeed[ch];
float attfeed[ch];
int activeC=limit_active;
int activeP=limitstate.prev_active;
......@@ -154,7 +152,7 @@ time_linkage *limit_read(time_linkage *in){
depth=depth*.2;
depth*=depth;
for(i=0;i<input_ch;i++){
for(i=0;i<ch;i++){
localpeak=0.;
localatt=0.;
......@@ -176,8 +174,7 @@ time_linkage *limit_read(time_linkage *in){
x[k]=att;
}
compute_iir_freefall2(x,input_size,limitstate.iir+i,&limitstate.decay);
compute_iir_decayonly2(x,input_size,limitstate.iir+i,&limitstate.decay);
for(k=0;k<in->samples;k++)
......@@ -225,10 +222,10 @@ time_linkage *limit_read(time_linkage *in){
(limit_feedback *)feedback_new(&limitstate.feedpool,new_limit_feedback);
if(!ff->peak)
ff->peak=malloc(input_ch*sizeof(*ff->peak));
ff->peak=malloc(ch*sizeof(*ff->peak));
if(!ff->att)
ff->att=malloc(input_ch*sizeof(*ff->att));
ff->att=malloc(ch*sizeof(*ff->att));
memcpy(ff->peak,peakfeed,sizeof(peakfeed));
memcpy(ff->att,attfeed,sizeof(attfeed));
......@@ -237,7 +234,7 @@ time_linkage *limit_read(time_linkage *in){
}
{
int tozero=limitstate.out.size-limitstate.out.samples;
int tozero=input_size-limitstate.out.samples;
if(tozero)
for(i=0;i<limitstate.out.channels;i++)
memset(limitstate.out.data[i]+limitstate.out.samples,0,sizeof(**limitstate.out.data)*tozero);
......
......@@ -28,6 +28,6 @@ typedef struct{
} limit_settings;
extern int pull_limit_feedback(float *peak,float *att);
extern int limit_load(void);
extern int limit_load(int ch);
extern int limit_reset(void);
extern time_linkage *limit_read(time_linkage *in);
......@@ -34,7 +34,6 @@