[xiph-commits] r18490 - trunk/postfish

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Wed Aug 1 08:39:09 PDT 2012


Author: xiphmont
Date: 2012-08-01 08:39:09 -0700 (Wed, 01 Aug 2012)
New Revision: 18490

Modified:
   trunk/postfish/clippanel.c
   trunk/postfish/compandpanel.c
   trunk/postfish/deverbpanel.c
   trunk/postfish/eqpanel.c
   trunk/postfish/limitpanel.c
   trunk/postfish/main.c
   trunk/postfish/mainpanel.c
   trunk/postfish/mainpanel.h
   trunk/postfish/mixpanel.c
   trunk/postfish/outpanel.c
   trunk/postfish/outpanel.h
   trunk/postfish/reverbpanel.c
   trunk/postfish/singlepanel.c
   trunk/postfish/version.h
Log:
Add batch mode operation with -B; allows a previously saved config to be 
applied to any input without popping the UI.



Modified: trunk/postfish/clippanel.c
===================================================================
--- trunk/postfish/clippanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/clippanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -46,7 +46,7 @@
 
 static GtkWidget *mainpanel_inbar;
 
-static subpanel_generic *panel;
+static subpanel_generic *panel=NULL;
 
 typedef struct {
   GtkWidget *slider;
@@ -71,18 +71,19 @@
   config_get_sigat("clippanel_throttle",bank,0,0,0,0,&declip_iterations);
   config_get_vector("clippanel_trigger",bank,0,0,0,input_ch,declip_chtrigger);
 
-  {
+  if(panel){
     int i=0,j=declip_pending_blocksize;
     while(j>64){j>>=1;i++;}
     multibar_thumb_set(MULTIBAR(width_bar),i,0);
-  }
-  multibar_thumb_set(MULTIBAR(depth_bar),declip_convergence*-.1,0);
-  multibar_thumb_set(MULTIBAR(limit_bar),declip_iterations*.1,0);
 
-  for(i=0;i<input_ch;i++){
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel->subpanel_activebutton[i]),
-				 declip_active[i]);
-    multibar_thumb_set(MULTIBAR(trigger_bars[i]),declip_chtrigger[i]*.0001,0);
+    multibar_thumb_set(MULTIBAR(depth_bar),declip_convergence*-.1,0);
+    multibar_thumb_set(MULTIBAR(limit_bar),declip_iterations*.1,0);
+
+    for(i=0;i<input_ch;i++){
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel->subpanel_activebutton[i]),
+                                   declip_active[i]);
+      multibar_thumb_set(MULTIBAR(trigger_bars[i]),declip_chtrigger[i]*.0001,0);
+    }
   }
 }
 

Modified: trunk/postfish/compandpanel.c
===================================================================
--- trunk/postfish/compandpanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/compandpanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -101,7 +101,7 @@
 } multi_panel_state;
 
 static multi_panel_state *master_panel;
-static multi_panel_state **channel_panel;
+static multi_panel_state *channel_panel[MAX_INPUT_CHANNELS];
 
 
 static void compandpanel_state_to_config_helper(int bank,multicompand_settings *s,int A){
@@ -148,7 +148,7 @@
 
   int i;
   config_get_sigat("multicompand_active",bank,A,0,0,0,&s->panel_active);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->panel->subpanel_activebutton[0]),s->panel_active);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->panel->subpanel_activebutton[0]),s->panel_active);
 
   config_get_sigat("multicompand_freqbank",bank,A,0,0,0,&s->active_bank);
   for(i=0;i<multicomp_banks;i++){
@@ -157,65 +157,73 @@
   }
 
   config_get_sigat("multicompand_over_set",bank,A,0,0,0,&s->over_mode);
-  if(s->over_mode)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->over_peak),1);
-  else
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->over_rms),1);
+  if(p){
+    if(s->over_mode)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->over_peak),1);
+    else
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->over_rms),1);
+  }
 
   config_get_sigat("multicompand_over_set",bank,A,0,0,1,&s->over_softknee);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->over_softknee),s->over_softknee);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->over_softknee),s->over_softknee);
   config_get_sigat("multicompand_over_set",bank,A,0,0,2,&s->over_ratio);
-  multibar_thumb_set(p->over_compand.s,1000./s->over_ratio,0);
+  if(p)multibar_thumb_set(p->over_compand.s,1000./s->over_ratio,0);
   config_get_sigat("multicompand_over_set",bank,A,0,0,3,&s->over_attack);
-  multibar_thumb_set(p->over_timing.s,s->over_attack*.1,0);
+  if(p)multibar_thumb_set(p->over_timing.s,s->over_attack*.1,0);
   config_get_sigat("multicompand_over_set",bank,A,0,0,4,&s->over_decay);
-  multibar_thumb_set(p->over_timing.s,s->over_decay*.1,1);
+  if(p)multibar_thumb_set(p->over_timing.s,s->over_decay*.1,1);
   config_get_sigat("multicompand_over_set",bank,A,0,0,5,&s->over_lookahead);
-  multibar_thumb_set(p->over_lookahead.s,s->over_lookahead*.1,0);
+  if(p)multibar_thumb_set(p->over_lookahead.s,s->over_lookahead*.1,0);
 
   config_get_sigat("multicompand_under_set",bank,A,0,0,0,&s->under_mode);
-  if(s->under_mode)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->under_peak),1);
-  else
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->under_rms),1);
+  if(p){
+    if(s->under_mode)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->under_peak),1);
+    else
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->under_rms),1);
+  }
 
   config_get_sigat("multicompand_under_set",bank,A,0,0,1,&s->under_softknee);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->under_softknee),s->under_softknee);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->under_softknee),s->under_softknee);
   config_get_sigat("multicompand_under_set",bank,A,0,0,2,&s->under_ratio);
-  multibar_thumb_set(p->under_compand.s,1000./s->under_ratio,0);
+  if(p)multibar_thumb_set(p->under_compand.s,1000./s->under_ratio,0);
   config_get_sigat("multicompand_under_set",bank,A,0,0,3,&s->under_attack);
-  multibar_thumb_set(p->under_timing.s,s->under_attack*.1,0);
+  if(p)multibar_thumb_set(p->under_timing.s,s->under_attack*.1,0);
   config_get_sigat("multicompand_under_set",bank,A,0,0,4,&s->under_decay);
-  multibar_thumb_set(p->under_timing.s,s->under_decay*.1,1);
+  if(p)multibar_thumb_set(p->under_timing.s,s->under_decay*.1,1);
   config_get_sigat("multicompand_under_set",bank,A,0,0,5,&s->under_lookahead);
-  multibar_thumb_set(p->under_lookahead.s,s->under_lookahead*.1,0);
+  if(p)multibar_thumb_set(p->under_lookahead.s,s->under_lookahead*.1,0);
 
   config_get_sigat("multicompand_base_set",bank,A,0,0,0,&s->base_mode);
-  if(s->base_mode)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->base_peak),1);
-  else
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->base_rms),1);
+  if(p){
+    if(s->base_mode)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->base_peak),1);
+    else
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->base_rms),1);
+  }
   config_get_sigat("multicompand_base_set",bank,A,0,0,2,&s->base_ratio);
-  multibar_thumb_set(p->base_compand.s,1000./s->base_ratio,0);
+  if(p)multibar_thumb_set(p->base_compand.s,1000./s->base_ratio,0);
   config_get_sigat("multicompand_base_set",bank,A,0,0,3,&s->base_attack);
-  multibar_thumb_set(p->base_timing.s,s->base_attack*.1,0);
+  if(p)multibar_thumb_set(p->base_timing.s,s->base_attack*.1,0);
   config_get_sigat("multicompand_base_set",bank,A,0,0,4,&s->base_decay);
-  multibar_thumb_set(p->base_timing.s,s->base_decay*.1,1);
+  if(p)multibar_thumb_set(p->base_timing.s,s->base_decay*.1,1);
 
   propogate_bank_changes_full(s,s->active_bank);
   /* setting the active bank also redisplays all the sliders */
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->octave[s->active_bank]),1);
-  /* safe to call blindly; if the above already triggered the work, this is a no op */
-  switch(s->active_bank){  
-  case 0:
-    static_octave(0,&p->octave_full);
-    break;
-  case 1:
-    static_octave(0,&p->octave_half);
-    break;
-  case 2:
-    static_octave(0,&p->octave_two);
-    break;
+  if(p){
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->octave[s->active_bank]),1);
+    /* safe to call blindly; if the above already triggered the work, this is a no op */
+    switch(s->active_bank){  
+    case 0:
+      static_octave(0,&p->octave_full);
+      break;
+    case 1:
+      static_octave(0,&p->octave_half);
+      break;
+    case 2:
+      static_octave(0,&p->octave_two);
+      break;
+    }
   }
 }
 
@@ -1034,8 +1042,6 @@
 				 GtkWidget **activebutton){
   int i;
   
-  channel_panel=calloc(input_ch,sizeof(*channel_panel));
-
   /* a panel for each channel */
   for(i=0;i<input_ch;i++){
     subpanel_generic *panel;

Modified: trunk/postfish/deverbpanel.c
===================================================================
--- trunk/postfish/deverbpanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/deverbpanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -71,23 +71,28 @@
   int i;
 
   config_get_vector("deverbpanel_active",bank,0,0,0,input_ch,deverb_channel_set.active);
-  for(i=0;i<input_ch;i++)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(channel_panel->panel->subpanel_activebutton[i]),
-				 deverb_channel_set.active[i]);
+  if(channel_panel)
+    for(i=0;i<input_ch;i++)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(channel_panel->panel->subpanel_activebutton[i]),
+                                   deverb_channel_set.active[i]);
 
   config_get_vector("deverbpanel_ratio",bank,0,0,0,deverb_freqs,deverb_channel_set.ratio);
-  for(i=0;i<deverb_freqs;i++)
-    multibar_thumb_set(MULTIBAR(channel_panel->bars[i].cslider),
-		       1000./deverb_channel_set.ratio[i],0);
+  if(channel_panel)
+    for(i=0;i<deverb_freqs;i++)
+      multibar_thumb_set(MULTIBAR(channel_panel->bars[i].cslider),
+                         1000./deverb_channel_set.ratio[i],0);
 
   config_get_sigat("deverbpanel_set",bank,0,0,0,0,&deverb_channel_set.linkp);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(channel_panel->link),deverb_channel_set.linkp);
+  if(channel_panel)
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(channel_panel->link),deverb_channel_set.linkp);
   
   config_get_sigat("deverbpanel_set",bank,0,0,0,1,&deverb_channel_set.smooth);
-  multibar_thumb_set(MULTIBAR(channel_panel->timing.s),deverb_channel_set.smooth*.1,0);
+  if(channel_panel)
+    multibar_thumb_set(MULTIBAR(channel_panel->timing.s),deverb_channel_set.smooth*.1,0);
 
   config_get_sigat("deverbpanel_set",bank,0,0,0,3,&deverb_channel_set.release);
-  multibar_thumb_set(MULTIBAR(channel_panel->timing.s),deverb_channel_set.release*.1,1);
+  if(channel_panel)
+    multibar_thumb_set(MULTIBAR(channel_panel->timing.s),deverb_channel_set.release*.1,1);
 }
 
 static void compand_change(GtkWidget *w,gpointer in){

Modified: trunk/postfish/eqpanel.c
===================================================================
--- trunk/postfish/eqpanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/eqpanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -48,7 +48,7 @@
 } eq_panel_state;
 
 static eq_panel_state *master_panel;
-static eq_panel_state **channel_panel;
+static eq_panel_state *channel_panel[MAX_INPUT_CHANNELS];
 
 static void eqpanel_state_to_config_helper(int bank,eq_settings *s,int A){
   config_set_integer("eq_active",bank,A,0,0,0,s->panel_active);
@@ -67,11 +67,12 @@
 
   int i;
   config_get_sigat("eq_active",bank,A,0,0,0,&s->panel_active);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->panel->subpanel_activebutton[0]),s->panel_active);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->panel->subpanel_activebutton[0]),s->panel_active);
 
   config_get_vector("eq_settings",bank,A,0,0,eq_freqs,s->settings);
-  for(i=0;i<eq_freqs;i++)
-    multibar_thumb_set(MULTIBAR(p->bars[i].slider),s->settings[i]*.1,0);
+  if(p)
+    for(i=0;i<eq_freqs;i++)
+      multibar_thumb_set(MULTIBAR(p->bars[i].slider),s->settings[i]*.1,0);
 
 }
 
@@ -221,7 +222,6 @@
 				 GtkWidget **windowbutton,
 				 GtkWidget **activebutton){
   int i;
-  channel_panel=malloc(input_ch*sizeof(*channel_panel));
 
   /* a panel for each channel */
   for(i=0;i<input_ch;i++){

Modified: trunk/postfish/limitpanel.c
===================================================================
--- trunk/postfish/limitpanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/limitpanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -48,16 +48,16 @@
 
 void limitpanel_state_from_config(int bank){
   config_get_sigat("limit_active",bank,0,0,0,0,&limit_active);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(active),limit_active);
+  if(active)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(active),limit_active);
 
   config_get_sigat("limit_set",bank,0,0,0,0,&limitset.thresh);
-  multibar_thumb_set(MULTIBAR(t_slider),limitset.thresh*.1,0);
+  if(t_slider)multibar_thumb_set(MULTIBAR(t_slider),limitset.thresh*.1,0);
 
   config_get_sigat("limit_set",bank,0,0,0,1,&limitset.depth);
-  multibar_thumb_set(MULTIBAR(k_slider),limitset.depth*.1,0);
+  if(k_slider)multibar_thumb_set(MULTIBAR(k_slider),limitset.depth*.1,0);
 
   config_get_sigat("limit_set",bank,0,0,0,2,&limitset.decay);
-  multibar_thumb_set(MULTIBAR(d_slider),limitset.decay*.1,0);
+  if(d_slider)multibar_thumb_set(MULTIBAR(d_slider),limitset.decay*.1,0);
 }
 
 static void limit_change(GtkWidget *w,gpointer in){

Modified: trunk/postfish/main.c
===================================================================
--- trunk/postfish/main.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/main.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -52,6 +52,7 @@
 sig_atomic_t main_looping;
 char *configfile="postfish-staterc";
 char *version;
+int batch = 0;
 
 void clean_exit(int sig){
   signal(sig,SIG_IGN);
@@ -84,9 +85,10 @@
 
 }
 
-const char *optstring = "-c:gh";
+const char *optstring = "-c:ghB";
 
 struct option options [] = {
+        {"batch-mode",no_argument,NULL,'B'},
         {"configuration-file",required_argument,NULL,'c'},
         {"group",no_argument,NULL,'g'},
         {"help",no_argument,NULL,'h'},
@@ -102,6 +104,8 @@
 "  postfish [options] infile [infile]+ [-g infile [infile]+]+ > output\n\n"
 
 "OPTIONS:\n"
+"  -B --batch-mode            : process the input in batch mode without\n"
+"                               UI or monitor output\n"
 "  -c --configuration-file    : load state from alternate configuration file\n"
 "  -g --group                 : place following input files in a new channel\n"
 "                               grouping\n"
@@ -179,6 +183,9 @@
       input_parse(optarg,newgroup);      
       newgroup=0;
       break;
+    case 'B':
+      batch=1;
+      break;
     case 'c':
       /* alternate configuration file */
       configfile=strdup(optarg);
@@ -328,7 +335,7 @@
     fprintf(stderr,"Unable to remove block buffering on stdout; continuing\n");
   
   output_probe_stdout(STDOUT_FILENO);
-  output_probe_monitor();
+  if(!batch) output_probe_monitor();
 
   /* open all the input files */
   if(input_load())exit(1);
@@ -363,7 +370,13 @@
   signal(SIGINT,clean_exit);
   signal(SIGSEGV,clean_exit);
 
-  mainpanel_go(argc,argv,input_ch);
+  if(batch){
+    mainpanel_state_from_config(0);
+    playback_active=1;
+    outset.panel_active[1]=1;
+    playback_thread(NULL);
+  }else
+    mainpanel_go(argc,argv,input_ch);
 
   return(0);
 }

Modified: trunk/postfish/mainpanel.c
===================================================================
--- trunk/postfish/mainpanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/mainpanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -34,7 +34,7 @@
 #include "windowbutton.h"
 #include "config.h"
 
-static postfish_mainpanel p;
+static postfish_mainpanel *p=NULL;
 extern char *configfile;
 extern sig_atomic_t main_looping;
 
@@ -46,20 +46,20 @@
   int i;
   float f;
 
-  f=multibar_get_value(MULTIBAR(p.masterdB_s),0);
-  i=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p.masterdB_a));
+  f=multibar_get_value(MULTIBAR(p->masterdB_s),0);
+  i=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->masterdB_a));
 
   config_set_integer("mainpanel_master_att",bank,0,0,0,0,rint(f*10));
   config_set_integer("mainpanel_master_att_active",bank,0,0,0,0,i);
 
-  config_set_string("mainpanel_cue_A",0,0,0,0,gtk_entry_get_text(GTK_ENTRY(p.entry_a)));
-  config_set_string("mainpanel_cue_B",0,0,0,0,gtk_entry_get_text(GTK_ENTRY(p.entry_b)));
+  config_set_string("mainpanel_cue_A",0,0,0,0,gtk_entry_get_text(GTK_ENTRY(p->entry_a)));
+  config_set_string("mainpanel_cue_B",0,0,0,0,gtk_entry_get_text(GTK_ENTRY(p->entry_b)));
   config_set_integer("mainpanel_loop",0,0,0,0,0,
-		     gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p.cue_b)));
+		     gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->cue_b)));
 
   for(i=0;i<input_ch || i<OUTPUT_CHANNELS;i++)
     config_set_integer("mainpanel_VU_show",0,0,0,0,i,
-		       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p.channelshow[i])));
+		       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->channelshow[i])));
 
   clippanel_state_to_config(bank);
   compandpanel_state_to_config(bank);
@@ -73,28 +73,36 @@
 
 }
 
-static void mainpanel_state_from_config(int bank){
+void mainpanel_state_from_config(int bank){
 
   int val,i;
   const char *string;
 
-  if(!config_get_integer("mainpanel_master_att",bank,0,0,0,0,&val))
-    multibar_thumb_set(MULTIBAR(p.masterdB_s),val*.1,0);
+  if(!config_get_integer("mainpanel_master_att",bank,0,0,0,0,&val)){
+    master_att = val;
+    if(p)
+      multibar_thumb_set(MULTIBAR(p->masterdB_s),val*.1,0);
+  }
 
-  if(!config_get_integer("mainpanel_master_att_active",bank,0,0,0,0,&val))
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p.masterdB_a),val);
+  if(!config_get_integer("mainpanel_master_att_active",bank,0,0,0,0,&val)){
+    if(!val)master_att=0;
+    if(p)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->masterdB_a),val);
+  }
 
   /* A/B state are saved but *not* banked */
   if((string=config_get_string("mainpanel_cue_A",0,0,0,0)))
-    action_seta_to(&p,string);
+    action_seta_to(p,string);
   if((string=config_get_string("mainpanel_cue_B",0,0,0,0)))
-    action_setb_to(&p,string);
-  if(!config_get_integer("mainpanel_loop",0,0,0,0,0,&val))
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p.cue_b),val);
+    action_setb_to(p,string);
+  if(p)
+    if(!config_get_integer("mainpanel_loop",0,0,0,0,0,&val))
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->cue_b),val);
 
-  for(i=0;i<input_ch || i<OUTPUT_CHANNELS;i++)
-    if(!config_get_integer("mainpanel_VU_show",0,0,0,0,i,&val))
-      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p.channelshow[i]),val);
+  if(p)
+    for(i=0;i<input_ch || i<OUTPUT_CHANNELS;i++)
+      if(!config_get_integer("mainpanel_VU_show",0,0,0,0,i,&val))
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->channelshow[i]),val);
 
   clippanel_state_from_config(bank);
   compandpanel_state_from_config(bank);
@@ -294,21 +302,20 @@
 }
 
 static void action_seta_to(postfish_mainpanel *p,const char *time){
-  gtk_entry_set_text(GTK_ENTRY(p->entry_a),time);
+  off_t cursora=input_time_to_cursor(time),cursorb;
 
-  {
-    const char *time=gtk_entry_get_text(GTK_ENTRY(p->entry_a));
-    off_t cursora=input_time_to_cursor(time),cursorb;
+  if(p){
+    gtk_entry_set_text(GTK_ENTRY(p->entry_a),time);
     time=gtk_entry_get_text(GTK_ENTRY(p->entry_b));
     cursorb=input_time_to_cursor(time);
-    
     if(cursora>=cursorb && loop_active){
       loop_active=0;
       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->cue_b),0);
     }
-    input_Acursor_set(cursora);
   }
 
+  input_Acursor_set(cursora);
+
 }
 
 static void action_seta(GtkWidget *widget,postfish_mainpanel *p){
@@ -317,20 +324,20 @@
 }
 
 static void action_setb_to(postfish_mainpanel *p,const char *time){
-  off_t cursora,cursorb;
-  
-  cursorb=input_time_to_cursor(time);
-  gtk_entry_set_text(GTK_ENTRY(p->entry_b),time);
-    
-  time=gtk_entry_get_text(GTK_ENTRY(p->entry_a));
-  cursora=input_time_to_cursor(time);
+  off_t cursora,cursorb=input_time_to_cursor(time);
 
-  if(cursora>=cursorb && loop_active){
-    loop_active=0;
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->cue_b),0);
+  if(p){
+    gtk_entry_set_text(GTK_ENTRY(p->entry_b),time);
+    time=gtk_entry_get_text(GTK_ENTRY(p->entry_a));
+    cursora=input_time_to_cursor(time);
+
+    if(cursora>=cursorb && loop_active){
+      loop_active=0;
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->cue_b),0);
+    }
   }
+
   input_Bcursor_set(cursorb);
- 
 }
 
 static void action_setb(GtkWidget *widget,postfish_mainpanel *p){
@@ -1252,8 +1259,9 @@
   char  buffer[20];
   int i;
   int found=0;
-  memset(&p,0,sizeof(p));
 
+  p=calloc(1,sizeof(*p));
+
   found|=look_for_gtkrc(ETCDIR"/postfish-gtkrc");
   {
     char *rcdir=getenv("HOME");
@@ -1339,9 +1347,9 @@
     exit(1);
   }
   
-  mainpanel_create(&p,labels);
+  mainpanel_create(p,labels);
   mainpanel_state_from_config(0);
-  animate_fish(&p);
+  animate_fish(p);
 
   /* set up watching the event pipe */
   {
@@ -1352,7 +1360,7 @@
     g_io_channel_set_buffered (channel, FALSE);
     g_io_channel_set_close_on_unref (channel, TRUE);
 
-    id = g_io_add_watch (channel, G_IO_IN, async_event_handle, &p);
+    id = g_io_add_watch (channel, G_IO_IN, async_event_handle, p);
 
     g_io_channel_unref (channel);
 

Modified: trunk/postfish/mainpanel.h
===================================================================
--- trunk/postfish/mainpanel.h	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/mainpanel.h	2012-08-01 15:39:09 UTC (rev 18490)
@@ -86,4 +86,5 @@
 };
 
 extern void mainpanel_go(int n,char *list[],int ch);
+extern void mainpanel_state_from_config(int bank);
 extern void save_state();

Modified: trunk/postfish/mixpanel.c
===================================================================
--- trunk/postfish/mixpanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/mixpanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -67,7 +67,7 @@
 } mix_panelsave;
 
 static atten_panelsave atten_panel;
-static mix_panelsave **mix_panels;
+static mix_panelsave *mix_panels[MAX_INPUT_CHANNELS];
 
 static void mixblock_state_to_config(int bank, mix_settings *s,int A,int B){
   config_set_vector("mixblock_source",bank,A,B,0,3,s->insert_source[B]);
@@ -103,24 +103,26 @@
 static void mixblock_state_from_config(int bank, mix_settings *s,mix_panelsave *p,int A,int B){
   int i;
   config_get_vector("mixblock_source",bank,A,B,0,3,s->insert_source[B]);
-  for(i=0;i<3;i++)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->insert_source[B][i]),
-				 s->insert_source[B][i]);
+  if(p)
+    for(i=0;i<3;i++)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->insert_source[B][i]),
+                                   s->insert_source[B][i]);
 
   config_get_sigat("mixblock_set",bank,A,B,0,0,&s->insert_invert[B]);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->insert_invert[B]),
-			       s->insert_invert[B]);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->insert_invert[B]),
+                                    s->insert_invert[B]);
   
   config_get_sigat("mixblock_set",bank,A,B,0,1,&s->insert_att[B]);
-  multibar_thumb_set(MULTIBAR(p->insert_att[B]->s),s->insert_att[B]*.1,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->insert_att[B]->s),s->insert_att[B]*.1,0);
   
   config_get_sigat("mixblock_set",bank,A,B,0,2,&s->insert_delay[B]);
-  multibar_thumb_set(MULTIBAR(p->insert_del[B]->s),s->insert_delay[B]*.01,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->insert_del[B]->s),s->insert_delay[B]*.01,0);
   
   config_get_vector("mixblock_dest",bank,A,B,0,OUTPUT_CHANNELS,s->insert_dest[B]);
-  for(i=0;i<OUTPUT_CHANNELS;i++)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->insert_dest[B][i]),
-				 s->insert_dest[B][i]);
+  if(p)
+    for(i=0;i<OUTPUT_CHANNELS;i++)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->insert_dest[B][i]),
+                                   s->insert_dest[B][i]);
 }
 
 static void mixdown_state_from_config(int bank, mix_settings *s, mix_panelsave *p, int A){
@@ -131,13 +133,15 @@
   config_get_sigat("mixplace_set",bank,A,0,0,1,&s->placer_att);
   config_get_sigat("mixplace_set",bank,A,0,0,2,&s->placer_delay);
 
-  for(i=0;i<OUTPUT_CHANNELS;i++){
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->destA[i]),s->placer_destA[i]);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->destB[i]),s->placer_destB[i]);
+  if(p){
+    for(i=0;i<OUTPUT_CHANNELS;i++){
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->destA[i]),s->placer_destA[i]);
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->destB[i]),s->placer_destB[i]);
+    }
+    multibar_thumb_set(MULTIBAR(p->place_AB->s),s->placer_place,0);
+    multibar_thumb_set(MULTIBAR(p->place_atten->s),s->placer_att*.1,0);
+    multibar_thumb_set(MULTIBAR(p->place_delay->s),s->placer_delay*.01,0);
   }
-  multibar_thumb_set(MULTIBAR(p->place_AB->s),s->placer_place,0);
-  multibar_thumb_set(MULTIBAR(p->place_atten->s),s->placer_att*.1,0);
-  multibar_thumb_set(MULTIBAR(p->place_delay->s),s->placer_delay*.01,0);
 
   for(i=0;i<MIX_BLOCKS;i++)
     mixblock_state_from_config(bank,s,p,A,i);
@@ -148,14 +152,17 @@
   config_get_vector("mixdown_active",bank,0,0,0,input_ch,mixpanel_active);
 
   for(i=0;i<input_ch;i++){
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(atten_panel.panel->subpanel_activebutton[i]),
-						   mixpanel_active[i]);
+    if(atten_panel.panel)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(atten_panel.panel->subpanel_activebutton[i]),
+                                   mixpanel_active[i]);
 
     config_get_sigat("mixdown_master_attenuate",bank,0,0,0,i,&mix_set[i].master_att);
     config_get_sigat("mixdown_master_delay",bank,0,0,0,i,&mix_set[i].master_delay);
 
-    multibar_thumb_set(MULTIBAR(atten_panel.att[i]->s),mix_set[i].master_att*.1,0);
-    multibar_thumb_set(MULTIBAR(atten_panel.del[i]->s),mix_set[i].master_delay*.01,0);
+    if(atten_panel.att)
+      multibar_thumb_set(MULTIBAR(atten_panel.att[i]->s),mix_set[i].master_att*.1,0);
+    if(atten_panel.del)
+      multibar_thumb_set(MULTIBAR(atten_panel.del[i]->s),mix_set[i].master_delay*.01,0);
 
     mixdown_state_from_config(bank,mix_set+i,mix_panels[i],i);
   }
@@ -527,7 +534,6 @@
 			    GtkWidget **windowbutton,
 			    GtkWidget **activebutton){
   int i;
-  mix_panels=malloc(input_ch*sizeof(*mix_panels));
   
   /* a panel for each channel */
   for(i=0;i<input_ch;i++){

Modified: trunk/postfish/outpanel.c
===================================================================
--- trunk/postfish/outpanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/outpanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -70,13 +70,14 @@
   int i;
 
   config_get_vector("output_active",bank,0,0,0,2,outset.panel_active);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state.monitor_active),outset.panel_active[0]);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state.stdout_active),outset.panel_active[1]);
+  if(state.monitor_active)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state.monitor_active),outset.panel_active[0]);
+  if(state.stdout_active)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state.stdout_active),outset.panel_active[1]);
 
   config_get_vector("output_monitor_source",bank,0,0,0,OUTPUT_CHANNELS,outset.monitor.source);
   for(i=0;i<OUTPUT_CHANNELS;i++)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state.monitor.source[i]),
-				 outset.monitor.source[i]);
+    if(state.monitor.source[i])
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state.monitor.source[i]),
+                                   outset.monitor.source[i]);
 
   config_get_sigat("output_monitor_set",bank,0,0,0,0,&outset.monitor.device);
 
@@ -98,8 +99,9 @@
 
   config_get_vector("output_stdout_source",bank,0,0,0,OUTPUT_CHANNELS,outset.stdout.source);
   for(i=0;i<OUTPUT_CHANNELS;i++)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state.stdout.source[i]),
-				 outset.stdout.source[i]);
+    if(state.stdout.source[i])
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(state.stdout.source[i]),
+                                   outset.stdout.source[i]);
 
   config_get_sigat("output_stdout_set",bank,0,0,0,0,&outset.stdout.device);
   if(state.stdout.device)
@@ -114,7 +116,6 @@
   if(state.stdout.format)
     gtk_combo_box_set_active(GTK_COMBO_BOX(state.stdout.format),outset.stdout.format);
 
-
 }
 
 static void menuchange(GtkWidget *w,gpointer in){

Modified: trunk/postfish/outpanel.h
===================================================================
--- trunk/postfish/outpanel.h	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/outpanel.h	2012-08-01 15:39:09 UTC (rev 18490)
@@ -27,3 +27,4 @@
 
 extern void outpanel_state_to_config(int bank);
 extern void outpanel_state_from_config(int bank);
+extern void output_load(int bank);

Modified: trunk/postfish/reverbpanel.c
===================================================================
--- trunk/postfish/reverbpanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/reverbpanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -51,7 +51,7 @@
 } reverb_panel_state;
 
 reverb_panel_state *master_panel;
-reverb_panel_state **channel_panel;
+reverb_panel_state *channel_panel[MAX_INPUT_CHANNELS];
 
 static void reverbpanel_state_to_config_helper(int bank,reverb_settings *s,int A){
   config_set_integer("reverb_active",bank,A,0,0,0,s->active);
@@ -75,26 +75,25 @@
 						 reverb_panel_state *p,int A){
 
   config_get_sigat("reverb_active",bank,A,0,0,0,&s->active);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->panel->subpanel_activebutton[0]),s->active);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->panel->subpanel_activebutton[0]),s->active);
 
-
   config_get_sigat("reverb_set",bank,A,0,0,3,&s->roomsize);
-    multibar_thumb_set(MULTIBAR(p->roomsize->s),s->roomsize,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->roomsize->s),s->roomsize,0);
 
   config_get_sigat("reverb_set",bank,A,0,0,4,&s->liveness);
-    multibar_thumb_set(MULTIBAR(p->liveness->s),s->liveness,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->liveness->s),s->liveness,0);
 
   config_get_sigat("reverb_set",bank,A,0,0,5,&s->wet);
-    multibar_thumb_set(MULTIBAR(p->wet->s),s->wet,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->wet->s),s->wet,0);
 
   config_get_sigat("reverb_set",bank,A,0,0,6,&s->width);
-    multibar_thumb_set(MULTIBAR(p->width->s),s->width,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->width->s),s->width,0);
 
   config_get_sigat("reverb_set",bank,A,0,0,7,&s->delay);
-    multibar_thumb_set(MULTIBAR(p->delay->s),s->delay,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->delay->s),s->delay,0);
 
   config_get_sigat("reverb_set",bank,A,0,0,8,&s->hfdamp);
-    multibar_thumb_set(MULTIBAR(p->hfdamp->s),s->hfdamp,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->hfdamp->s),s->hfdamp,0);
 
 }
 
@@ -282,8 +281,6 @@
                                 GtkWidget **activebutton){
   int i;
   /* a panel for each channel */
-  channel_panel=calloc(input_ch,sizeof(*channel_panel));
-
   for(i=0;i<input_ch;i++){
     subpanel_generic *panel;
     char buffer[80];

Modified: trunk/postfish/singlepanel.c
===================================================================
--- trunk/postfish/singlepanel.c	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/singlepanel.c	2012-08-01 15:39:09 UTC (rev 18490)
@@ -84,7 +84,7 @@
 } singlecomp_panel_state;
 
 static singlecomp_panel_state *master_panel;
-static singlecomp_panel_state **channel_panel;
+static singlecomp_panel_state *channel_panel[MAX_INPUT_CHANNELS];
 
 static void singlepanel_state_to_config_helper(int bank,singlecomp_settings *s,int A){
   config_set_integer("singlecompand_active",bank,A,0,0,0,s->panel_active);
@@ -122,58 +122,64 @@
 						 singlecomp_panel_state *p,int A){
 
   config_get_sigat("singlecompand_active",bank,A,0,0,0,&s->panel_active);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->panel->subpanel_activebutton[0]),s->panel_active);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->panel->subpanel_activebutton[0]),s->panel_active);
 
   config_get_sigat("singlecompand_thresh",bank,A,0,0,0,&s->u_thresh);
-  multibar_thumb_set(MULTIBAR(p->bar.slider),s->u_thresh,0);
+  if(p)multibar_thumb_set(MULTIBAR(p->bar.slider),s->u_thresh,0);
   config_get_sigat("singlecompand_thresh",bank,A,0,0,1,&s->o_thresh);
-  multibar_thumb_set(MULTIBAR(p->bar.slider),s->o_thresh,1);
+  if(p)multibar_thumb_set(MULTIBAR(p->bar.slider),s->o_thresh,1);
 
   config_get_sigat("singlecompand_over_set",bank,A,0,0,0,&s->o_mode);
-  if(s->o_mode)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->o_peak),1);
-  else
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->o_rms),1);
+  if(p){
+    if(s->o_mode)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->o_peak),1);
+    else
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->o_rms),1);
+  }
 
   config_get_sigat("singlecompand_over_set",bank,A,0,0,1,&s->o_softknee);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->o_knee),s->o_softknee);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->o_knee),s->o_softknee);
   config_get_sigat("singlecompand_over_set",bank,A,0,0,2,&s->o_ratio);
-  multibar_thumb_set(p->over_compand.s,1000./s->o_ratio,0);
+  if(p)multibar_thumb_set(p->over_compand.s,1000./s->o_ratio,0);
   config_get_sigat("singlecompand_over_set",bank,A,0,0,3,&s->o_attack);
-  multibar_thumb_set(p->over_timing.s,s->o_attack*.1,0);
+  if(p)multibar_thumb_set(p->over_timing.s,s->o_attack*.1,0);
   config_get_sigat("singlecompand_over_set",bank,A,0,0,4,&s->o_decay);
-  multibar_thumb_set(p->over_timing.s,s->o_decay*.1,1);
+  if(p)multibar_thumb_set(p->over_timing.s,s->o_decay*.1,1);
   config_get_sigat("singlecompand_over_set",bank,A,0,0,5,&s->o_lookahead);
-  multibar_thumb_set(p->over_lookahead.s,s->o_lookahead*.1,0);
+  if(p)multibar_thumb_set(p->over_lookahead.s,s->o_lookahead*.1,0);
 
   config_get_sigat("singlecompand_under_set",bank,A,0,0,0,&s->u_mode);
-  if(s->u_mode)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->u_peak),1);
-  else
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->u_rms),1);
+  if(p){
+    if(s->u_mode)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->u_peak),1);
+    else
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->u_rms),1);
+  }
 
   config_get_sigat("singlecompand_under_set",bank,A,0,0,1,&s->u_softknee);
-  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->u_knee),s->u_softknee);
+  if(p)gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->u_knee),s->u_softknee);
   config_get_sigat("singlecompand_under_set",bank,A,0,0,2,&s->u_ratio);
-  multibar_thumb_set(p->under_compand.s,1000./s->u_ratio,0);
+  if(p)multibar_thumb_set(p->under_compand.s,1000./s->u_ratio,0);
   config_get_sigat("singlecompand_under_set",bank,A,0,0,3,&s->u_attack);
-  multibar_thumb_set(p->under_timing.s,s->u_attack*.1,0);
+  if(p)multibar_thumb_set(p->under_timing.s,s->u_attack*.1,0);
   config_get_sigat("singlecompand_under_set",bank,A,0,0,4,&s->u_decay);
-  multibar_thumb_set(p->under_timing.s,s->u_decay*.1,1);
+  if(p)multibar_thumb_set(p->under_timing.s,s->u_decay*.1,1);
   config_get_sigat("singlecompand_under_set",bank,A,0,0,5,&s->u_lookahead);
-  multibar_thumb_set(p->under_lookahead.s,s->u_lookahead*.1,0);
+  if(p)multibar_thumb_set(p->under_lookahead.s,s->u_lookahead*.1,0);
 
   config_get_sigat("singlecompand_base_set",bank,A,0,0,0,&s->b_mode);
-  if(s->b_mode)
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->b_peak),1);
-  else
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->b_rms),1);
+  if(p){
+    if(s->b_mode)
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->b_peak),1);
+    else
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->b_rms),1);
+  }
   config_get_sigat("singlecompand_base_set",bank,A,0,0,2,&s->b_ratio);
-  multibar_thumb_set(p->base_compand.s,1000./s->b_ratio,0);
+  if(p)multibar_thumb_set(p->base_compand.s,1000./s->b_ratio,0);
   config_get_sigat("singlecompand_base_set",bank,A,0,0,3,&s->b_attack);
-  multibar_thumb_set(p->base_timing.s,s->b_attack*.1,0);
+  if(p)multibar_thumb_set(p->base_timing.s,s->b_attack*.1,0);
   config_get_sigat("singlecompand_base_set",bank,A,0,0,4,&s->b_decay);
-  multibar_thumb_set(p->base_timing.s,s->b_decay*.1,1);
+  if(p)multibar_thumb_set(p->base_timing.s,s->b_decay*.1,1);
 
 }
 
@@ -746,8 +752,6 @@
 				GtkWidget **activebutton){
   int i;
   
-  channel_panel=calloc(input_ch,sizeof(*channel_panel));
-  
   /* a panel for each channel */
   for(i=0;i<input_ch;i++){
     subpanel_generic *panel;

Modified: trunk/postfish/version.h
===================================================================
--- trunk/postfish/version.h	2012-08-01 01:23:45 UTC (rev 18489)
+++ trunk/postfish/version.h	2012-08-01 15:39:09 UTC (rev 18490)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Fri Mar  2 23:59:38 EST 2012] */
+/* DO NOT EDIT: Automated versioning hack [Wed Aug  1 11:37:36 EDT 2012] */



More information about the commits mailing list