Commit c196b9d4 authored by Monty Montgomery's avatar Monty Montgomery

So... this is a big patch from about a month ago, but I was afraid to

commit it because Jack would be angry and come steal me Lucky Charms.

Jack likes me again and me Lucky Charms are ssafely hidden, thus the
patch can now safely go into SVN.



git-svn-id: https://svn.xiph.org/trunk/postfish@6914 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 165ceb33
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# and Fuck its little dog Libtool too # and Fuck its little dog Libtool too
# Use the below line to build for PowerPC
# The PPC build *must* use -maltivec, even if the target is a non-altivec machine # The PPC build *must* use -maltivec, even if the target is a non-altivec machine
#ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 -maltivec #ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 -maltivec
...@@ -36,8 +37,7 @@ OBJ = main.o mainpanel.o multibar.o readout.o input.o output.o clippanel.o \ ...@@ -36,8 +37,7 @@ OBJ = main.o mainpanel.o multibar.o readout.o input.o output.o clippanel.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 mixpanel.o mix.o reverb.o reverbpanel.o \ limit.o limitpanel.o mute.o mixpanel.o mix.o reverb.o reverbpanel.o \
outpanel.o config.o outpanel.o config.o
#GCF = -DETCDIR=\\\"$(ETCDIR)\\\" `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
GCF = -DETCDIR=\\\"$(ETCDIR)\\\" `pkg-config --cflags gtk+-2.0`
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)"
...@@ -76,7 +76,7 @@ endif ...@@ -76,7 +76,7 @@ endif
target: $(OBJ) postfish-wisdomrc 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: target install: target
$(INSTALL) -d -m 0755 $(BINDIR) $(INSTALL) -d -m 0755 $(BINDIR)
......
...@@ -196,6 +196,10 @@ void compute_iir_fast_attack2(float *x, int n, iir_state *is, ...@@ -196,6 +196,10 @@ void compute_iir_fast_attack2(float *x, int n, iir_state *is,
int state=is->state; int state=is->state;
int i=0; int i=0;
if(zerome(y0) && zerome(y1)){
y0=y1=0.;
}
if(x[0]>y0)state=0; if(x[0]>y0)state=0;
while(i<n){ while(i<n){
...@@ -253,6 +257,10 @@ void compute_iir_freefall1(float *x, int n, iir_state *is, ...@@ -253,6 +257,10 @@ void compute_iir_freefall1(float *x, int n, iir_state *is,
double y0=is->y[0]; double y0=is->y[0];
int i=0; int i=0;
if(zerome(y0)){
y0=0.;
}
while(i<n){ while(i<n){
double yd; double yd;
...@@ -281,6 +289,10 @@ void compute_iir_freefall2(float *x, int n, iir_state *is, ...@@ -281,6 +289,10 @@ void compute_iir_freefall2(float *x, int n, iir_state *is,
double y1=is->y[1]; double y1=is->y[1];
int i=0; int i=0;
if(zerome(y0) && zerome(y1)){
y0=y1=0.;
}
while(i<n){ while(i<n){
double yd; double yd;
if(y1<y0)y1=y0; // slope fixup if(y1<y0)y1=y0; // slope fixup
...@@ -314,6 +326,10 @@ void compute_iir_decayonly2(float *x, int n, iir_state *is, ...@@ -314,6 +326,10 @@ void compute_iir_decayonly2(float *x, int n, iir_state *is,
double y1=is->y[1]; double y1=is->y[1];
int i=0; int i=0;
if(zerome(y0) && zerome(y1)){
y0=y1=0.;
}
while(i<n){ while(i<n){
double yd; double yd;
...@@ -346,6 +362,10 @@ void compute_iir_freefall3(float *x, int n, iir_state *is, ...@@ -346,6 +362,10 @@ void compute_iir_freefall3(float *x, int n, iir_state *is,
double x2=is->x[2],y2=is->y[2]; double x2=is->x[2],y2=is->y[2];
int i=0; int i=0;
if(zerome(y0) && zerome(y1) && zerome(y2)){
y0=y1=y2=0.;
}
while(i<n){ while(i<n){
double yd; double yd;
if(y1<y0)y1=y0; // slope fixup if(y1<y0)y1=y0; // slope fixup
...@@ -381,6 +401,10 @@ void compute_iir_freefall4(float *x, int n, iir_state *is, ...@@ -381,6 +401,10 @@ void compute_iir_freefall4(float *x, int n, iir_state *is,
double x3=is->x[3],y3=is->y[3]; double x3=is->x[3],y3=is->y[3];
int i=0; int i=0;
if(zerome(y0) && zerome(y1) && zerome(y2) && zerome(y3)){
y0=y1=y2=y3=0.;
}
while(i<n){ while(i<n){
double yd; double yd;
if(y1<y0)y1=y0; // slope fixup if(y1<y0)y1=y0; // slope fixup
...@@ -419,6 +443,10 @@ void compute_iir_symmetric2(float *x, int n, iir_state *is, ...@@ -419,6 +443,10 @@ void compute_iir_symmetric2(float *x, int n, iir_state *is,
int i=0; int i=0;
if(zerome(y0) && zerome(y1)){
y0=y1=0.;
}
while(i<n){ while(i<n){
double yd= (x[i]+x0*2.+x1)/g + y0*c0+y1*c1; double yd= (x[i]+x0*2.+x1)/g + y0*c0+y1*c1;
x1=x0;x0=x[i]; x1=x0;x0=x[i];
...@@ -446,6 +474,10 @@ void compute_iir_symmetric3(float *x, int n, iir_state *is, ...@@ -446,6 +474,10 @@ void compute_iir_symmetric3(float *x, int n, iir_state *is,
int i=0; int i=0;
if(zerome(y0) && zerome(y1) && zerome(y2)){
y0=y1=y2=0.;
}
while(i<n){ while(i<n){
double yd= (x[i]+(x0+x1)*3.+x2)/g + y0*c0+y1*c1+y2*c2; double yd= (x[i]+(x0+x1)*3.+x2)/g + y0*c0+y1*c1+y2*c2;
x2=x1;x1=x0;x0=x[i]; x2=x1;x1=x0;x0=x[i];
...@@ -474,6 +506,10 @@ void compute_iir_symmetric4(float *x, int n, iir_state *is, ...@@ -474,6 +506,10 @@ void compute_iir_symmetric4(float *x, int n, iir_state *is,
int i=0; int i=0;
if(zerome(y0) && zerome(y1) && zerome(y2) && zerome(y3)){
y0=y1=y2=y3=0.;
}
while(i<n){ while(i<n){
double yd= (x[i]+(x0+x2)*4.+x1*6.+x3)/g + double yd= (x[i]+(x0+x2)*4.+x1*6.+x3)/g +
y0*c0+y1*c1+y2*c2+y3*c3; y0*c0+y1*c1+y2*c2+y3*c3;
......
...@@ -201,10 +201,11 @@ int declip_reset(void){ ...@@ -201,10 +201,11 @@ int declip_reset(void){
return 0; return 0;
} }
int noisy=0;
static void sliding_bark_average(float *f,int n,float width){ static void sliding_bark_average(float *f,int n,float width){
int i=0; int i=0;
float acc=0.,del=0.; double acc=0.,del=0.;
float sec[hipad+1]; double sec[hipad+1];
memset(sec,0,sizeof(sec)); memset(sec,0,sizeof(sec));
...@@ -233,7 +234,6 @@ static void sliding_bark_average(float *f,int n,float width){ ...@@ -233,7 +234,6 @@ static void sliding_bark_average(float *f,int n,float width){
f[(i<<1)+1]=f[i<<1]=1./(acc*acc); f[(i<<1)+1]=f[i<<1]=1./(acc*acc);
del+=sec[i+lopad]; del+=sec[i+lopad];
acc+=del; acc+=del;
} }
f[n+1]=f[n]=f[n-1]; f[n+1]=f[n]=f[n-1];
} }
...@@ -244,7 +244,15 @@ static void declip(int blocksize,float trigger, ...@@ -244,7 +244,15 @@ static void declip(int blocksize,float trigger,
int *runningtotal, int *runningcount){ int *runningtotal, int *runningcount){
float flag[blocksize*2]; float flag[blocksize*2];
int iterbound,i,count=0; int iterbound,i,count=0;
/* too many apps screw up proper output scaling, so previously
clipped audio ends up getting rounded to just short of the rail
upon export. To avoid users accidentally shooting themselves in
the foot, trigger clipping at -.05dB rather than 0dB even if 0dB
is selected. This corresponds to mis-rounding 8 bit audio by 1.5
steps.*/
if(trigger>.99426)trigger=.99426;
for(i=blocksize/2;i<blocksize*3/2;i++){ for(i=blocksize/2;i<blocksize*3/2;i++){
flag[i]=0.; flag[i]=0.;
if(work[i]>=trigger || work[i]<=-trigger){ if(work[i]>=trigger || work[i]<=-trigger){
...@@ -252,6 +260,7 @@ static void declip(int blocksize,float trigger, ...@@ -252,6 +260,7 @@ static void declip(int blocksize,float trigger,
count++; count++;
} }
} }
*runningtotal+=blocksize; *runningtotal+=blocksize;
*runningcount+=count; *runningcount+=count;
...@@ -259,7 +268,6 @@ static void declip(int blocksize,float trigger, ...@@ -259,7 +268,6 @@ static void declip(int blocksize,float trigger,
if(count){ if(count){
for(i=0;i<blocksize/2;i++)flag[i]=0.; for(i=0;i<blocksize/2;i++)flag[i]=0.;
for(i=blocksize*3/2;i<blocksize*2;i++)flag[i]=0.; for(i=blocksize*3/2;i<blocksize*2;i++)flag[i]=0.;
for(i=0;i<blocksize;i++)work[i+blocksize/2]*=window[i]; for(i=0;i<blocksize;i++)work[i+blocksize/2]*=window[i];
fftwf_execute(fftwf_weight); fftwf_execute(fftwf_weight);
...@@ -268,10 +276,11 @@ static void declip(int blocksize,float trigger, ...@@ -268,10 +276,11 @@ static void declip(int blocksize,float trigger,
if(iterbound<10)iterbound=10; if(iterbound<10)iterbound=10;
reconstruct(work,freq,flag,epsilon,iterbound); reconstruct(work,freq,flag,epsilon,iterbound);
for(i=0;i<blocksize;i++)work[i+blocksize/2]*=window[i]; for(i=0;i<blocksize;i++)work[i+blocksize/2]*=window[i];
}else }else
for(i=0;i<blocksize;i++)work[i+blocksize/2]*=window[i]*window[i]; for(i=0;i<blocksize;i++)work[i+blocksize/2]*=window[i]*window[i];
} }
/* called only by playback thread */ /* called only by playback thread */
...@@ -596,6 +605,5 @@ time_linkage *declip_read(time_linkage *in){ ...@@ -596,6 +605,5 @@ time_linkage *declip_read(time_linkage *in){
} }
out.active=active; out.active=active;
return &out; return &out;
} }
...@@ -599,7 +599,7 @@ int input_load(void){ ...@@ -599,7 +599,7 @@ int input_load(void){
return 0; return 0;
} }
off_t input_seek_i(off_t pos,int ps){ static off_t input_seek_i(off_t pos,int ps){
int i,k; int i,k;
int flag=0; int flag=0;
off_t maxpos=0; off_t maxpos=0;
...@@ -692,7 +692,6 @@ static void LEconvert(float **data, ...@@ -692,7 +692,6 @@ static void LEconvert(float **data,
unsigned char *readbuf, int dataoff, unsigned char *readbuf, int dataoff,
int ch,int bytes, int signp, int n){ int ch,int bytes, int signp, int n){
int i,j,k=0; int i,j,k=0;
int32_t val;
int32_t xor=(signp?0:0x80000000UL); int32_t xor=(signp?0:0x80000000UL);
float scale=1./2147483648.; float scale=1./2147483648.;
...@@ -702,8 +701,7 @@ static void LEconvert(float **data, ...@@ -702,8 +701,7 @@ static void LEconvert(float **data,
for(i=dataoff;i<dataoff+n;i++) for(i=dataoff;i<dataoff+n;i++)
for(j=0;j<ch;j++){ for(j=0;j<ch;j++){
val=(readbuf[k]<<24)^xor; data[j][i]=((readbuf[k]<<24)^xor)*scale;
data[j][i]=(val==0x7f000000?1.:val*scale);
k++; k++;
} }
break; break;
...@@ -712,8 +710,7 @@ static void LEconvert(float **data, ...@@ -712,8 +710,7 @@ static void LEconvert(float **data,
for(i=dataoff;i<dataoff+n;i++) for(i=dataoff;i<dataoff+n;i++)
for(j=0;j<ch;j++){ for(j=0;j<ch;j++){
val=((readbuf[k]<<16)|(readbuf[k+1]<<24))^xor; data[j][i]=(((readbuf[k]<<16)|(readbuf[k+1]<<24))^xor)*scale;
data[j][i]=(val==0x7fff0000?1.:val*scale);
k+=2; k+=2;
} }
break; break;
...@@ -722,8 +719,7 @@ static void LEconvert(float **data, ...@@ -722,8 +719,7 @@ static void LEconvert(float **data,
for(i=dataoff;i<dataoff+n;i++) for(i=dataoff;i<dataoff+n;i++)
for(j=0;j<ch;j++){ for(j=0;j<ch;j++){
val=((readbuf[k]<<8)|(readbuf[k+1]<<16)|(readbuf[k+2]<<24))^xor; data[j][i]=(((readbuf[k]<<8)|(readbuf[k+1]<<16)|(readbuf[k+2]<<24))^xor)*scale;
data[j][i]=(val==0x7fffff00?1.:val*scale);
k+=3; k+=3;
} }
break; break;
...@@ -732,8 +728,7 @@ static void LEconvert(float **data, ...@@ -732,8 +728,7 @@ static void LEconvert(float **data,
for(i=dataoff;i<dataoff+n;i++) for(i=dataoff;i<dataoff+n;i++)
for(j=0;j<ch;j++){ for(j=0;j<ch;j++){
val=((readbuf[k])|(readbuf[k+1]<<8)|(readbuf[k+2]<<16)|(readbuf[k+3]<<24))^xor; data[j][i]=(((readbuf[k])|(readbuf[k+1]<<8)|(readbuf[k+2]<<16)|(readbuf[k+3]<<24))^xor)*scale;
data[j][i]=(val==0x7fffffff?1.:val*scale);
k+=4; k+=4;
} }
break; break;
...@@ -744,7 +739,6 @@ static void BEconvert(float **data, ...@@ -744,7 +739,6 @@ static void BEconvert(float **data,
unsigned char *readbuf, int dataoff, unsigned char *readbuf, int dataoff,
int ch,int bytes, int signp, int n){ int ch,int bytes, int signp, int n){
int i,j,k=0; int i,j,k=0;
int32_t val;
int32_t xor=(signp?0:0x80000000UL); int32_t xor=(signp?0:0x80000000UL);
float scale=1./2147483648.; float scale=1./2147483648.;
...@@ -754,8 +748,7 @@ static void BEconvert(float **data, ...@@ -754,8 +748,7 @@ static void BEconvert(float **data,
for(i=dataoff;i<dataoff+n;i++) for(i=dataoff;i<dataoff+n;i++)
for(j=0;j<ch;j++){ for(j=0;j<ch;j++){
val=(readbuf[k]<<24)^xor; data[j][i]=((readbuf[k]<<24)^xor)*scale;
data[j][i]=(val==0x7f000000?1.:val*scale);
k++; k++;
} }
break; break;
...@@ -764,8 +757,7 @@ static void BEconvert(float **data, ...@@ -764,8 +757,7 @@ static void BEconvert(float **data,
for(i=dataoff;i<dataoff+n;i++) for(i=dataoff;i<dataoff+n;i++)
for(j=0;j<ch;j++){ for(j=0;j<ch;j++){
val=((readbuf[k+1]<<16)|(readbuf[k]<<24))^xor; data[j][i]=(((readbuf[k+1]<<16)|(readbuf[k]<<24))^xor)*scale;
data[j][i]=(val==0x7fff0000?1.:val*scale);
k+=2; k+=2;
} }
break; break;
...@@ -774,8 +766,7 @@ static void BEconvert(float **data, ...@@ -774,8 +766,7 @@ static void BEconvert(float **data,
for(i=dataoff;i<dataoff+n;i++) for(i=dataoff;i<dataoff+n;i++)
for(j=0;j<ch;j++){ for(j=0;j<ch;j++){
val=((readbuf[k+2]<<8)|(readbuf[k+1]<<16)|(readbuf[k]<<24))^xor; data[j][i]=(((readbuf[k+2]<<8)|(readbuf[k+1]<<16)|(readbuf[k]<<24))^xor)*scale;
data[j][i]=(val==0x7fffff00?1.:val*scale);
k+=3; k+=3;
} }
break; break;
...@@ -784,8 +775,7 @@ static void BEconvert(float **data, ...@@ -784,8 +775,7 @@ static void BEconvert(float **data,
for(i=dataoff;i<dataoff+n;i++) for(i=dataoff;i<dataoff+n;i++)
for(j=0;j<ch;j++){ for(j=0;j<ch;j++){
val=((readbuf[k+3])|(readbuf[k+2]<<8)|(readbuf[k+1]<<16)|(readbuf[k]<<24))^xor; data[j][i]=(((readbuf[k+3])|(readbuf[k+2]<<8)|(readbuf[k+1]<<16)|(readbuf[k]<<24))^xor)*scale;
data[j][i]=(val==0x7fffffff?1.:val*scale);
k+=4; k+=4;
} }
break; break;
......
...@@ -53,10 +53,6 @@ sig_atomic_t main_looping; ...@@ -53,10 +53,6 @@ sig_atomic_t main_looping;
char *configfile="postfish-staterc"; char *configfile="postfish-staterc";
char *version; char *version;
static void cleanup(void){
save_state();
}
void clean_exit(int sig){ void clean_exit(int sig){
signal(sig,SIG_IGN); signal(sig,SIG_IGN);
if(sig!=SIGINT){ if(sig!=SIGINT){
...@@ -72,18 +68,17 @@ void clean_exit(int sig){ ...@@ -72,18 +68,17 @@ void clean_exit(int sig){
"bug as quickly as possible.\n\n" "bug as quickly as possible.\n\n"
"-- monty@xiph.org, Postfish revision %s\n\n",sig,version); "-- monty@xiph.org, Postfish revision %s\n\n",sig,version);
configfile="postfish-staterc-crashsave"; configfile="postfish-staterc-crashsave";
cleanup(); }else{
exit(0); output_halt_playback();
} }
/* otherwise we want a clean SIGINT exit */ save_state();
if(main_looping)
if(main_looping){
main_looping=0;
gtk_main_quit(); gtk_main_quit();
else{
cleanup();
exit(0);
} }
exit(0);
} }
const char *optstring = "-c:gh"; const char *optstring = "-c:gh";
...@@ -243,9 +238,18 @@ int main(int argc, char **argv){ ...@@ -243,9 +238,18 @@ int main(int argc, char **argv){
/* We do not care about FPEs; rather, underflow is nominal case, and /* We do not care about FPEs; rather, underflow is nominal case, and
its better to ignore other traps in production than to crash the its better to ignore other traps in production than to crash the
app. Please inform the FPU of this. */ app. Please inform the FPU of this. */
#ifndef DEBUG
fedisableexcept(FE_INVALID);
fedisableexcept(FE_INEXACT); fedisableexcept(FE_INEXACT);
fedisableexcept(FE_UNDERFLOW); fedisableexcept(FE_UNDERFLOW);
fedisableexcept(FE_OVERFLOW); fedisableexcept(FE_OVERFLOW);
#else
feenableexcept(FE_INVALID);
feenableexcept(FE_INEXACT);
feenableexcept(FE_UNDERFLOW);
feenableexcept(FE_OVERFLOW);
#endif
/* Linux Altivec support has a very annoying problem; by default, /* Linux Altivec support has a very annoying problem; by default,
math on denormalized floats will simply crash the program. FFTW3 math on denormalized floats will simply crash the program. FFTW3
...@@ -317,6 +321,9 @@ int main(int argc, char **argv){ ...@@ -317,6 +321,9 @@ int main(int argc, char **argv){
} }
/* probe outputs */ /* probe outputs */
if(setvbuf(stdout, NULL, _IONBF , 0))
fprintf(stderr,"Unable to remove block buffering on stdout; continuing\n");
output_probe_stdout(STDOUT_FILENO); output_probe_stdout(STDOUT_FILENO);
output_probe_monitor(); output_probe_monitor();
...@@ -355,9 +362,6 @@ int main(int argc, char **argv){ ...@@ -355,9 +362,6 @@ int main(int argc, char **argv){
mainpanel_go(argc,argv,input_ch); mainpanel_go(argc,argv,input_ch);
output_halt_playback();
cleanup();
return(0); return(0);
} }
...@@ -365,3 +369,4 @@ int main(int argc, char **argv){ ...@@ -365,3 +369,4 @@ int main(int argc, char **argv){
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
static postfish_mainpanel p; static postfish_mainpanel p;
extern char *configfile; extern char *configfile;
extern sig_atomic_t main_looping;
static void action_setb_to(postfish_mainpanel *p,const char *time); static void action_setb_to(postfish_mainpanel *p,const char *time);
static void action_seta_to(postfish_mainpanel *p,const char *time); static void action_seta_to(postfish_mainpanel *p,const char *time);
...@@ -204,7 +205,7 @@ static int reanimate_fish(postfish_mainpanel *p){ ...@@ -204,7 +205,7 @@ static int reanimate_fish(postfish_mainpanel *p){
if(p->fishframe==0 && !playback_active){ if(p->fishframe==0 && !playback_active){
/* reschedule to blink */ /* reschedule to blink */
p->fishframe_timer= p->fishframe_timer=
gtk_timeout_add(rand()%1000*30,(GtkFunction)reanimate_fish,p); g_timeout_add(rand()%1000*30,(GSourceFunc)reanimate_fish,p);
return FALSE; return FALSE;
} }
}else{ }else{
...@@ -220,13 +221,13 @@ static int reanimate_fish(postfish_mainpanel *p){ ...@@ -220,13 +221,13 @@ static int reanimate_fish(postfish_mainpanel *p){
if(p->fishframe==12){ if(p->fishframe==12){
/* reschedule to animate */ /* reschedule to animate */
p->fishframe_timer= p->fishframe_timer=
gtk_timeout_add(10,(GtkFunction)reanimate_fish,p); g_timeout_add(10,(GSourceFunc)reanimate_fish,p);
return FALSE; return FALSE;
} }
if(p->fishframe==0){ if(p->fishframe==0){
/* reschedule to blink */ /* reschedule to blink */
p->fishframe_timer= p->fishframe_timer=
gtk_timeout_add(rand()%1000*30,(GtkFunction)reanimate_fish,p); g_timeout_add(rand()%1000*30,(GSourceFunc)reanimate_fish,p);
return FALSE; return FALSE;
} }
} }
...@@ -235,13 +236,13 @@ static int reanimate_fish(postfish_mainpanel *p){ ...@@ -235,13 +236,13 @@ static int reanimate_fish(postfish_mainpanel *p){
static void animate_fish(postfish_mainpanel *p){ static void animate_fish(postfish_mainpanel *p){
if(p->fishframe_init){ if(p->fishframe_init){
gtk_timeout_remove(p->fishframe_timer); g_source_remove(p->fishframe_timer);
p->fishframe_timer= p->fishframe_timer=
gtk_timeout_add(80,(GtkFunction)reanimate_fish,p); g_timeout_add(80,(GSourceFunc)reanimate_fish,p);
}else{ }else{
p->fishframe_init=1; p->fishframe_init=1;
p->fishframe_timer= p->fishframe_timer=
gtk_timeout_add(rand()%1000*30,(GtkFunction)reanimate_fish,p); g_timeout_add(rand()%1000*30,(GSourceFunc)reanimate_fish,p);
} }
} }
...@@ -338,14 +339,17 @@ static void action_setb(GtkWidget *widget,postfish_mainpanel *p){ ...@@ -338,14 +339,17 @@ static void action_setb(GtkWidget *widget,postfish_mainpanel *p){
} }
static void shutdown(void){ static void shutdown(void){
gtk_main_quit (); output_halt_playback();
save_state();
main_looping=0;
gtk_main_quit();
} }
static void masterdB_change(GtkWidget *dummy, gpointer in){ static void masterdB_change(GtkWidget *dummy, gpointer in){
postfish_mainpanel *p=in; postfish_mainpanel *p=in;
char buf[80]; char buf[80];
float val=multibar_get_value(MULTIBAR(p->masterdB_s),0); float val=multibar_get_value(MULTIBAR(p->masterdB_s),0);
sprintf(buf,"%.1fdB",val); sprintf(buf,"%+5.1fdB",val);
readout_set(READOUT(p->masterdB_r),buf); readout_set(READOUT(p->masterdB_r),buf);
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->masterdB_a))) if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->masterdB_a)))
...@@ -1056,9 +1060,9 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){ ...@@ -1056,9 +1060,9 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
} }
mainpanel_chentry(panel,channeltable,"_Declip ",0,clippanel_create,0); mainpanel_chentry(panel,channeltable,"_Declip ",0,clippanel_create,0);
mainpanel_chentry(panel,channeltable,"_Multicomp ",1,0,compandpanel_create_channel); mainpanel_chentry(panel,channeltable,"De_verb ",1,suppresspanel_create_channel,0);
mainpanel_chentry(panel,channeltable,"_Singlecomp ",2,0,singlepanel_create_channel); mainpanel_chentry(panel,channeltable,"_Multicomp ",2,0,compandpanel_create_channel);
mainpanel_chentry(panel,channeltable,"De_verb ",3,suppresspanel_create_channel,0); mainpanel_chentry(panel,channeltable,"_Singlecomp ",3,0,singlepanel_create_channel);
mainpanel_chentry(panel,channeltable,"_EQ ",4,0,eqpanel_create_channel); mainpanel_chentry(panel,channeltable,"_EQ ",4,0,eqpanel_create_channel);
mainpanel_chentry(panel,channeltable,"_Reverb ",5,0,reverbpanel_create_channel); mainpanel_chentry(panel,channeltable,"_Reverb ",5,0,reverbpanel_create_channel);
mainpanel_chentry(panel,channeltable,"Atten/Mi_x ",6,attenpanel_create, mainpanel_chentry(panel,channeltable,"Atten/Mi_x ",6,attenpanel_create,
...@@ -1130,9 +1134,6 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){ ...@@ -1130,9 +1134,6 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
g_signal_connect (G_OBJECT (panel->toplevel), "delete_event", g_signal_connect (G_OBJECT (panel->toplevel), "delete_event",
G_CALLBACK (shutdown), NULL); G_CALLBACK (shutdown), NULL);
g_signal_connect (G_OBJECT (panel->toplevel), "delete_event",
G_CALLBACK (shutdown), NULL);
gtk_widget_show_all(panel->toplevel); gtk_widget_show_all(panel->toplevel);
gtk_window_set_resizable(GTK_WINDOW(panel->toplevel),0); gtk_window_set_resizable(GTK_WINDOW(panel->toplevel),0);
...@@ -1181,7 +1182,7 @@ static void feedback_process(postfish_mainpanel *panel){ ...@@ -1181,7 +1182,7 @@ static void feedback_process(postfish_mainpanel *panel){
} }
multibar_set(MULTIBAR(panel->outbar),rms,peak,input_ch,current_p); multibar_set(MULTIBAR(panel->outbar),rms,peak,OUTPUT_CHANNELS,current_p);
if(pull_input_feedback(peak,rms,&time_cursor)){ if(pull_input_feedback(peak,rms,&time_cursor)){
for(i=0;i<input_ch;i++){ for(i=0;i<input_ch;i++){
...@@ -1237,7 +1238,6 @@ static int look_for_gtkrc(char *filename){ ...@@ -1237,7 +1238,6 @@ static int look_for_gtkrc(char *filename){
} }
#include <stdlib.h> #include <stdlib.h>
extern sig_atomic_t main_looping;
void mainpanel_go(int argc,char *argv[], int ch){ void mainpanel_go(int argc,char *argv[], int ch){
char *homedir=getenv("HOME"); char *homedir=getenv("HOME");
char *labels[33]; char *labels[33];
......
...@@ -268,9 +268,13 @@ time_linkage *mix_read(time_linkage *in, ...@@ -268,9 +268,13 @@ time_linkage *mix_read(time_linkage *in,
/* fillstate here is only used for lazy initialization/reset */ /* fillstate here is only used for lazy initialization/reset */
if(ms.fillstate==0){ if(ms.fillstate==0){
/* zero the cache */ /* zero the cache */
for(i=0;i<input_ch;i++){ for(i=0;i<input_ch;i++){
memset(ms.cacheP[i],0,sizeof(**ms.cacheP)*input_size);