Commit 728a74ee authored by Monty Montgomery's avatar Monty Montgomery

Fix a multicompand panel bug where dragging the 31Hz slider in

half-octave mode does not updte the 25Hz slider in third-octave mode

Finished abstracting compander panel to allow multiple panels.



git-svn-id: https://svn.xiph.org/trunk/postfish@6580 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent ec435c2a
......@@ -43,20 +43,55 @@ typedef struct {
GtkWidget *slider;
GtkWidget *readouto;
GtkWidget *readoutu;
struct multi_panel_state *mp;
int number;
} cbar;
typedef struct {
typedef struct{
Readout *r;
sig_atomic_t *v;
} callback_arg_rv;
typedef struct{
Readout *r0;
Readout *r1;
Readout *r2;
} multireadout;
sig_atomic_t *v0;
sig_atomic_t *v1;
} callback_arg_rv2;
typedef struct{
struct multi_panel_state *mp;
int val;
} callback_arg_mi;
typedef struct multi_panel_state{
callback_arg_rv over_compand;
callback_arg_rv under_compand;
callback_arg_rv base_compand;
callback_arg_rv over_lookahead;
callback_arg_rv under_lookahead;
static int bank_active=2;
static cbar bars[multicomp_freqs_max+1];
static int inactive_updatep=1;
callback_arg_rv2 over_timing;
callback_arg_rv2 under_timing;
callback_arg_rv2 base_timing;
static void compand_change(GtkWidget *w,Readout *r,sig_atomic_t *var){
callback_arg_mi octave_full;
callback_arg_mi octave_half;
callback_arg_mi octave_third;
int bank_active;
int inactive_updatep;
int updating_av_slider;
multicompand_settings *ms;
cbar bars[multicomp_freqs_max+1];
} multi_panel_state;
multi_panel_state *master_panel;
static void compand_change(GtkWidget *w,gpointer in){
callback_arg_rv *ca=(callback_arg_rv *)in;
char buffer[80];
float val=1./multibar_get_value(MULTIBAR(w),0);
......@@ -72,112 +107,79 @@ static void compand_change(GtkWidget *w,Readout *r,sig_atomic_t *var){
sprintf(buffer,"1:%4.1f",1./val);
}
readout_set(r,buffer);
readout_set(ca->r,buffer);
*var=rint(val*1000.);
}
static void under_compand_change(GtkWidget *w,gpointer in){
compand_change(w,(Readout *)in,&multi_master_set.under_ratio);
*ca->v=rint(val*1000.);
}
static void over_compand_change(GtkWidget *w,gpointer in){
compand_change(w,(Readout *)in,&multi_master_set.over_ratio);
}
static void timing_change(GtkWidget *w,gpointer in){
callback_arg_rv2 *ca=(callback_arg_rv2 *)in;
static void base_compand_change(GtkWidget *w,gpointer in){
compand_change(w,(Readout *)in,&multi_master_set.base_ratio);
}
static void timing_display(GtkWidget *w,Readout *r,float v){
float attack=multibar_get_value(MULTIBAR(w),0);
float decay=multibar_get_value(MULTIBAR(w),1);
char buffer[80];
if(v<10){
sprintf(buffer,"%4.2fms",v);
}else if(v<100){
sprintf(buffer,"%4.1fms",v);
}else if (v<1000){
sprintf(buffer,"%4.0fms",v);
}else if (v<10000){
sprintf(buffer,"%4.2fs",v/1000.);
if(attack<10){
sprintf(buffer,"%4.2fms",attack);
}else if(attack<100){
sprintf(buffer,"%4.1fms",attack);
}else if (attack<1000){
sprintf(buffer,"%4.0fms",attack);
}else if (attack<10000){
sprintf(buffer,"%4.2fs",attack/1000.);
}else{
sprintf(buffer,"%4.1fs",v/1000.);
sprintf(buffer,"%4.1fs",attack/1000.);
}
readout_set(ca->r0,buffer);
if(decay<10){
sprintf(buffer,"%4.2fms",decay);
}else if(decay<100){
sprintf(buffer,"%4.1fms",decay);
}else if (decay<1000){
sprintf(buffer,"%4.0fms",decay);
}else if (decay<10000){
sprintf(buffer,"%4.2fs",decay/1000.);
}else{
sprintf(buffer,"%4.1fs",decay/1000.);
}
readout_set(ca->r1,buffer);
readout_set(r,buffer);
}
static void under_timing_change(GtkWidget *w,gpointer in){
multireadout *r=(multireadout *)in;
float attack=multibar_get_value(MULTIBAR(w),0);
float decay=multibar_get_value(MULTIBAR(w),1);
timing_display(w,r->r0,attack);
timing_display(w,r->r1,decay);
multi_master_set.under_attack=rint(attack*10.);
multi_master_set.under_decay=rint(decay*10.);
}
static void over_timing_change(GtkWidget *w,gpointer in){
multireadout *r=(multireadout *)in;
float attack=multibar_get_value(MULTIBAR(w),0);
float decay=multibar_get_value(MULTIBAR(w),1);
timing_display(w,r->r0,attack);
timing_display(w,r->r1,decay);
multi_master_set.over_attack=rint(attack*10.);
multi_master_set.over_decay=rint(decay*10.);
}
static void base_timing_change(GtkWidget *w,gpointer in){
multireadout *r=(multireadout *)in;
float attack=multibar_get_value(MULTIBAR(w),0);
float decay=multibar_get_value(MULTIBAR(w),1);
timing_display(w,r->r0,attack);
timing_display(w,r->r1,decay);
multi_master_set.base_attack=rint(attack*10.);
multi_master_set.base_decay=rint(decay*10.);
}
static void under_lookahead_change(GtkWidget *w,gpointer in){
char buffer[80];
Readout *r=(Readout *)in;
float val=multibar_get_value(MULTIBAR(w),0);
sprintf(buffer,"%3.0f%%",val);
readout_set(r,buffer);
multi_master_set.under_lookahead=rint(val*10.);
*ca->v0=rint(attack*10.);
*ca->v1=rint(decay*10.);
}
static void over_lookahead_change(GtkWidget *w,gpointer in){
static void lookahead_change(GtkWidget *w,gpointer in){
callback_arg_rv *ca=(callback_arg_rv *)in;
char buffer[80];
Readout *r=(Readout *)in;
Readout *r=ca->r;
float val=multibar_get_value(MULTIBAR(w),0);
sprintf(buffer,"%3.0f%%",val);
readout_set(r,buffer);
multi_master_set.over_lookahead=rint(val*10.);
*ca->v=rint(val*10.);
}
static int updating_av_slider=0;
static void average_change(GtkWidget *w,gpointer in){
cbar *b=bars+multicomp_freqs_max;
multi_panel_state *mp=(multi_panel_state *)in;
multicompand_settings *ms=mp->ms;
banked_multicompand_settings *bc=ms->bc;
cbar *b=mp->bars+multicomp_freqs_max;
cbar *bars=mp->bars;
int bank_active=mp->bank_active;
int i;
float o,u;
float oav=0,uav=0;
int i;
u=rint(multibar_get_value(MULTIBAR(b->slider),0));
o=rint(multibar_get_value(MULTIBAR(b->slider),1));
/* compute the current average */
for(i=0;i<multicomp_freqs[bank_active];i++){
oav+=rint(multi_master_set.bc[bank_active].static_o[i]);
uav+=rint(multi_master_set.bc[bank_active].static_u[i]);
oav+=rint(bc[bank_active].static_o[i]);
uav+=rint(bc[bank_active].static_u[i]);
}
oav=rint(oav/multicomp_freqs[bank_active]);
uav=rint(uav/multicomp_freqs[bank_active]);
......@@ -185,8 +187,8 @@ static void average_change(GtkWidget *w,gpointer in){
u-=uav;
o-=oav;
if(!updating_av_slider){
updating_av_slider=1;
if(!mp->updating_av_slider){
mp->updating_av_slider=1;
if(o!=0.){
/* update o sliders */
for(i=0;i<multicomp_freqs[bank_active];i++){
......@@ -196,7 +198,7 @@ static void average_change(GtkWidget *w,gpointer in){
/* update u average (might have pushed it) */
uav=0;
for(i=0;i<multicomp_freqs[bank_active];i++)
uav+=rint(multi_master_set.bc[bank_active].static_u[i]);
uav+=rint(bc[bank_active].static_u[i]);
uav=rint(uav/multicomp_freqs[bank_active]);
multibar_thumb_set(MULTIBAR(bars[multicomp_freqs_max].slider),uav,0);
}else{
......@@ -208,17 +210,22 @@ static void average_change(GtkWidget *w,gpointer in){
/* update o average (might have pushed it) */
oav=0;
for(i=0;i<multicomp_freqs[bank_active];i++)
oav+=rint(multi_master_set.bc[bank_active].static_o[i]);
oav+=rint(bc[bank_active].static_o[i]);
oav=rint(oav/multicomp_freqs[bank_active]);
multibar_thumb_set(MULTIBAR(bars[multicomp_freqs_max].slider),oav,1);
}
updating_av_slider=0;
mp->updating_av_slider=0;
}
}
static void slider_change(GtkWidget *w,gpointer in){
char buffer[80];
cbar *b=(cbar *)in;
multi_panel_state *mp=b->mp;
multicompand_settings *ms=mp->ms;
banked_multicompand_settings *bc=ms->bc;
int bank_active=mp->bank_active;
int o,u;
int i;
int adj;
......@@ -226,173 +233,174 @@ static void slider_change(GtkWidget *w,gpointer in){
u=multibar_get_value(MULTIBAR(b->slider),0);
sprintf(buffer,"%+4ddB",u);
readout_set(READOUT(b->readoutu),buffer);
multi_master_set.bc[bank_active].static_u[b->number]=u;
bc[bank_active].static_u[b->number]=u;
o=multibar_get_value(MULTIBAR(b->slider),1);
sprintf(buffer,"%+4ddB",o);
readout_set(READOUT(b->readouto),buffer);
multi_master_set.bc[bank_active].static_o[b->number]=o;
bc[bank_active].static_o[b->number]=o;
if(inactive_updatep){
if(mp->inactive_updatep){
/* keep the inactive banks also tracking settings */
switch(bank_active){
case 0:
if(b->number==0){
multi_master_set.bc[2].static_o[0]+=o-multi_master_set.bc[2].static_o[1];
multi_master_set.bc[2].static_u[0]+=u-multi_master_set.bc[2].static_u[1];
bc[2].static_o[0]+=o-bc[2].static_o[1];
bc[2].static_u[0]+=u-bc[2].static_u[1];
}
/* convolutions for roundoff behavior */
if(b->number>0){
adj=(multi_master_set.bc[1].static_o[b->number*2-1]*2 -
multi_master_set.bc[1].static_o[b->number*2-2]-multi_master_set.bc[1].static_o[b->number*2])/2;
multi_master_set.bc[1].static_o[b->number*2-1]=
(multi_master_set.bc[1].static_o[b->number*2-2]+o)/2+adj;
adj=(bc[1].static_o[b->number*2-1]*2 -
bc[1].static_o[b->number*2-2]-bc[1].static_o[b->number*2])/2;
bc[1].static_o[b->number*2-1]=
(bc[1].static_o[b->number*2-2]+o)/2+adj;
adj=(multi_master_set.bc[1].static_u[b->number*2-1]*2 -
multi_master_set.bc[1].static_u[b->number*2-2]-multi_master_set.bc[1].static_u[b->number*2])/2;
multi_master_set.bc[1].static_u[b->number*2-1]=
(multi_master_set.bc[1].static_u[b->number*2-2]+u)/2+adj;
adj=(bc[1].static_u[b->number*2-1]*2 -
bc[1].static_u[b->number*2-2]-bc[1].static_u[b->number*2])/2;
bc[1].static_u[b->number*2-1]=
(bc[1].static_u[b->number*2-2]+u)/2+adj;
adj=(multi_master_set.bc[2].static_o[b->number*3-1]*3 -
multi_master_set.bc[2].static_o[b->number*3-2] -
multi_master_set.bc[2].static_o[b->number*3-2] -
multi_master_set.bc[2].static_o[b->number*3+1])/3;
multi_master_set.bc[2].static_o[b->number*3-1]=
(multi_master_set.bc[2].static_o[b->number*3-2]+
multi_master_set.bc[2].static_o[b->number*3-2]+
adj=(bc[2].static_o[b->number*3-1]*3 -
bc[2].static_o[b->number*3-2] -
bc[2].static_o[b->number*3-2] -
bc[2].static_o[b->number*3+1])/3;
bc[2].static_o[b->number*3-1]=
(bc[2].static_o[b->number*3-2]+
bc[2].static_o[b->number*3-2]+
o)/3+adj;
adj=(multi_master_set.bc[2].static_o[b->number*3]*3 -
multi_master_set.bc[2].static_o[b->number*3-2] -
multi_master_set.bc[2].static_o[b->number*3+1] -
multi_master_set.bc[2].static_o[b->number*3+1])/3;
multi_master_set.bc[2].static_o[b->number*3]=
(multi_master_set.bc[2].static_o[b->number*3-2]+o+o)/3+adj;
adj=(bc[2].static_o[b->number*3]*3 -
bc[2].static_o[b->number*3-2] -
bc[2].static_o[b->number*3+1] -
bc[2].static_o[b->number*3+1])/3;
bc[2].static_o[b->number*3]=
(bc[2].static_o[b->number*3-2]+o+o)/3+adj;
adj=(multi_master_set.bc[2].static_u[b->number*3-1]*3 -
multi_master_set.bc[2].static_u[b->number*3-2] -
multi_master_set.bc[2].static_u[b->number*3-2] -
multi_master_set.bc[2].static_u[b->number*3+1])/3;
multi_master_set.bc[2].static_u[b->number*3-1]=
(multi_master_set.bc[2].static_u[b->number*3-2]+
multi_master_set.bc[2].static_u[b->number*3-2]+
adj=(bc[2].static_u[b->number*3-1]*3 -
bc[2].static_u[b->number*3-2] -
bc[2].static_u[b->number*3-2] -
bc[2].static_u[b->number*3+1])/3;
bc[2].static_u[b->number*3-1]=
(bc[2].static_u[b->number*3-2]+
bc[2].static_u[b->number*3-2]+
u)/3+adj;
adj=(multi_master_set.bc[2].static_u[b->number*3]*3 -
multi_master_set.bc[2].static_u[b->number*3-2] -
multi_master_set.bc[2].static_u[b->number*3+1] -
multi_master_set.bc[2].static_u[b->number*3+1])/3;
multi_master_set.bc[2].static_u[b->number*3]=
(multi_master_set.bc[2].static_u[b->number*3-2]+u+u)/3+adj;
adj=(bc[2].static_u[b->number*3]*3 -
bc[2].static_u[b->number*3-2] -
bc[2].static_u[b->number*3+1] -
bc[2].static_u[b->number*3+1])/3;
bc[2].static_u[b->number*3]=
(bc[2].static_u[b->number*3-2]+u+u)/3+adj;
}
if(b->number<9){
adj=(multi_master_set.bc[1].static_o[b->number*2+1]*2-
multi_master_set.bc[1].static_o[b->number*2+2]-multi_master_set.bc[1].static_o[b->number*2])/2;
multi_master_set.bc[1].static_o[b->number*2+1]=
(multi_master_set.bc[1].static_o[b->number*2+2]+o)/2+adj;
adj=(bc[1].static_o[b->number*2+1]*2-
bc[1].static_o[b->number*2+2]-bc[1].static_o[b->number*2])/2;
bc[1].static_o[b->number*2+1]=
(bc[1].static_o[b->number*2+2]+o)/2+adj;
adj=(multi_master_set.bc[1].static_u[b->number*2+1]*2-
multi_master_set.bc[1].static_u[b->number*2+2]-multi_master_set.bc[1].static_u[b->number*2])/2;
multi_master_set.bc[1].static_u[b->number*2+1]=
(multi_master_set.bc[1].static_u[b->number*2+2]+u)/2+adj;
adj=(bc[1].static_u[b->number*2+1]*2-
bc[1].static_u[b->number*2+2]-bc[1].static_u[b->number*2])/2;
bc[1].static_u[b->number*2+1]=
(bc[1].static_u[b->number*2+2]+u)/2+adj;
adj=(multi_master_set.bc[2].static_o[b->number*3+3]*3 -
multi_master_set.bc[2].static_o[b->number*3+4] -
multi_master_set.bc[2].static_o[b->number*3+4] -
multi_master_set.bc[2].static_o[b->number*3+1])/3;
multi_master_set.bc[2].static_o[b->number*3+3]=
(multi_master_set.bc[2].static_o[b->number*3+4]+
multi_master_set.bc[2].static_o[b->number*3+4]+
adj=(bc[2].static_o[b->number*3+3]*3 -
bc[2].static_o[b->number*3+4] -
bc[2].static_o[b->number*3+4] -
bc[2].static_o[b->number*3+1])/3;
bc[2].static_o[b->number*3+3]=
(bc[2].static_o[b->number*3+4]+
bc[2].static_o[b->number*3+4]+
o)/3+adj;
adj=(multi_master_set.bc[2].static_o[b->number*3+2]*3 -
multi_master_set.bc[2].static_o[b->number*3+4] -
multi_master_set.bc[2].static_o[b->number*3+1] -
multi_master_set.bc[2].static_o[b->number*3+1])/3;
multi_master_set.bc[2].static_o[b->number*3+2]=
(multi_master_set.bc[2].static_o[b->number*3+4]+o+o)/3+adj;
adj=(bc[2].static_o[b->number*3+2]*3 -
bc[2].static_o[b->number*3+4] -
bc[2].static_o[b->number*3+1] -
bc[2].static_o[b->number*3+1])/3;
bc[2].static_o[b->number*3+2]=
(bc[2].static_o[b->number*3+4]+o+o)/3+adj;
adj=(multi_master_set.bc[2].static_u[b->number*3+3]*3 -
multi_master_set.bc[2].static_u[b->number*3+4] -
multi_master_set.bc[2].static_u[b->number*3+4] -
multi_master_set.bc[2].static_u[b->number*3+1])/3;
multi_master_set.bc[2].static_u[b->number*3+3]=
(multi_master_set.bc[2].static_u[b->number*3+4]+
multi_master_set.bc[2].static_u[b->number*3+4]+
adj=(bc[2].static_u[b->number*3+3]*3 -
bc[2].static_u[b->number*3+4] -
bc[2].static_u[b->number*3+4] -
bc[2].static_u[b->number*3+1])/3;
bc[2].static_u[b->number*3+3]=
(bc[2].static_u[b->number*3+4]+
bc[2].static_u[b->number*3+4]+
u)/3+adj;
adj=(multi_master_set.bc[2].static_u[b->number*3+2]*3 -
multi_master_set.bc[2].static_u[b->number*3+4] -
multi_master_set.bc[2].static_u[b->number*3+1] -
multi_master_set.bc[2].static_u[b->number*3+1])/3;
multi_master_set.bc[2].static_u[b->number*3+2]=
(multi_master_set.bc[2].static_u[b->number*3+4]+u+u)/3+adj;
adj=(bc[2].static_u[b->number*3+2]*3 -
bc[2].static_u[b->number*3+4] -
bc[2].static_u[b->number*3+1] -
bc[2].static_u[b->number*3+1])/3;
bc[2].static_u[b->number*3+2]=
(bc[2].static_u[b->number*3+4]+u+u)/3+adj;
}
if(b->number==9){
multi_master_set.bc[1].static_o[19]+=o-multi_master_set.bc[1].static_o[18];
multi_master_set.bc[1].static_u[19]+=u-multi_master_set.bc[1].static_u[18];
multi_master_set.bc[2].static_o[29]+=o-multi_master_set.bc[2].static_o[28];
multi_master_set.bc[2].static_u[29]+=u-multi_master_set.bc[2].static_u[28];
bc[1].static_o[19]+=o-bc[1].static_o[18];
bc[1].static_u[19]+=u-bc[1].static_u[18];
bc[2].static_o[29]+=o-bc[2].static_o[28];
bc[2].static_u[29]+=u-bc[2].static_u[28];
}
multi_master_set.bc[1].static_o[b->number*2]=o;
multi_master_set.bc[1].static_u[b->number*2]=u;
multi_master_set.bc[2].static_o[b->number*3+1]=o;
multi_master_set.bc[2].static_u[b->number*3+1]=u;
bc[1].static_o[b->number*2]=o;
bc[1].static_u[b->number*2]=u;
bc[2].static_o[b->number*3+1]=o;
bc[2].static_u[b->number*3+1]=u;
break;
case 1:
if(b->number==0){
bc[2].static_o[0]+=o-bc[2].static_o[1];
bc[2].static_u[0]+=u-bc[2].static_u[1];
}
if((b->number&1)==0){
multi_master_set.bc[0].static_o[b->number>>1]=o;
multi_master_set.bc[0].static_u[b->number>>1]=u;
multi_master_set.bc[2].static_o[b->number/2*3+1]=o;
multi_master_set.bc[2].static_u[b->number/2*3+1]=u;
bc[0].static_o[b->number>>1]=o;
bc[0].static_u[b->number>>1]=u;
bc[2].static_o[b->number/2*3+1]=o;
bc[2].static_u[b->number/2*3+1]=u;
}else{
if(b->number<19){
int val=(multi_master_set.bc[2].static_o[b->number/2*3+2]+
multi_master_set.bc[2].static_o[b->number/2*3+3])/2;
multi_master_set.bc[2].static_o[b->number/2*3+2]+=(o-val);
multi_master_set.bc[2].static_o[b->number/2*3+3]+=(o-val);
int val=(bc[2].static_o[b->number/2*3+2]+
bc[2].static_o[b->number/2*3+3])/2;
bc[2].static_o[b->number/2*3+2]+=(o-val);
bc[2].static_o[b->number/2*3+3]+=(o-val);
val=(multi_master_set.bc[2].static_u[b->number/2*3+2]+
multi_master_set.bc[2].static_u[b->number/2*3+3])/2;
multi_master_set.bc[2].static_u[b->number/2*3+2]+=(u-val);
multi_master_set.bc[2].static_u[b->number/2*3+3]+=(u-val);
val=(bc[2].static_u[b->number/2*3+2]+
bc[2].static_u[b->number/2*3+3])/2;
bc[2].static_u[b->number/2*3+2]+=(u-val);
bc[2].static_u[b->number/2*3+3]+=(u-val);
}else{
multi_master_set.bc[2].static_o[b->number/2*3+2]=o;
multi_master_set.bc[2].static_u[b->number/2*3+2]=u;
bc[2].static_o[b->number/2*3+2]=o;
bc[2].static_u[b->number/2*3+2]=u;
}
}
if(b->number==0){
multi_master_set.bc[2].static_o[0]+=o-multi_master_set.bc[2].static_o[1];
multi_master_set.bc[2].static_u[0]+=u-multi_master_set.bc[2].static_u[1];
}
break;
case 2:
if((b->number%3)==1){
multi_master_set.bc[0].static_o[b->number/3]=o;
multi_master_set.bc[0].static_u[b->number/3]=u;
multi_master_set.bc[1].static_o[b->number/3*2]=o;
multi_master_set.bc[1].static_u[b->number/3*2]=u;
bc[0].static_o[b->number/3]=o;
bc[0].static_u[b->number/3]=u;
bc[1].static_o[b->number/3*2]=o;
bc[1].static_u[b->number/3*2]=u;
}else if(b->number>1){
if(b->number<29){
multi_master_set.bc[1].static_o[(b->number-1)/3*2+1]=
(multi_master_set.bc[2].static_o[(b->number-1)/3*3+2]+
multi_master_set.bc[2].static_o[(b->number-1)/3*3+3])/2;
multi_master_set.bc[1].static_u[(b->number-1)/3*2+1]=
(multi_master_set.bc[2].static_u[(b->number-1)/3*3+2]+
multi_master_set.bc[2].static_u[(b->number-1)/3*3+3])/2;
bc[1].static_o[(b->number-1)/3*2+1]=
(bc[2].static_o[(b->number-1)/3*3+2]+
bc[2].static_o[(b->number-1)/3*3+3])/2;
bc[1].static_u[(b->number-1)/3*2+1]=
(bc[2].static_u[(b->number-1)/3*3+2]+
bc[2].static_u[(b->number-1)/3*3+3])/2;
}else{
multi_master_set.bc[1].static_o[(b->number-1)/3*2+1]=o;
multi_master_set.bc[1].static_u[(b->number-1)/3*2+1]=u;
bc[1].static_o[(b->number-1)/3*2+1]=o;
bc[1].static_u[(b->number-1)/3*2+1]=u;
}
}
break;
......@@ -400,95 +408,91 @@ static void slider_change(GtkWidget *w,gpointer in){
}
/* update average slider */
if(!updating_av_slider && bars[multicomp_freqs_max].slider){
if(!mp->updating_av_slider && mp->bars[multicomp_freqs_max].slider){
float oav=0,uav=0;
updating_av_slider=1;
mp->updating_av_slider=1;
/* compute the current average */
for(i=0;i<multicomp_freqs[bank_active];i++){
oav+=rint(multi_master_set.bc[bank_active].static_o[i]);
uav+=rint(multi_master_set.bc[bank_active].static_u[i]);
oav+=rint(bc[bank_active].static_o[i]);
uav+=rint(bc[bank_active].static_u[i]);
}
oav=rint(oav/multicomp_freqs[bank_active]);
uav=rint(uav/multicomp_freqs[bank_active]);
multibar_thumb_set(MULTIBAR(bars[multicomp_freqs_max].slider),uav,0);
multibar_thumb_set(MULTIBAR(bars[multicomp_freqs_max].slider),oav,1);
updating_av_slider=0;
multibar_thumb_set(MULTIBAR(mp->bars[multicomp_freqs_max].slider),uav,0);
multibar_thumb_set(MULTIBAR(mp->bars[multicomp_freqs_max].slider),oav,1);
mp->updating_av_slider=0;
}
}
static void static_octave(GtkWidget *w,gpointer in){
int octave=(int)in,i;
callback_arg_mi *ca=(callback_arg_mi *)in;
multi_panel_state *mp=ca->mp;
multicompand_settings *ms=mp->ms;
banked_multicompand_settings *bc=ms->bc;
int octave=ca->val,i;
if(!w || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))){
if(bank_active!=octave || w==NULL){
bank_active=octave;
if(mp->bank_active!=octave || w==NULL){
int bank_active=mp->bank_active=octave;
/* map, unmap, relabel */
for(i=0;i<multicomp_freqs_max;i++){
if(i<multicomp_freqs[bank_active]){
gtk_label_set_text(GTK_LABEL(bars[i].label),
gtk_label_set_text(GTK_LABEL(mp->bars[i].label),
multicomp_freq_labels[bank_active][i]);
gtk_widget_show(bars[i].label);
gtk_widget_show(bars[i].slider);
gtk_widget_show(bars[i].readouto);
gtk_widget_show(bars[i].readoutu);
gtk_widget_show(mp->bars[i].label);
gtk_widget_show(mp->bars[i].slider);
gtk_widget_show(mp->bars[i].readouto);
gtk_widget_show(mp->bars[i].readoutu);
inactive_updatep=0;
mp->inactive_updatep=0;
{
float o=multi_master_set.bc[bank_active].static_o[i];
float u=multi_master_set.bc[bank_active].static_u[i];
multibar_thumb_set(MULTIBAR(bars[i].slider),u,0);
multibar_thumb_set(MULTIBAR(bars[i].slider),o,1);
float o=bc[bank_active].static_o[i];
float u=bc[bank_active].static_u[i];