[xiph-cvs] r6586 - trunk/postfish
xiphmont at xiph.org
xiphmont at xiph.org
Tue May 4 21:26:22 PDT 2004
Author: xiphmont
Date: 2004-04-23 20:02:26 -0400 (Fri, 23 Apr 2004)
New Revision: 6586
Modified:
trunk/postfish/compandpanel.c
trunk/postfish/mainpanel.c
trunk/postfish/output.c
trunk/postfish/suppress.c
trunk/postfish/suppress.h
trunk/postfish/suppresspanel.c
trunk/postfish/suppresspanel.h
trunk/postfish/version.h
Log:
Per-channel version of Deverb filter now active
<p><p>Modified: trunk/postfish/compandpanel.c
===================================================================
--- trunk/postfish/compandpanel.c 2004-04-23 21:46:53 UTC (rev 6585)
+++ trunk/postfish/compandpanel.c 2004-04-24 00:02:26 UTC (rev 6586)
@@ -89,8 +89,8 @@
} multi_panel_state;
-multi_panel_state *master_panel;
-multi_panel_state **channel_panel;
+static multi_panel_state *master_panel;
+static multi_panel_state **channel_panel;
static void compand_change(GtkWidget *w,gpointer in){
callback_arg_rv *ca=(callback_arg_rv *)in;
Modified: trunk/postfish/mainpanel.c
===================================================================
--- trunk/postfish/mainpanel.c 2004-04-23 21:46:53 UTC (rev 6585)
+++ trunk/postfish/mainpanel.c 2004-04-24 00:02:26 UTC (rev 6586)
@@ -951,7 +951,7 @@
mainpanel_chentry(panel,channeltable,"_Declip ",1,1,0,clippanel_create);
mainpanel_chentry(panel,channeltable,"_Multicomp ",2,0,1,compandpanel_create_channel);
mainpanel_chentry(panel,channeltable,"_Onecomp ",3,0,1,0);
- mainpanel_chentry(panel,channeltable,"De_verb ",4,1,0,0);
+ mainpanel_chentry(panel,channeltable,"De_verb ",4,1,0,suppresspanel_create_channel);
mainpanel_chentry(panel,channeltable,"_Reverb ",5,1,0,0);
mainpanel_chentry(panel,channeltable,"_EQ ",6,0,1,0);
@@ -979,7 +979,7 @@
mainpanel_masterentry(panel,mastertable,"_Crossmix "," c ",GDK_c,0,0);
mainpanel_masterentry(panel,mastertable,"_Multicomp "," m ",GDK_m,1,compandpanel_create_master);
mainpanel_masterentry(panel,mastertable,"_Onecomp "," o ",GDK_o,2,singlepanel_create);
- mainpanel_masterentry(panel,mastertable,"De_verb "," v ",GDK_v,3,suppresspanel_create);
+ mainpanel_masterentry(panel,mastertable,"De_verb "," v ",GDK_v,3,suppresspanel_create_master);
mainpanel_masterentry(panel,mastertable,"_Reverb "," r ",GDK_r,4,0);
mainpanel_masterentry(panel,mastertable,"_EQ "," e ",GDK_e,5,eqpanel_create);
mainpanel_masterentry(panel,mastertable,"_Limit "," l ",GDK_l,6,limitpanel_create);
Modified: trunk/postfish/output.c
===================================================================
--- trunk/postfish/output.c 2004-04-23 21:46:53 UTC (rev 6585)
+++ trunk/postfish/output.c 2004-04-24 00:02:26 UTC (rev 6586)
@@ -240,12 +240,14 @@
result|=link->samples;
link=multicompand_read_channel(link);
result|=link->samples;
+ link=suppress_read_channel(link);
+ result|=link->samples;
link=multicompand_read_master(link);
result|=link->samples;
link=singlecomp_read(link);
result|=link->samples;
- link=suppress_read(link);
+ link=suppress_read_master(link);
result|=link->samples;
link=eq_read(link);
result|=link->samples;
Modified: trunk/postfish/suppress.c
===================================================================
--- trunk/postfish/suppress.c 2004-04-23 21:46:53 UTC (rev 6585)
+++ trunk/postfish/suppress.c 2004-04-24 00:02:26 UTC (rev 6586)
@@ -47,7 +47,6 @@
typedef struct {
subband_state ss;
- subband_window sw;
iir_filter smooth;
iir_filter trigger;
@@ -59,27 +58,32 @@
} suppress_state;
-sig_atomic_t suppress_visible;
-sig_atomic_t suppress_active;
+suppress_settings suppress_master_set;
+suppress_settings suppress_channel_set;
+static suppress_state master_state;
+static suppress_state channel_state;
+static subband_window sw;
-suppress_settings sset;
-static suppress_state sss;
-
void suppress_reset(){
int i,j;
- subband_reset(&sss.ss);
+ subband_reset(&master_state.ss);
+ subband_reset(&channel_state.ss);
for(i=0;i<suppress_freqs;i++){
for(j=0;j<input_ch;j++){
- memset(&sss.iirS[i][j],0,sizeof(iir_state));
- memset(&sss.iirT[i][j],0,sizeof(iir_state));
- memset(&sss.iirR[i][j],0,sizeof(iir_state));
+ memset(&master_state.iirS[i][j],0,sizeof(iir_state));
+ memset(&master_state.iirT[i][j],0,sizeof(iir_state));
+ memset(&master_state.iirR[i][j],0,sizeof(iir_state));
+ memset(&channel_state.iirS[i][j],0,sizeof(iir_state));
+ memset(&channel_state.iirT[i][j],0,sizeof(iir_state));
+ memset(&channel_state.iirR[i][j],0,sizeof(iir_state));
}
}
}
-static void filter_set(float msec,
+static void filter_set(subband_state *ss,
+ float msec,
iir_filter *filter,
int attackp,
int order){
@@ -88,9 +92,9 @@
/* make sure the chosen frequency doesn't require a lookahead
greater than what's available */
- if(impulse_freq4(input_size*2-sss.ss.qblocksize*3)*1.01>corner_freq &&
+ if(impulse_freq4(input_size*2-ss->qblocksize*3)*1.01>corner_freq &&
attackp)
- corner_freq=impulse_freq4(input_size*2-sss.ss.qblocksize*3);
+ corner_freq=impulse_freq4(input_size*2-ss->qblocksize*3);
alpha=corner_freq/input_rate;
filter->g=mkbessel(alpha,order,filter->c);
@@ -102,34 +106,43 @@
int suppress_load(void){
int i;
int qblocksize=input_size/16;
- memset(&sss,0,sizeof(sss));
+ memset(&master_state,0,sizeof(master_state));
+ memset(&channel_state,0,sizeof(channel_state));
- subband_load(&sss.ss,suppress_freqs,qblocksize);
- subband_load_freqs(&sss.ss,&sss.sw,suppress_freq_list,suppress_freqs);
+ suppress_master_set.active=calloc(input_ch,sizeof(*suppress_master_set.active));
+ suppress_channel_set.active=calloc(input_ch,sizeof(*suppress_channel_set.active));
+
+ subband_load(&master_state.ss,suppress_freqs,qblocksize);
+ subband_load(&channel_state.ss,suppress_freqs,qblocksize);
+
+ subband_load_freqs(&master_state.ss,&sw,suppress_freq_list,suppress_freqs);
for(i=0;i<suppress_freqs;i++){
- sss.iirS[i]=calloc(input_ch,sizeof(iir_state));
- sss.iirT[i]=calloc(input_ch,sizeof(iir_state));
- sss.iirR[i]=calloc(input_ch,sizeof(iir_state));
+ master_state.iirS[i]=calloc(input_ch,sizeof(iir_state));
+ master_state.iirT[i]=calloc(input_ch,sizeof(iir_state));
+ master_state.iirR[i]=calloc(input_ch,sizeof(iir_state));
+ channel_state.iirS[i]=calloc(input_ch,sizeof(iir_state));
+ channel_state.iirT[i]=calloc(input_ch,sizeof(iir_state));
+ channel_state.iirR[i]=calloc(input_ch,sizeof(iir_state));
}
return 0;
}
-static void suppress_work(void *vs){
+static void suppress_work_helper(void *vs, suppress_settings *sset){
suppress_state *sss=(suppress_state *)vs;
subband_state *ss=&sss->ss;
int i,j,k,l;
- float smoothms=sset.smooth*.1;
- float triggerms=sset.trigger*.1;
- float releasems=sset.release*.1;
+ float smoothms=sset->smooth*.1;
+ float triggerms=sset->trigger*.1;
+ float releasems=sset->release*.1;
iir_filter *trigger=&sss->trigger;
iir_filter *smooth=&sss->smooth;
iir_filter *release=&sss->release;
int ahead;
- if(smoothms!=smooth->ms)filter_set(smoothms,smooth,1,4);
- if(triggerms!=trigger->ms)filter_set(triggerms,trigger,0,1);
- if(releasems!=release->ms)filter_set(releasems,release,0,1);
+ if(smoothms!=smooth->ms)filter_set(ss,smoothms,smooth,1,4);
+ if(triggerms!=trigger->ms)filter_set(ss,triggerms,trigger,0,1);
+ if(releasems!=release->ms)filter_set(ss,releasems,release,0,1);
ahead=impulse_ahead4(smooth->alpha);
@@ -137,7 +150,7 @@
int firstlink=0;
float fast[input_size];
float slow[input_size];
- float multiplier = 1.-1000./sset.ratio[i];
+ float multiplier = 1.-1000./sset->ratio[i];
for(j=0;j<input_ch;j++){
int active=(ss->effect_active1[j] ||
@@ -145,7 +158,7 @@
ss->effect_activeC[j]);
if(active){
- if(sset.linkp){
+ if(sset->linkp){
if(!firstlink){
firstlink++;
memset(fast,0,sizeof(fast));
@@ -167,7 +180,7 @@
}
- if(sset.linkp==0 || firstlink==1){
+ if(sset->linkp==0 || firstlink==1){
compute_iir_symmetric4(fast, input_size, &sss->iirS[i][j],
smooth);
@@ -186,7 +199,7 @@
fast[k]=fromdB_a((todB_a(slow+k)-todB_a(fast+k))*.5*multiplier);
//_analysis("adj",i,fast,input_size,1,offset);
- if(sset.linkp && firstlink==1){
+ if(sset->linkp && firstlink==1){
for(l=0;l<input_ch;l++){
if(l!=j){
@@ -217,19 +230,42 @@
}
}
-time_linkage *suppress_read(time_linkage *in){
+static void suppress_work_master(void *vs){
+ suppress_work_helper(vs,&suppress_master_set);
+}
+
+static void suppress_work_channel(void *vs){
+ suppress_work_helper(vs,&suppress_channel_set);
+}
+
+time_linkage *suppress_read_master(time_linkage *in){
int visible[input_ch];
- int active[input_ch];
+ int active [input_ch];
subband_window *w[input_ch];
int i;
+
+ for(i=0;i<input_ch;i++){
+ visible[i]=0;
+ active[i]=suppress_master_set.active[0];
+ w[i]=&sw;
+ }
+
+ return subband_read(in, &master_state.ss, w, visible, active,
+ suppress_work_master, &master_state);
+}
+time_linkage *suppress_read_channel(time_linkage *in){
+ int visible[input_ch];
+ int active [input_ch];
+ subband_window *w[input_ch];
+ int i;
+
for(i=0;i<input_ch;i++){
visible[i]=0;
- active[i]=suppress_active;
- w[i]=&sss.sw;
+ active[i]=suppress_channel_set.active[i];
+ w[i]=&sw;
}
- return subband_read(in, &sss.ss, w, visible, active, suppress_work, &sss);
+ return subband_read(in, &channel_state.ss, w, visible, active,
+ suppress_work_channel, &channel_state);
}
-
-
Modified: trunk/postfish/suppress.h
===================================================================
--- trunk/postfish/suppress.h 2004-04-23 21:46:53 UTC (rev 6585)
+++ trunk/postfish/suppress.h 2004-04-24 00:02:26 UTC (rev 6586)
@@ -38,9 +38,13 @@
sig_atomic_t trigger;
sig_atomic_t release;
sig_atomic_t linkp;
+
+ sig_atomic_t *active;
+ sig_atomic_t panel_visible;
} suppress_settings;
extern void suppress_reset();
extern int suppress_load(void);
-extern time_linkage *suppress_read(time_linkage *in);
+extern time_linkage *suppress_read_master(time_linkage *in);
+extern time_linkage *suppress_read_channel(time_linkage *in);
Modified: trunk/postfish/suppresspanel.c
===================================================================
--- trunk/postfish/suppresspanel.c 2004-04-23 21:46:53 UTC (rev 6585)
+++ trunk/postfish/suppresspanel.c 2004-04-24 00:02:26 UTC (rev 6586)
@@ -32,26 +32,38 @@
#include "suppress.h"
#include "suppresspanel.h"
-extern sig_atomic_t suppress_active;
-extern sig_atomic_t suppress_visible;
extern int input_ch;
extern int input_size;
extern int input_rate;
-extern suppress_settings sset;
+extern suppress_settings suppress_master_set;
+extern suppress_settings suppress_channel_set;
typedef struct {
GtkWidget *cslider;
Readout *readoutc;
+ struct suppress_panel_state *sp;
+ sig_atomic_t *v;
int number;
} tbar;
-Readout *readoutsmooth;
-Readout *readouttrigger;
-Readout *readoutrelease;
+typedef struct{
+ Readout *r0;
+ Readout *r1;
+ Readout *r2;
+ sig_atomic_t *v0;
+ sig_atomic_t *v1;
+ sig_atomic_t *v2;
+} callback_arg_rv3;
-static tbar bars[suppress_freqs+1];
+typedef struct suppress_panel_state{
+ callback_arg_rv3 timing;
+ tbar bars[suppress_freqs+1];
+} suppress_panel_state;
+static suppress_panel_state *master_panel;
+static suppress_panel_state *channel_panel;
+
static void compand_change(GtkWidget *w,gpointer in){
char buffer[80];
tbar *bar=(tbar *)in;
@@ -64,11 +76,11 @@
readout_set(bar->readoutc,buffer);
- sset.ratio[bar->number]=1000./val;
-
+ *bar->v=1000./val;
}
static void timing_change(GtkWidget *w,gpointer in){
+ callback_arg_rv3 *ca=(callback_arg_rv3 *)in;
char buffer[80];
float smooth=multibar_get_value(MULTIBAR(w),0);
float trigger=multibar_get_value(MULTIBAR(w),1);
@@ -83,7 +95,7 @@
}else{
sprintf(buffer," %4.1fs",smooth/1000.);
}
- readout_set(readoutsmooth,buffer);
+ readout_set(ca->r0,buffer);
if(trigger<100){
sprintf(buffer,"%4.1fms",trigger);
@@ -94,7 +106,7 @@
}else{
sprintf(buffer," %4.1fs",trigger/1000.);
}
- readout_set(readouttrigger,buffer);
+ readout_set(ca->r1,buffer);
if(release<100){
sprintf(buffer,"%4.1fms",release);
@@ -105,21 +117,21 @@
}else{
sprintf(buffer," %4.1fs",release/1000.);
}
- readout_set(readoutrelease,buffer);
+ readout_set(ca->r2,buffer);
- sset.smooth=rint(smooth*10.);
- sset.trigger=rint(trigger*10.);
- sset.release=rint(release*10.);
+ *ca->v0=rint(smooth*10.);
+ *ca->v1=rint(trigger*10.);
+ *ca->v2=rint(release*10.);
}
static void suppress_link(GtkToggleButton *b,gpointer in){
int mode=gtk_toggle_button_get_active(b);
- sset.linkp=mode;
+ *((sig_atomic_t *)in)=mode;
}
-void suppresspanel_create(postfish_mainpanel *mp,
- GtkWidget *windowbutton,
- GtkWidget *activebutton){
+static suppress_panel_state *suppresspanel_create_helper(postfish_mainpanel *mp,
+ subpanel_generic *panel,
+ suppress_settings *sset){
int i;
float compand_levels[5]={1,1.5,2,3,5};
char *compand_labels[4]={"1.5","2","3","5"};
@@ -127,15 +139,6 @@
float timing_levels[5]={1, 10, 100, 1000, 10000};
char *timing_labels[4]={"10ms"," 100ms","1s","10s"};
- char *shortcut[]={" v "};
-
- subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
- &suppress_active,
- &suppress_visible,
- "De_verberation filter",shortcut,
- 0,1);
-
-
GtkWidget *table=gtk_table_new(suppress_freqs+4,5,0);
GtkWidget *timinglabel=gtk_label_new("suppressor filter timing");
GtkWidget *releaselabel=gtk_label_new("release");
@@ -147,6 +150,8 @@
gtk_check_button_new_with_mnemonic("_link channels into single image");
GtkWidget *linkbox=gtk_hbox_new(0,0);
+ suppress_panel_state *ps=calloc(1,sizeof(suppress_panel_state));
+
gtk_container_add(GTK_CONTAINER(panel->subpanel_box),table);
gtk_box_pack_end(GTK_BOX(linkbox),linkbutton,0,0,0);
@@ -189,18 +194,22 @@
gtk_widget_set_name(compandlabel,"framelabel");
g_signal_connect (G_OBJECT (linkbutton), "clicked",
- G_CALLBACK (suppress_link), 0);
+ G_CALLBACK (suppress_link), &sset->linkp);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linkbutton),1);
/* timing controls */
{
GtkWidget *slider=multibar_slider_new(4,timing_labels,timing_levels,3);
-
- readoutsmooth=READOUT(readout_new("10.0ms"));
- readouttrigger=READOUT(readout_new("10.0ms"));
- readoutrelease=READOUT(readout_new("10.0ms"));
- multibar_callback(MULTIBAR(slider),timing_change,0);
+ ps->timing.r0=READOUT(readout_new("10.0ms"));
+ ps->timing.r1=READOUT(readout_new("10.0ms"));
+ ps->timing.r2=READOUT(readout_new("10.0ms"));
+
+ ps->timing.v0=&sset->smooth;
+ ps->timing.v1=&sset->trigger;
+ ps->timing.v2=&sset->release;
+
+ multibar_callback(MULTIBAR(slider),timing_change,&ps->timing);
multibar_thumb_set(MULTIBAR(slider),20,0);
multibar_thumb_set(MULTIBAR(slider),100,1);
@@ -208,11 +217,11 @@
gtk_table_attach(GTK_TABLE(table),slider,1,2,1,2,
GTK_FILL|GTK_EXPAND,GTK_EXPAND,5,0);
- gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(readoutsmooth),2,3,1,2,
+ gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->timing.r0),2,3,1,2,
0,0,0,0);
- gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(readouttrigger),3,4,1,2,
+ gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->timing.r1),3,4,1,2,
0,0,0,0);
- gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(readoutrelease),4,5,1,2,
+ gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->timing.r2),4,5,1,2,
0,0,0,0);
}
@@ -222,24 +231,54 @@
GtkWidget *label=gtk_label_new(suppress_freq_labels[i]);
gtk_widget_set_name(label,"scalemarker");
- bars[i].readoutc=READOUT(readout_new("1.55:1"));
- bars[i].cslider=multibar_slider_new(4,compand_labels,compand_levels,1);
- bars[i].number=i;
+ ps->bars[i].readoutc=READOUT(readout_new("1.55:1"));
+ ps->bars[i].cslider=multibar_slider_new(4,compand_labels,compand_levels,1);
+ ps->bars[i].sp=ps;
+ ps->bars[i].v=sset->ratio+i;
+ ps->bars[i].number=i;
- multibar_callback(MULTIBAR(bars[i].cslider),compand_change,bars+i);
- multibar_thumb_set(MULTIBAR(bars[i].cslider),1,0);
+ multibar_callback(MULTIBAR(ps->bars[i].cslider),compand_change,ps->bars+i);
+ multibar_thumb_set(MULTIBAR(ps->bars[i].cslider),1,0);
gtk_misc_set_alignment(GTK_MISC(label),1,.5);
gtk_table_attach(GTK_TABLE(table),label,0,1,i+3,i+4,
GTK_FILL,0,0,0);
- gtk_table_attach(GTK_TABLE(table),bars[i].cslider,1,4,i+3,i+4,
+ gtk_table_attach(GTK_TABLE(table),ps->bars[i].cslider,1,4,i+3,i+4,
GTK_FILL|GTK_EXPAND,GTK_EXPAND,5,0);
- gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(bars[i].readoutc),4,5,
+ gtk_table_attach(GTK_TABLE(table),GTK_WIDGET(ps->bars[i].readoutc),4,5,
i+3,i+4,0,0,0,0);
}
subpanel_show_all_but_toplevel(panel);
+ return ps;
}
+void suppresspanel_create_master(postfish_mainpanel *mp,
+ GtkWidget *windowbutton,
+ GtkWidget *activebutton){
+
+ char *shortcut[]={" v "};
+
+ subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
+ &suppress_master_set.active[0],
+ &suppress_master_set.panel_visible,
+ "De_verberation filter (master)",shortcut,
+ 0,1);
+
+ master_panel=suppresspanel_create_helper(mp,panel,&suppress_master_set);
+}
+
+void suppresspanel_create_channel(postfish_mainpanel *mp,
+ GtkWidget **windowbutton,
+ GtkWidget **activebutton){
+
+ subpanel_generic *panel=subpanel_create(mp,windowbutton[0],activebutton,
+ suppress_channel_set.active,
+ &suppress_channel_set.panel_visible,
+ "De_verberation filter",0,
+ 0,input_ch);
+
+ channel_panel=suppresspanel_create_helper(mp,panel,&suppress_channel_set);
+}
Modified: trunk/postfish/suppresspanel.h
===================================================================
--- trunk/postfish/suppresspanel.h 2004-04-23 21:46:53 UTC (rev 6585)
+++ trunk/postfish/suppresspanel.h 2004-04-24 00:02:26 UTC (rev 6586)
@@ -21,6 +21,10 @@
*
*/
-extern void suppresspanel_create(postfish_mainpanel *mp,
- GtkWidget *windowbutton,
- GtkWidget *activebutton);
+extern void suppresspanel_create_master(postfish_mainpanel *mp,
+ GtkWidget *windowbutton,
+ GtkWidget *activebutton);
+
+extern void suppresspanel_create_channel(postfish_mainpanel *mp,
+ GtkWidget **windowbutton,
+ GtkWidget **activebutton);
Modified: trunk/postfish/version.h
===================================================================
--- trunk/postfish/version.h 2004-04-23 21:46:53 UTC (rev 6585)
+++ trunk/postfish/version.h 2004-04-24 00:02:26 UTC (rev 6586)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Fri Apr 23 17:45:27 EDT 2004] */
+/* DO NOT EDIT: Automated versioning hack [Fri Apr 23 20:01:01 EDT 2004] */
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list