[xiph-cvs] r6598 - trunk/postfish

xiphmont at xiph.org xiphmont at xiph.org
Tue May 4 21:27:17 PDT 2004



Author: xiphmont
Date: 2004-04-26 03:38:30 -0400 (Mon, 26 Apr 2004)
New Revision: 6598

Modified:
   trunk/postfish/eq.c
   trunk/postfish/eq.h
   trunk/postfish/eqpanel.c
   trunk/postfish/eqpanel.h
   trunk/postfish/mainpanel.c
   trunk/postfish/output.c
   trunk/postfish/version.h
Log:
Add per-channel EQ panels, tie into new infrastructure
....and debug that infrastructure while we're at it.

Yay.  Postfish is now back to where it was two weeks ago, but with
per-channel effects.

<p><p>Modified: trunk/postfish/eq.c
===================================================================
--- trunk/postfish/eq.c	2004-04-26 06:49:08 UTC (rev 6597)
+++ trunk/postfish/eq.c	2004-04-26 07:38:30 UTC (rev 6598)
@@ -140,6 +140,6 @@
     visible[i]=eq_channel_set[i].panel_visible;
   }
 
-  return freq_read(in,&master_state.eq,visible,active,workfunc_ch);
+  return freq_read(in,&channel_state.eq,visible,active,workfunc_ch);
 }
 

Modified: trunk/postfish/eq.h
===================================================================
--- trunk/postfish/eq.h	2004-04-26 06:49:08 UTC (rev 6597)
+++ trunk/postfish/eq.h	2004-04-26 07:38:30 UTC (rev 6598)
@@ -50,7 +50,7 @@
 };
 
 extern int pull_eq_feedback_master(float **peak,float **rms);
-extern int pull_eq_feedback_ch(float **peak,float **rms);
+extern int pull_eq_feedback_channel(float **peak,float **rms);
 extern int eq_load(void);
 extern int eq_reset();
 extern void eq_set(eq_settings *eq,int freq, float value);

Modified: trunk/postfish/eqpanel.c
===================================================================
--- trunk/postfish/eqpanel.c	2004-04-26 06:49:08 UTC (rev 6597)
+++ trunk/postfish/eqpanel.c	2004-04-26 07:38:30 UTC (rev 6598)
@@ -42,10 +42,12 @@
 typedef struct {
   GtkWidget *slider;
   GtkWidget *readout;
+  eq_settings *s;
   int number;
 } bar;
 
-static bar bars[eq_freqs];
+static bar *m_bars;
+static bar **c_bars;
 
 static void slider_change(GtkWidget *w,gpointer in){
   char buffer[80];
@@ -55,31 +57,26 @@
   sprintf(buffer,"%+3.0fdB",val);
   readout_set(READOUT(b->readout),buffer);
   
-  eq_set(&eq_master_set,b->number,val);
+  eq_set(b->s,b->number,val);
 
 }
 
-void eqpanel_create(postfish_mainpanel *mp,
-		    GtkWidget *windowbutton,
-		    GtkWidget *activebutton){
+static bar *eqpanel_create_helper(postfish_mainpanel *mp,
+			   subpanel_generic *panel,
+			   eq_settings *es){
+
   int i;
   char *labels[15]={"110","100","90","80","70","60","50","40",
                     "30","20","10","0","+10","+20","+30"};
   float levels[16]={-120,-110,-100,-90,-80,-70,-60,-50,-40,
                      -30,-20,-10,0,10,20,30};
-  char *shortcut[]={" e "};
 
-  subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
-					  &eq_master_set.panel_active,
-					  &eq_master_set.panel_visible,
-					  "_Equalization filter",shortcut,
-					  0,1);
+  GtkWidget *slidertable=gtk_table_new(eq_freqs,3,0);
+  bar *bars=calloc(eq_freqs,sizeof(*bars));
   
-  GtkWidget *slidertable=gtk_table_new(eq_freqs,3,0);
-
   for(i=0;i<eq_freqs;i++){
     const char *labeltext=eq_freq_labels[i];
-
+    
     GtkWidget *label=gtk_label_new(labeltext);
     gtk_widget_set_name(label,"smallmarker");
 
@@ -87,6 +84,7 @@
     bars[i].slider=multibar_new(15,labels,levels,1,
                                 LO_DECAY|HI_DECAY|LO_ATTACK|HI_ATTACK);
     bars[i].number=i;
+    bars[i].s=es;
 
     multibar_callback(MULTIBAR(bars[i].slider),slider_change,bars+i);
     multibar_thumb_set(MULTIBAR(bars[i].slider),0.,0);
@@ -106,13 +104,51 @@
   gtk_box_pack_start(GTK_BOX(panel->subpanel_box),slidertable,1,1,4);
   subpanel_show_all_but_toplevel(panel);
 
+  return bars;
 }
 
+void eqpanel_create_master(postfish_mainpanel *mp,
+                                GtkWidget *windowbutton,
+                                GtkWidget *activebutton){
+
+  char *shortcut[]={" e "};
+  subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
+					  &eq_master_set.panel_active,
+					  &eq_master_set.panel_visible,
+					  "_Equalizer (master)",shortcut,
+					  0,1);
+  
+  m_bars=eqpanel_create_helper(mp,panel,&eq_master_set);
+}
+
+void eqpanel_create_channel(postfish_mainpanel *mp,
+				 GtkWidget **windowbutton,
+				 GtkWidget **activebutton){
+  int i;
+  c_bars=malloc(input_ch*sizeof(*m_bars));
+
+  /* a panel for each channel */
+  for(i=0;i<input_ch;i++){
+    subpanel_generic *panel;
+    char buffer[80];
+
+    sprintf(buffer,"_Equalizer (channel %d)",i+1);
+
+    panel=subpanel_create(mp,windowbutton[i],activebutton+i,
+			  &eq_channel_set[i].panel_active,
+			  &eq_channel_set[i].panel_visible,
+			  buffer,0,i,1);
+  
+    c_bars[i]=eqpanel_create_helper(mp,panel,eq_channel_set+i);
+  }
+}
+
+
 static float **peakfeed=0;
 static float **rmsfeed=0;
 
 void eqpanel_feedback(int displayit){
-  int i;
+  int i,j;
   if(!peakfeed){
     peakfeed=malloc(sizeof(*peakfeed)*eq_freqs);
     rmsfeed=malloc(sizeof(*rmsfeed)*eq_freqs);
@@ -125,14 +161,35 @@
   
   if(pull_eq_feedback_master(peakfeed,rmsfeed)==1)
     for(i=0;i<eq_freqs;i++)
-      multibar_set(MULTIBAR(bars[i].slider),rmsfeed[i],peakfeed[i],
+      multibar_set(MULTIBAR(m_bars[i].slider),rmsfeed[i],peakfeed[i],
                    input_ch,(displayit && eq_master_set.panel_visible));
   
+
+  if(pull_eq_feedback_channel(peakfeed,rmsfeed)==1){
+    for(j=0;j<input_ch;j++){
+      for(i=0;i<eq_freqs;i++){
+	float rms[input_ch];
+	float peak[input_ch];
+	
+	memset(rms,0,sizeof(rms));
+        memset(peak,0,sizeof(peak));
+        rms[j]=rmsfeed[i][j];
+        peak[j]=peakfeed[i][j];
+	
+	multibar_set(MULTIBAR(c_bars[j][i].slider),rms,peak,
+		     input_ch,(displayit && eq_channel_set[j].panel_visible));
+      }
+    }
+  }
 }
 
 void eqpanel_reset(void){
-  int i;
+  int i,j;
   for(i=0;i<eq_freqs;i++)
-    multibar_reset(MULTIBAR(bars[i].slider));
+    multibar_reset(MULTIBAR(m_bars[i].slider));
+  
+  for(i=0;i<eq_freqs;i++)
+    for(j=0;j<input_ch;j++)
+      multibar_reset(MULTIBAR(c_bars[j][i].slider));
 }
 

Modified: trunk/postfish/eqpanel.h
===================================================================
--- trunk/postfish/eqpanel.h	2004-04-26 06:49:08 UTC (rev 6597)
+++ trunk/postfish/eqpanel.h	2004-04-26 07:38:30 UTC (rev 6598)
@@ -22,8 +22,11 @@
  */
 
 #include "postfish.h"
-extern void eqpanel_create(postfish_mainpanel *mp,
-			   GtkWidget *windowbutton,
-			   GtkWidget *activebutton);
+extern void eqpanel_create_master(postfish_mainpanel *mp,
+				  GtkWidget *windowbutton,
+				  GtkWidget *activebutton);
+extern void eqpanel_create_channel(postfish_mainpanel *mp,
+				   GtkWidget **windowbutton,
+				   GtkWidget **activebutton);
 extern void eqpanel_feedback(int workp);
 extern void eqpanel_reset(void);

Modified: trunk/postfish/mainpanel.c
===================================================================
--- trunk/postfish/mainpanel.c	2004-04-26 06:49:08 UTC (rev 6597)
+++ trunk/postfish/mainpanel.c	2004-04-26 07:38:30 UTC (rev 6598)
@@ -958,7 +958,7 @@
   mainpanel_chentry(panel,channeltable,"_Singlecomp ",3,0,1,singlepanel_create_channel);
   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);
+  mainpanel_chentry(panel,channeltable,"_EQ ",6,0,1,eqpanel_create_channel);
 
   /* master panel */
   {
@@ -985,7 +985,7 @@
   mainpanel_masterentry(panel,mastertable,"_Multicomp "," m ",GDK_m,1,compandpanel_create_master);
   mainpanel_masterentry(panel,mastertable,"_Singlecomp "," s ",GDK_s,2,singlepanel_create_master);
   mainpanel_masterentry(panel,mastertable,"_Reverb "," r ",GDK_r,3,0);
-  mainpanel_masterentry(panel,mastertable,"_EQ "," e ",GDK_e,4,eqpanel_create);
+  mainpanel_masterentry(panel,mastertable,"_EQ "," e ",GDK_e,4,eqpanel_create_master);
   mainpanel_masterentry(panel,mastertable,"_Limit "," l ",GDK_l,5,limitpanel_create);
   mainpanel_masterentry(panel,mastertable,"_Output ",NULL,GDK_l,6,0);
 

Modified: trunk/postfish/output.c
===================================================================
--- trunk/postfish/output.c	2004-04-26 06:49:08 UTC (rev 6597)
+++ trunk/postfish/output.c	2004-04-26 07:38:30 UTC (rev 6598)
@@ -244,12 +244,13 @@
     result|=link->samples;
     link=suppress_read_channel(link);
     result|=link->samples;
+    link=eq_read_channel(link);
+    result|=link->samples;
 
     link=multicompand_read_master(link);
     result|=link->samples;
     link=singlecomp_read_master(link);
     result|=link->samples;
-
     link=eq_read_master(link);
     result|=link->samples;
     

Modified: trunk/postfish/version.h
===================================================================
--- trunk/postfish/version.h	2004-04-26 06:49:08 UTC (rev 6597)
+++ trunk/postfish/version.h	2004-04-26 07:38:30 UTC (rev 6598)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Mon Apr 26 02:47:13 EDT 2004] */
+/* DO NOT EDIT: Automated versioning hack [Mon Apr 26 03:35:14 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