[xiph-commits] r7941 - trunk/postfish
xiphmont at motherfish-iii.xiph.org
xiphmont at motherfish-iii.xiph.org
Fri Oct 8 23:59:48 PDT 2004
Author: xiphmont
Date: 2004-10-08 23:59:48 -0700 (Fri, 08 Oct 2004)
New Revision: 7941
Modified:
trunk/postfish/Makefile
trunk/postfish/compandpanel.c
trunk/postfish/deverb.c
trunk/postfish/freq.c
trunk/postfish/multicompand.c
trunk/postfish/singlecomp.c
trunk/postfish/singlepanel.c
Log:
More aggressively disable unused bessel followers in the companders
and deverber
Correct a bug where the metrics calculation was being run in freq.c
even when metrics were not being displayed.
Disable default soft-knee.
Modified: trunk/postfish/Makefile
===================================================================
--- trunk/postfish/Makefile 2004-10-09 04:38:59 UTC (rev 7940)
+++ trunk/postfish/Makefile 2004-10-09 06:59:48 UTC (rev 7941)
@@ -6,11 +6,11 @@
# Use the below line to build for PowerPC
# The PPC build *must* use -maltivec, even if the target is a non-altivec machine
-ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 -maltivec -mcpu=7400
+#ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 -maltivec -mcpu=7400
# use the below for x86 and most other platforms where 'float' is 32 bit IEEE754
-#ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1 -march=athlon-mp
+ADD_DEF= -DUGLY_IEEE754_FLOAT32_HACK=1
# use the below for anything without IEE754 floats (eg, VAX)
@@ -40,13 +40,13 @@
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)"
+ $(MAKE) target CFLAGS="-O2 -ffast-math -fomit-frame-pointer $(GCF) $(ADD_DEF)"
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 -O2 -ffast-math $(GCF) $(ADD_DEF)" LIBS="-lgprof-helper "
clean:
rm -f $(OBJ) *.d *.d.* gmon.out postfish
Modified: trunk/postfish/compandpanel.c
===================================================================
--- trunk/postfish/compandpanel.c 2004-10-09 04:38:59 UTC (rev 7940)
+++ trunk/postfish/compandpanel.c 2004-10-09 06:59:48 UTC (rev 7941)
@@ -772,7 +772,7 @@
g_signal_connect (G_OBJECT (peak_button), "clicked",
G_CALLBACK (mode_peak), &ps->ms->under_mode);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rms_button),1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(knee_button),1);
+ //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(knee_button),1);
gtk_table_attach(GTK_TABLE(undertable),envelopebox,0,4,0,1,GTK_FILL,0,0,0);
ps->under_rms=rms_button;
ps->under_peak=peak_button;
@@ -874,7 +874,7 @@
g_signal_connect (G_OBJECT (peak_button), "clicked",
G_CALLBACK (mode_peak), &ps->ms->over_mode);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rms_button),1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(knee_button),1);
+ //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(knee_button),1);
gtk_table_attach(GTK_TABLE(overtable),envelopebox,0,4,0,1,GTK_FILL,0,0,0);
ps->over_rms=rms_button;
ps->over_peak=peak_button;
Modified: trunk/postfish/deverb.c
===================================================================
--- trunk/postfish/deverb.c 2004-10-09 04:38:59 UTC (rev 7940)
+++ trunk/postfish/deverb.c 2004-10-09 06:59:48 UTC (rev 7941)
@@ -80,7 +80,7 @@
}
void deverb_reset(){
- int i,j;
+ int i;
subband_reset(&channel_state.ss);
Modified: trunk/postfish/freq.c
===================================================================
--- trunk/postfish/freq.c 2004-10-09 04:38:59 UTC (rev 7940)
+++ trunk/postfish/freq.c 2004-10-09 06:59:48 UTC (rev 7941)
@@ -70,7 +70,6 @@
int freq_class_load(freq_class_setup *f,const float *frequencies, int bands){
int i,j;
- int blocksize=input_size*2;
memset(f,0,sizeof(*f));
f->qblocksize=input_size;
@@ -257,10 +256,10 @@
float lpeak=0.;
for(j=0;j<c->qblocksize*2+1;j++){
float val=fabs(sq_mags[j]*ho_window[j]);
- lrms+=val*.5;
+ lrms+=val;
if(val>lpeak)lpeak=val;
}
- rms[i][channel]=todB(lrms*c->ho_area[i])*.5;
+ rms[i][channel]=todB(lrms*.5*c->ho_area[i])*.5;
peak[i][channel]=todB(lpeak)*.5;
}
}
@@ -269,8 +268,6 @@
float *cache, float *in,
int qblocksize,int muted0,int mutedC,
float scale){
- int i;
-
/* place data in fftwf buffer */
memset(buffer,0,sizeof(*buffer)*qblocksize);
@@ -359,8 +356,10 @@
if(activeC)func(fc->fftwf_buffer,i);
/* feedback and reverse transform */
- have_feedback=1;
- freq_metric_work(fc->fftwf_buffer,fc,f->peak,f->rms,i);
+ if(visible[i]){
+ freq_metric_work(fc->fftwf_buffer,fc,f->peak,f->rms,i);
+ have_feedback=1;
+ }
if(activeC)
fftwf_execute(fc->fftwf_backward);
else
Modified: trunk/postfish/multicompand.c
===================================================================
--- trunk/postfish/multicompand.c 2004-10-09 04:38:59 UTC (rev 7940)
+++ trunk/postfish/multicompand.c 2004-10-09 06:59:48 UTC (rev 7941)
@@ -56,23 +56,28 @@
feedback_generic_pool feedpool;
subband_state ss;
- iir_filter *over_attack;
- iir_filter *over_decay;
+ iir_filter over_attack[MAX_INPUT_CHANNELS];
+ iir_filter over_decay[MAX_INPUT_CHANNELS];
- iir_filter *under_attack;
- iir_filter *under_decay;
+ iir_filter under_attack[MAX_INPUT_CHANNELS];
+ iir_filter under_decay[MAX_INPUT_CHANNELS];
- iir_filter *base_attack;
- iir_filter *base_decay;
+ iir_filter base_attack[MAX_INPUT_CHANNELS];
+ iir_filter base_decay[MAX_INPUT_CHANNELS];
- iir_state *over_iir[multicomp_freqs_max];
- iir_state *under_iir[multicomp_freqs_max];
- iir_state *base_iir[multicomp_freqs_max];
+ iir_state over_iir[multicomp_freqs_max][MAX_INPUT_CHANNELS];
+ int over_delay[MAX_INPUT_CHANNELS];
- peak_state *over_peak[multicomp_freqs_max];
- peak_state *under_peak[multicomp_freqs_max];
- peak_state *base_peak[multicomp_freqs_max];
+ iir_state under_iir[multicomp_freqs_max][MAX_INPUT_CHANNELS];
+ int under_delay[MAX_INPUT_CHANNELS];
+ iir_state base_iir[multicomp_freqs_max][MAX_INPUT_CHANNELS];
+ int base_delay[MAX_INPUT_CHANNELS];
+
+ peak_state over_peak[multicomp_freqs_max][MAX_INPUT_CHANNELS];
+ peak_state under_peak[multicomp_freqs_max][MAX_INPUT_CHANNELS];
+ peak_state base_peak[multicomp_freqs_max][MAX_INPUT_CHANNELS];
+
atten_cache *prevset;
atten_cache *currset;
@@ -127,17 +132,25 @@
return pull_multicompand_feedback(&channel_state,peak,rms,b);
}
+static void reset_filters_onech(multicompand_state *ms,int ch){
+ int i;
+ ms->base_delay[ch]=2;
+ ms->over_delay[ch]=2;
+ ms->under_delay[ch]=2;
+ for(i=0;i<multicomp_freqs_max;i++){
+ memset(&ms->over_peak[i][ch],0,sizeof(peak_state));
+ memset(&ms->under_peak[i][ch],0,sizeof(peak_state));
+ memset(&ms->base_peak[i][ch],0,sizeof(peak_state));
+ memset(&ms->over_iir[i][ch],0,sizeof(iir_state));
+ memset(&ms->under_iir[i][ch],0,sizeof(iir_state));
+ memset(&ms->base_iir[i][ch],0,sizeof(iir_state));
+ }
+}
+
static void reset_filters(multicompand_state *ms){
- int i,j;
- for(i=0;i<multicomp_freqs_max;i++)
- for(j=0;j<ms->ch;j++){
- memset(&ms->over_peak[i][j],0,sizeof(peak_state));
- memset(&ms->under_peak[i][j],0,sizeof(peak_state));
- memset(&ms->base_peak[i][j],0,sizeof(peak_state));
- memset(&ms->over_iir[i][j],0,sizeof(iir_state));
- memset(&ms->under_iir[i][j],0,sizeof(iir_state));
- memset(&ms->base_iir[i][j],0,sizeof(iir_state));
- }
+ int j;
+ for(j=0;j<ms->ch;j++)
+ reset_filters_onech(ms,j);
}
void multicompand_reset(){
@@ -161,24 +174,6 @@
ms->ch=ch;
subband_load(&ms->ss,multicomp_freqs_max,qblocksize,ch);
- ms->over_attack=calloc(ms->ch,sizeof(*ms->over_attack));
- ms->over_decay=calloc(ms->ch,sizeof(*ms->over_decay));
-
- ms->under_attack=calloc(ms->ch,sizeof(*ms->under_attack));
- ms->under_decay=calloc(ms->ch,sizeof(*ms->under_decay));
-
- ms->base_attack=calloc(ms->ch,sizeof(*ms->base_attack));
- ms->base_decay=calloc(ms->ch,sizeof(*ms->base_decay));
-
- for(i=0;i<multicomp_freqs_max;i++){
- ms->over_peak[i]=calloc(ms->ch,sizeof(peak_state));
- ms->under_peak[i]=calloc(ms->ch,sizeof(peak_state));
- ms->base_peak[i]=calloc(ms->ch,sizeof(peak_state));
- ms->over_iir[i]=calloc(ms->ch,sizeof(iir_state));
- ms->under_iir[i]=calloc(ms->ch,sizeof(iir_state));
- ms->base_iir[i]=calloc(ms->ch,sizeof(iir_state));
- }
-
ms->peak=calloc(multicomp_freqs_max,sizeof(*ms->peak));
ms->rms=calloc(multicomp_freqs_max,sizeof(*ms->rms));
for(i=0;i<multicomp_freqs_max;i++)ms->peak[i]=malloc(ms->ch*sizeof(**ms->peak));
@@ -186,6 +181,8 @@
ms->prevset=malloc(ch*sizeof(*ms->prevset));
ms->currset=malloc(ch*sizeof(*ms->currset));
+
+ reset_filters(ms);
return 0;
}
@@ -440,13 +437,13 @@
if(knee){
for(k=0;k<input_size;k++){
- adj[k]=soft_knee(zerocorner-underdB[k])*ratio_multiplier;
+ adj[k]+=soft_knee(zerocorner-underdB[k])*ratio_multiplier;
ratio_multiplier+=ratio_add;
zerocorner+=corner_add;
}
}else{
for(k=0;k<input_size;k++){
- adj[k]=hard_knee(zerocorner-underdB[k])*ratio_multiplier;
+ adj[k]+=hard_knee(zerocorner-underdB[k])*ratio_multiplier;
ratio_multiplier+=ratio_add;
zerocorner+=corner_add;
}
@@ -455,10 +452,10 @@
}else{
if(knee){
for(k=0;k<input_size;k++)
- adj[k]=soft_knee(zerocorner-underdB[k])*ratio_multiplier;
+ adj[k]+=soft_knee(zerocorner-underdB[k])*ratio_multiplier;
}else{
for(k=0;k<input_size;k++)
- adj[k]=hard_knee(zerocorner-underdB[k])*ratio_multiplier;
+ adj[k]+=hard_knee(zerocorner-underdB[k])*ratio_multiplier;
}
}
}
@@ -489,8 +486,9 @@
subband_window *w=ss->w1[channel];
subband_window *wP=ss->wP[channel];
float adj[input_size];
-
+ int o_active=0,u_active=0,b_active=0;
+
if(w==&sw[0]){
bank=0;
}else if(w==&sw[1]){
@@ -510,20 +508,65 @@
/* don't slew from an unknown value */
if(!ss->effect_activeP[channel] || !ms->initstate)
memcpy(prevset,currset,sizeof(*currset));
- }
+ /* don't run filters that will be applied at unity */
+ if(prevset->under_ratio==1000 && currset->under_ratio==1000){
+ ms->under_delay[channel]=2;
+ for(i=0;i<multicomp_freqs_max;i++){
+ memset(&ms->under_peak[i][channel],0,sizeof(peak_state));
+ memset(&ms->under_iir[i][channel],0,sizeof(iir_state));
+ }
+ }else{
+ if(ms->under_delay[channel]-->0)currset->under_ratio=1000;
+ if(ms->under_delay[channel]<0)ms->under_delay[channel]=0;
+ u_active=1;
+ }
+
+ if(prevset->over_ratio==1000 && currset->over_ratio==1000){
+ ms->over_delay[channel]=2;
+ for(i=0;i<multicomp_freqs_max;i++){
+ memset(&ms->over_peak[i][channel],0,sizeof(peak_state));
+ memset(&ms->over_iir[i][channel],0,sizeof(iir_state));
+ }
+ }else{
+ if(ms->over_delay[channel]-->0)currset->over_ratio=1000;
+ if(ms->over_delay[channel]<0)ms->over_delay[channel]=0;
+ o_active=1;
+ }
+
+ if(prevset->base_ratio==1000 && currset->base_ratio==1000){
+ ms->base_delay[channel]=2;
+ for(i=0;i<multicomp_freqs_max;i++){
+ memset(&ms->base_peak[i][channel],0,sizeof(peak_state));
+ memset(&ms->base_iir[i][channel],0,sizeof(iir_state));
+ }
+ }else{
+ if(ms->base_delay[channel]-->0)currset->base_ratio=1000;
+ if(ms->base_delay[channel]<0)ms->base_delay[channel]=0;
+ b_active=1;
+ }
+
+ } else if (ss->effect_activeP[channel]){
+ /* this lapping channel just became inactive */
+ reset_filters_onech(ms,channel);
+ }
+
+ /* one thing is worth a note here; 'maxbands' can be
+ 'overrange' for the current bank. This is intentional; we
+ may need to run the additional (allocated and valid)
+ filters before or after their bands are active. The only
+ garbage data here is the xxxx_u, xxxx_o and xxxx_b
+ settings. There are allocated, but unset; if overrange,
+ they're ignored in the compand worker */
+
for(i=0;i<maxbands;i++){
float *x=ss->lap[i][channel];
- if(active){
- /* one thing is worth a note here; 'maxbands' can be
- 'overrange' for the current bank. This is intentional; we
- may need to run the additional (allocated and valid)
- filters before or after their bands are active. The only
- garbage data here is the xxxx_u, xxxx_o and xxxx_b
- settings. There are allocated, but unset; if overrange,
- they're ignored in the compand worker */
+ if(u_active || o_active || b_active)
+ memset(adj,0,sizeof(*adj)*input_size);
+
+ if(u_active)
under_compand(x,
prevset->static_u[i],
currset->static_u[i],
@@ -531,13 +574,14 @@
&ms->under_decay[channel],
&ms->under_iir[i][channel],
&ms->under_peak[i][channel],
- c->under_lookahead/1000.,
+ c->under_lookahead/1000.,
c->under_mode,
c->under_softknee,
prevset->under_ratio,
currset->under_ratio,
(i>=w->freq_bands?0:adj));
-
+
+ if(o_active)
over_compand(x,
prevset->static_o[i],
currset->static_o[i],
@@ -551,13 +595,10 @@
prevset->over_ratio,
currset->over_ratio,
(i>=w->freq_bands?0:adj));
-
- }
-
+
if(ss->visible1[channel]){
-
feedback_p=1;
-
+
if(!mute_channel_muted(ss->mutemask1,channel)){
/* determine rms and peak for feedback */
float max=-1.;
@@ -582,7 +623,7 @@
}
}
- if(active){
+ if(b_active)
base_compand(x,
&ms->base_attack[channel],
&ms->base_decay[channel],
@@ -592,20 +633,13 @@
prevset->base_ratio,
currset->base_ratio,
(i>=w->freq_bands?0:adj));
-
+
+ if(u_active || o_active || b_active){
if(ss->effect_active1[channel]){
for(k=0;k<input_size;k++)
x[k]*=fromdB_a(adj[k]);
}
- } else if (ss->effect_activeP[channel]){
- /* this lapping channel just became inactive */
- memset(&ms->over_peak[i][channel],0,sizeof(peak_state));
- memset(&ms->under_peak[i][channel],0,sizeof(peak_state));
- memset(&ms->base_peak[i][channel],0,sizeof(peak_state));
- memset(&ms->over_iir[i][channel],0,sizeof(iir_state));
- memset(&ms->under_iir[i][channel],0,sizeof(iir_state));
- memset(&ms->base_iir[i][channel],0,sizeof(iir_state));
- }
+ }
}
for(;i<wP->freq_bands;i++){
Modified: trunk/postfish/singlecomp.c
===================================================================
--- trunk/postfish/singlecomp.c 2004-10-09 04:38:59 UTC (rev 7940)
+++ trunk/postfish/singlecomp.c 2004-10-09 06:59:48 UTC (rev 7941)
@@ -50,20 +50,23 @@
time_linkage out;
feedback_generic_pool feedpool;
- iir_state *o_iir;
- iir_state *u_iir;
- iir_state *b_iir;
+ iir_state o_iir[MAX_INPUT_CHANNELS];
+ iir_state u_iir[MAX_INPUT_CHANNELS];
+ iir_state b_iir[MAX_INPUT_CHANNELS];
+ int o_delay[MAX_INPUT_CHANNELS];
+ int u_delay[MAX_INPUT_CHANNELS];
+ int b_delay[MAX_INPUT_CHANNELS];
- peak_state *o_peak;
- peak_state *u_peak;
- peak_state *b_peak;
+ peak_state o_peak[MAX_INPUT_CHANNELS];
+ peak_state u_peak[MAX_INPUT_CHANNELS];
+ peak_state b_peak[MAX_INPUT_CHANNELS];
- iir_filter *o_attack;
- iir_filter *o_decay;
- iir_filter *u_attack;
- iir_filter *u_decay;
- iir_filter *b_attack;
- iir_filter *b_decay;
+ iir_filter o_attack[MAX_INPUT_CHANNELS];
+ iir_filter u_attack[MAX_INPUT_CHANNELS];
+ iir_filter b_attack[MAX_INPUT_CHANNELS];
+ iir_filter o_decay[MAX_INPUT_CHANNELS];
+ iir_filter u_decay[MAX_INPUT_CHANNELS];
+ iir_filter b_decay[MAX_INPUT_CHANNELS];
int fillstate;
float **cache;
@@ -132,21 +135,6 @@
scs->activeP=calloc(scs->ch,sizeof(*scs->activeP));
scs->active0=calloc(scs->ch,sizeof(*scs->active0));
- scs->o_attack=calloc(scs->ch,sizeof(*scs->o_attack));
- scs->o_decay=calloc(scs->ch,sizeof(*scs->o_decay));
- scs->u_attack=calloc(scs->ch,sizeof(*scs->u_attack));
- scs->u_decay=calloc(scs->ch,sizeof(*scs->u_decay));
- scs->b_attack=calloc(scs->ch,sizeof(*scs->b_attack));
- scs->b_decay=calloc(scs->ch,sizeof(*scs->b_decay));
-
- scs->o_iir=calloc(scs->ch,sizeof(*scs->o_iir));
- scs->b_iir=calloc(scs->ch,sizeof(*scs->b_iir));
- scs->u_iir=calloc(scs->ch,sizeof(*scs->u_iir));
-
- scs->o_peak=calloc(scs->ch,sizeof(*scs->o_peak));
- scs->b_peak=calloc(scs->ch,sizeof(*scs->b_peak));
- scs->u_peak=calloc(scs->ch,sizeof(*scs->u_peak));
-
scs->out.channels=scs->ch;
scs->out.data=malloc(scs->ch*sizeof(*scs->out.data));
for(i=0;i<scs->ch;i++)
@@ -199,15 +187,6 @@
filter->ms=msec;
}
-static void reset_filter(singlecomp_state *scs){
- memset(scs->o_peak,0,scs->ch*sizeof(*scs->o_peak));
- memset(scs->u_peak,0,scs->ch*sizeof(*scs->u_peak));
- memset(scs->b_peak,0,scs->ch*sizeof(*scs->b_peak));
- memset(scs->o_iir,0,scs->ch*sizeof(*scs->o_iir));
- memset(scs->u_iir,0,scs->ch*sizeof(*scs->u_iir));
- memset(scs->b_iir,0,scs->ch*sizeof(*scs->b_iir));
-}
-
static void reset_onech_filter(singlecomp_state *scs,int i){
memset(scs->o_peak+i,0,sizeof(*scs->o_peak));
memset(scs->u_peak+i,0,sizeof(*scs->u_peak));
@@ -215,10 +194,19 @@
memset(scs->o_iir+i,0,sizeof(*scs->o_iir));
memset(scs->u_iir+i,0,sizeof(*scs->u_iir));
memset(scs->b_iir+i,0,sizeof(*scs->b_iir));
+ scs->o_delay[i]=1;
+ scs->u_delay[i]=1;
+ scs->b_delay[i]=1;
}
+static void reset_filter(singlecomp_state *scs){
+ int i;
+ for(i=0;i<scs->ch;i++)
+ reset_onech_filter(scs,i);
+}
+
/* called only in playback thread */
-int singlecomp_reset(void ){
+int singlecomp_reset(void){
/* reset cached pipe state */
master_state.fillstate=0;
channel_state.fillstate=0;
@@ -412,13 +400,13 @@
if(softknee){
for(k=0;k<input_size;k++){
- adj[k]= -soft_knee(zerocorner-work[k])*multiplier;
+ adj[k]+= -soft_knee(zerocorner-work[k])*multiplier;
multiplier+=multiplier_add;
zerocorner+=zerocorner_add;
}
}else{
for(k=0;k<input_size;k++){
- adj[k]= -hard_knee(zerocorner-work[k])*multiplier;
+ adj[k]+= -hard_knee(zerocorner-work[k])*multiplier;
multiplier+=multiplier_add;
zerocorner+=zerocorner_add;
}
@@ -427,14 +415,13 @@
}else{
if(softknee){
for(k=0;k<input_size;k++)
- adj[k]= -soft_knee(zerocorner-work[k])*multiplier;
+ adj[k]+= -soft_knee(zerocorner-work[k])*multiplier;
}else{
for(k=0;k<input_size;k++)
- adj[k]= -hard_knee(zerocorner-work[k])*multiplier;
+ adj[k]+= -hard_knee(zerocorner-work[k])*multiplier;
}
}
- }else
- memset(adj,0,sizeof(*adj)*input_size);
+ }
}
@@ -484,6 +471,8 @@
for(i=0;i<scs->ch;i++){
+ int o_active=0,u_active=0,b_active=0;
+
int activeC= active[i] && !mute_channel_muted(mutemaskC,i);
int active0= scs->active0[i];
int activeP= scs->activeP[i];
@@ -540,44 +529,80 @@
}else if(active0 || activeC){
float adj[input_size]; // under will set it
+ atten_cache *prevset=scs->prevset+i;
+ atten_cache *currset=scs->currset+i;
- scs->currset[i].u_thresh=scset[i]->u_thresh;
- scs->currset[i].o_thresh=scset[i]->o_thresh;
- scs->currset[i].u_ratio=scset[i]->u_ratio;
- scs->currset[i].o_ratio=scset[i]->o_ratio;
- scs->currset[i].b_ratio=scset[i]->b_ratio;
+ currset->u_thresh=scset[i]->u_thresh;
+ currset->o_thresh=scset[i]->o_thresh;
+ currset->u_ratio=scset[i]->u_ratio;
+ currset->o_ratio=scset[i]->o_ratio;
+ currset->b_ratio=scset[i]->b_ratio;
/* don't slew from an unknown value */
if(!activeP || !scs->fillstate)
- memcpy(scs->prevset+i,scs->currset+i,sizeof(*scs->currset));
+ memcpy(prevset,currset,sizeof(*currset));
+ /* don't run filters that will be applied at unity */
+ if(prevset->u_ratio==1000 && currset->u_ratio==1000){
+ scs->u_delay[i]=2;
+ memset(scs->u_peak+i,0,sizeof(peak_state));
+ memset(scs->u_iir+i,0,sizeof(iir_state));
+ }else{
+ if(scs->u_delay[i]-->0)currset->u_ratio=1000;
+ if(scs->u_delay[i]<0)scs->u_delay[i]=0;
+ u_active=1;
+ }
+
+ if(prevset->o_ratio==1000 && currset->o_ratio==1000){
+ scs->o_delay[i]=2;
+ memset(scs->o_peak+i,0,sizeof(peak_state));
+ memset(scs->o_iir+i,0,sizeof(iir_state));
+ }else{
+ if(scs->o_delay[i]-->0)currset->o_ratio=1000;
+ if(scs->o_delay[i]<0)scs->o_delay[i]=0;
+ o_active=1;
+ }
+
+ if(prevset->b_ratio==1000 && currset->b_ratio==1000){
+ scs->b_delay[i]=2;
+ memset(scs->b_peak+i,0,sizeof(peak_state));
+ memset(scs->b_iir+i,0,sizeof(iir_state));
+ }else{
+ if(scs->b_delay[i]-->0)currset->b_ratio=1000;
+ if(scs->b_delay[i]<0)scs->b_delay[i]=0;
+ b_active=1;
+ }
+
/* run the filters */
+ memset(adj,0,sizeof(*adj)*input_size);
+
+ if(u_active)
+ under_compand(scs->cache[i],in->data[i],adj,
+ scs->prevset[i].u_thresh,
+ scs->currset[i].u_thresh,
+ 1.-1000./scs->prevset[i].u_ratio,
+ 1.-1000./scs->currset[i].u_ratio,
+ scset[i]->u_lookahead/1000.,
+ scset[i]->u_mode,
+ scset[i]->u_softknee,
+ scs->u_attack+i,scs->u_decay+i,
+ scs->u_iir+i,scs->u_peak+i,
+ active0);
- under_compand(scs->cache[i],in->data[i],adj,
- scs->prevset[i].u_thresh,
- scs->currset[i].u_thresh,
- 1.-1000./scs->prevset[i].u_ratio,
- 1.-1000./scs->currset[i].u_ratio,
- scset[i]->u_lookahead/1000.,
- scset[i]->u_mode,
- scset[i]->u_softknee,
- scs->u_attack+i,scs->u_decay+i,
- scs->u_iir+i,scs->u_peak+i,
- active0);
+ if(o_active)
+ over_compand(scs->cache[i],in->data[i],adj,
+ scs->prevset[i].o_thresh,
+ scs->currset[i].o_thresh,
+ 1.-1000./scs->prevset[i].o_ratio,
+ 1.-1000./scs->currset[i].o_ratio,
+ scset[i]->o_lookahead/1000.,
+ scset[i]->o_mode,
+ scset[i]->o_softknee,
+ scs->o_attack+i,scs->o_decay+i,
+ scs->o_iir+i,scs->o_peak+i,
+ active0);
- over_compand(scs->cache[i],in->data[i],adj,
- scs->prevset[i].o_thresh,
- scs->currset[i].o_thresh,
- 1.-1000./scs->prevset[i].o_ratio,
- 1.-1000./scs->currset[i].o_ratio,
- scset[i]->o_lookahead/1000.,
- scset[i]->o_mode,
- scset[i]->o_softknee,
- scs->o_attack+i,scs->o_decay+i,
- scs->o_iir+i,scs->o_peak+i,
- active0);
-
/* feedback before base */
if(scset[i]->panel_visible){
int k;
@@ -602,13 +627,14 @@
rmsfeed[i]=todB_a(&rms)*.5;
}
- base_compand(scs->cache[i],in->data[i],adj,
- 1.-1000./scs->prevset[i].b_ratio,
- 1.-1000./scs->currset[i].b_ratio,
+ if(b_active)
+ base_compand(scs->cache[i],in->data[i],adj,
+ 1.-1000./scs->prevset[i].b_ratio,
+ 1.-1000./scs->currset[i].b_ratio,
scset[i]->b_mode,
- scs->b_attack+i,scs->b_decay+i,
- scs->b_iir+i,scs->b_peak+i,
- active0);
+ scs->b_attack+i,scs->b_decay+i,
+ scs->b_iir+i,scs->b_peak+i,
+ active0);
if(active0 && out){
/* current frame should be manipulated; render into out,
@@ -656,7 +682,6 @@
}
-
if(out){
/* feedback is also triggered off of output */
singlecomp_feedback *ff=
Modified: trunk/postfish/singlepanel.c
===================================================================
--- trunk/postfish/singlepanel.c 2004-10-09 04:38:59 UTC (rev 7940)
+++ trunk/postfish/singlepanel.c 2004-10-09 06:59:48 UTC (rev 7941)
@@ -397,7 +397,7 @@
G_CALLBACK (mode_peak), &ps->ms->u_mode);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rms_button),1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(knee_button),1);
+ //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(knee_button),1);
gtk_table_attach(GTK_TABLE(undertable),envelopebox,0,4,0,1,GTK_FILL,0,0,0);
ps->u_rms=rms_button;
@@ -501,7 +501,7 @@
G_CALLBACK (mode_peak), &ps->ms->o_mode);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rms_button),1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(knee_button),1);
+ //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(knee_button),1);
gtk_table_attach(GTK_TABLE(overtable),envelopebox,0,4,0,1,GTK_FILL,0,0,0);
ps->o_rms=rms_button;
ps->o_peak=peak_button;
More information about the commits
mailing list