Commit cecda3f7 authored by Monty Montgomery's avatar Monty Montgomery

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.



git-svn-id: https://svn.xiph.org/trunk/postfish@6598 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 974e94bc
...@@ -140,6 +140,6 @@ time_linkage *eq_read_channel(time_linkage *in){ ...@@ -140,6 +140,6 @@ time_linkage *eq_read_channel(time_linkage *in){
visible[i]=eq_channel_set[i].panel_visible; 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);
} }
...@@ -50,7 +50,7 @@ static char * const eq_freq_labels[eq_freqs]={ ...@@ -50,7 +50,7 @@ static char * const eq_freq_labels[eq_freqs]={
}; };
extern int pull_eq_feedback_master(float **peak,float **rms); 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_load(void);
extern int eq_reset(); extern int eq_reset();
extern void eq_set(eq_settings *eq,int freq, float value); extern void eq_set(eq_settings *eq,int freq, float value);
......
...@@ -42,10 +42,12 @@ extern eq_settings *eq_channel_set; ...@@ -42,10 +42,12 @@ extern eq_settings *eq_channel_set;
typedef struct { typedef struct {
GtkWidget *slider; GtkWidget *slider;
GtkWidget *readout; GtkWidget *readout;
eq_settings *s;
int number; int number;
} bar; } bar;
static bar bars[eq_freqs]; static bar *m_bars;
static bar **c_bars;
static void slider_change(GtkWidget *w,gpointer in){ static void slider_change(GtkWidget *w,gpointer in){
char buffer[80]; char buffer[80];
...@@ -55,27 +57,22 @@ static void slider_change(GtkWidget *w,gpointer in){ ...@@ -55,27 +57,22 @@ static void slider_change(GtkWidget *w,gpointer in){
sprintf(buffer,"%+3.0fdB",val); sprintf(buffer,"%+3.0fdB",val);
readout_set(READOUT(b->readout),buffer); 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, static bar *eqpanel_create_helper(postfish_mainpanel *mp,
GtkWidget *windowbutton, subpanel_generic *panel,
GtkWidget *activebutton){ eq_settings *es){
int i; int i;
char *labels[15]={"110","100","90","80","70","60","50","40", char *labels[15]={"110","100","90","80","70","60","50","40",
"30","20","10","0","+10","+20","+30"}; "30","20","10","0","+10","+20","+30"};
float levels[16]={-120,-110,-100,-90,-80,-70,-60,-50,-40, float levels[16]={-120,-110,-100,-90,-80,-70,-60,-50,-40,
-30,-20,-10,0,10,20,30}; -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); GtkWidget *slidertable=gtk_table_new(eq_freqs,3,0);
bar *bars=calloc(eq_freqs,sizeof(*bars));
for(i=0;i<eq_freqs;i++){ for(i=0;i<eq_freqs;i++){
const char *labeltext=eq_freq_labels[i]; const char *labeltext=eq_freq_labels[i];
...@@ -87,6 +84,7 @@ void eqpanel_create(postfish_mainpanel *mp, ...@@ -87,6 +84,7 @@ void eqpanel_create(postfish_mainpanel *mp,
bars[i].slider=multibar_new(15,labels,levels,1, bars[i].slider=multibar_new(15,labels,levels,1,
LO_DECAY|HI_DECAY|LO_ATTACK|HI_ATTACK); LO_DECAY|HI_DECAY|LO_ATTACK|HI_ATTACK);
bars[i].number=i; bars[i].number=i;
bars[i].s=es;
multibar_callback(MULTIBAR(bars[i].slider),slider_change,bars+i); multibar_callback(MULTIBAR(bars[i].slider),slider_change,bars+i);
multibar_thumb_set(MULTIBAR(bars[i].slider),0.,0); multibar_thumb_set(MULTIBAR(bars[i].slider),0.,0);
...@@ -106,13 +104,51 @@ void eqpanel_create(postfish_mainpanel *mp, ...@@ -106,13 +104,51 @@ void eqpanel_create(postfish_mainpanel *mp,
gtk_box_pack_start(GTK_BOX(panel->subpanel_box),slidertable,1,1,4); gtk_box_pack_start(GTK_BOX(panel->subpanel_box),slidertable,1,1,4);
subpanel_show_all_but_toplevel(panel); 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 **peakfeed=0;
static float **rmsfeed=0; static float **rmsfeed=0;
void eqpanel_feedback(int displayit){ void eqpanel_feedback(int displayit){
int i; int i,j;
if(!peakfeed){ if(!peakfeed){
peakfeed=malloc(sizeof(*peakfeed)*eq_freqs); peakfeed=malloc(sizeof(*peakfeed)*eq_freqs);
rmsfeed=malloc(sizeof(*rmsfeed)*eq_freqs); rmsfeed=malloc(sizeof(*rmsfeed)*eq_freqs);
...@@ -125,14 +161,35 @@ void eqpanel_feedback(int displayit){ ...@@ -125,14 +161,35 @@ void eqpanel_feedback(int displayit){
if(pull_eq_feedback_master(peakfeed,rmsfeed)==1) if(pull_eq_feedback_master(peakfeed,rmsfeed)==1)
for(i=0;i<eq_freqs;i++) 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)); 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){ void eqpanel_reset(void){
int i; int i,j;
for(i=0;i<eq_freqs;i++)
multibar_reset(MULTIBAR(m_bars[i].slider));
for(i=0;i<eq_freqs;i++) for(i=0;i<eq_freqs;i++)
multibar_reset(MULTIBAR(bars[i].slider)); for(j=0;j<input_ch;j++)
multibar_reset(MULTIBAR(c_bars[j][i].slider));
} }
...@@ -22,8 +22,11 @@ ...@@ -22,8 +22,11 @@
*/ */
#include "postfish.h" #include "postfish.h"
extern void eqpanel_create(postfish_mainpanel *mp, extern void eqpanel_create_master(postfish_mainpanel *mp,
GtkWidget *windowbutton, GtkWidget *windowbutton,
GtkWidget *activebutton); GtkWidget *activebutton);
extern void eqpanel_create_channel(postfish_mainpanel *mp,
GtkWidget **windowbutton,
GtkWidget **activebutton);
extern void eqpanel_feedback(int workp); extern void eqpanel_feedback(int workp);
extern void eqpanel_reset(void); extern void eqpanel_reset(void);
...@@ -958,7 +958,7 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){ ...@@ -958,7 +958,7 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
mainpanel_chentry(panel,channeltable,"_Singlecomp ",3,0,1,singlepanel_create_channel); 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,"De_verb ",4,1,0,suppresspanel_create_channel);
mainpanel_chentry(panel,channeltable,"_Reverb ",5,1,0,0); 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 */ /* master panel */
{ {
...@@ -985,7 +985,7 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){ ...@@ -985,7 +985,7 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
mainpanel_masterentry(panel,mastertable,"_Multicomp "," m ",GDK_m,1,compandpanel_create_master); 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,"_Singlecomp "," s ",GDK_s,2,singlepanel_create_master);
mainpanel_masterentry(panel,mastertable,"_Reverb "," r ",GDK_r,3,0); 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,"_Limit "," l ",GDK_l,5,limitpanel_create);
mainpanel_masterentry(panel,mastertable,"_Output ",NULL,GDK_l,6,0); mainpanel_masterentry(panel,mastertable,"_Output ",NULL,GDK_l,6,0);
......
...@@ -244,12 +244,13 @@ void *playback_thread(void *dummy){ ...@@ -244,12 +244,13 @@ void *playback_thread(void *dummy){
result|=link->samples; result|=link->samples;
link=suppress_read_channel(link); link=suppress_read_channel(link);
result|=link->samples; result|=link->samples;
link=eq_read_channel(link);
result|=link->samples;
link=multicompand_read_master(link); link=multicompand_read_master(link);
result|=link->samples; result|=link->samples;
link=singlecomp_read_master(link); link=singlecomp_read_master(link);
result|=link->samples; result|=link->samples;
link=eq_read_master(link); link=eq_read_master(link);
result|=link->samples; result|=link->samples;
......
#define VERSION "$Id$ " #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] */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment