mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-29 05:40:25 -04:00
echomixer autoclock support
This patch: - Adds the "autoclock" feature. When it's enabled echomixer automatically switches between external and internal clock source if the cards receives, or it doesn't, a valid clock signal, respectively. Signed-off-by: Giuliano Pochini <pochini@shiny.it>
This commit is contained in:
parent
861570e782
commit
86a5b18787
1 changed files with 70 additions and 14 deletions
|
|
@ -95,7 +95,7 @@ char dmodeName[DIGITAL_MODES][64], clocksrcName[DIGITAL_MODES][64], spdifmodeNam
|
||||||
char NominalIn[ECHO_MAXAUDIOINPUTS], NominalOut[ECHO_MAXAUDIOOUTPUTS];
|
char NominalIn[ECHO_MAXAUDIOINPUTS], NominalOut[ECHO_MAXAUDIOOUTPUTS];
|
||||||
int nLOut, nIn, fdIn, fdOut, nPOut, ClockMask;
|
int nLOut, nIn, fdIn, fdOut, nPOut, ClockMask;
|
||||||
int ndmodes, nclocksrc, nspdifmodes;
|
int ndmodes, nclocksrc, nspdifmodes;
|
||||||
int GMixerRow, GMixerColumn, Gang;
|
int GMixerRow, GMixerColumn, Gang, AutoClock;
|
||||||
int lineinId, pcmoutId, lineoutId, mixerId, vmixerId, p4InId, p4OutId, dmodeId, clocksrcId, spdifmodeId, vuswitchId, vumetersId, channelsId, phantomId;
|
int lineinId, pcmoutId, lineoutId, mixerId, vmixerId, p4InId, p4OutId, dmodeId, clocksrcId, spdifmodeId, vuswitchId, vumetersId, channelsId, phantomId;
|
||||||
int metersStreams, metersNumber, metersTypes;
|
int metersStreams, metersNumber, metersTypes;
|
||||||
int outvolCount;
|
int outvolCount;
|
||||||
|
|
@ -189,7 +189,7 @@ struct VolumeControl {
|
||||||
|
|
||||||
GtkWidget *p4dbuOut[ECHO_MAXAUDIOOUTPUTS], *p4dbuIn[ECHO_MAXAUDIOINPUTS]; // +4dBu/-10dBV toggles
|
GtkWidget *p4dbuOut[ECHO_MAXAUDIOOUTPUTS], *p4dbuIn[ECHO_MAXAUDIOINPUTS]; // +4dBu/-10dBV toggles
|
||||||
GtkWidget *clocksrc_menuitem[ECHO_CLOCKS];
|
GtkWidget *clocksrc_menuitem[ECHO_CLOCKS];
|
||||||
GtkWidget *dmodeOpt, *clocksrcOpt, *spdifmodeOpt, *phantomChkbutton;
|
GtkWidget *dmodeOpt, *clocksrcOpt, *spdifmodeOpt, *phantomChkbutton, *autoclockChkbutton;
|
||||||
GtkWidget *window, *Mainwindow, *Miscwindow, *LVwindow, *VUwindow, *GMwindow;
|
GtkWidget *window, *Mainwindow, *Miscwindow, *LVwindow, *VUwindow, *GMwindow;
|
||||||
GtkWidget *VUdarea, *Mixdarea;
|
GtkWidget *VUdarea, *Mixdarea;
|
||||||
gint VUtimer, Mixtimer, clocksrctimer;
|
gint VUtimer, Mixtimer, clocksrctimer;
|
||||||
|
|
@ -199,6 +199,9 @@ static GdkPixmap *VUpixmap = NULL;
|
||||||
static GdkPixmap *Mixpixmap = NULL;
|
static GdkPixmap *Mixpixmap = NULL;
|
||||||
GdkFont *fnt;
|
GdkFont *fnt;
|
||||||
|
|
||||||
|
void Clock_source_activate(GtkWidget *widget, gpointer clk);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int CountBits(int n) {
|
int CountBits(int n) {
|
||||||
int c;
|
int c;
|
||||||
|
|
@ -570,11 +573,27 @@ void GetChannels(void) {
|
||||||
|
|
||||||
// Read what input clocks are valid and (de)activate the pop-down menu items accordingly
|
// Read what input clocks are valid and (de)activate the pop-down menu items accordingly
|
||||||
gint CheckInputs(gpointer unused) {
|
gint CheckInputs(gpointer unused) {
|
||||||
int i;
|
int clk, valid, source;
|
||||||
|
|
||||||
GetChannels();
|
GetChannels();
|
||||||
for (i=0; i<nclocksrc; i++)
|
source=-1;
|
||||||
gtk_widget_set_sensitive(clocksrc_menuitem[i], !!(ClockMask & (1<<i)));
|
|
||||||
|
// Switch to internal if the source is not available
|
||||||
|
if (AutoClock>=0 && !(ClockMask & (1<<clocksrcVal)))
|
||||||
|
source=0;
|
||||||
|
|
||||||
|
for (clk=0; clk<nclocksrc; clk++) {
|
||||||
|
valid=!!(ClockMask & (1<<clk));
|
||||||
|
gtk_widget_set_sensitive(clocksrc_menuitem[clk], valid);
|
||||||
|
if (clk==AutoClock && valid)
|
||||||
|
source=AutoClock;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source>=0 && source!=clocksrcVal) {
|
||||||
|
// Set the clock source, but do not change the value of AutoClock
|
||||||
|
Clock_source_activate(clocksrc_menuitem[source], (gpointer)(source|DONT_CHANGE));
|
||||||
|
gtk_option_menu_set_history(GTK_OPTION_MENU(clocksrcOpt), clocksrcVal);
|
||||||
|
}
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1378,17 +1397,37 @@ void PhantomPower_toggled(GtkWidget *widget, gpointer unused) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void AutoClock_toggled(GtkWidget *widget, gpointer unused) {
|
||||||
|
char str[32];
|
||||||
|
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
|
||||||
|
AutoClock=clocksrcVal;
|
||||||
|
snprintf(str, 31, "Autoclock [%s]", clocksrcName[AutoClock]);
|
||||||
|
str[31]=0;
|
||||||
|
gtk_label_set_text(GTK_LABEL(GTK_BIN(widget)->child), str);
|
||||||
|
} else {
|
||||||
|
AutoClock=-1;
|
||||||
|
gtk_label_set_text(GTK_LABEL(GTK_BIN(widget)->child), "Autoclock");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Digital_mode_activate(GtkWidget *widget, gpointer mode) {
|
void Digital_mode_activate(GtkWidget *widget, gpointer mode) {
|
||||||
int adat;
|
int adat;
|
||||||
|
|
||||||
if (SetEnum(dmodeId, (int)mode)<0)
|
if (SetEnum(dmodeId, (int)mode)<0) {
|
||||||
// Restore old value if it failed
|
// Restore old value if it failed
|
||||||
gtk_option_menu_set_history(GTK_OPTION_MENU(dmodeOpt), dmodeVal);
|
gtk_option_menu_set_history(GTK_OPTION_MENU(dmodeOpt), dmodeVal);
|
||||||
else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dmodeVal=(int)mode;
|
dmodeVal=(int)mode;
|
||||||
// When I change the digital mode, the clock source can change too
|
// When I change the digital mode, the clock source can change too
|
||||||
gtk_option_menu_set_history(GTK_OPTION_MENU(clocksrcOpt), clocksrcVal=GetEnum(clocksrcId));
|
clocksrcVal=GetEnum(clocksrcId);
|
||||||
}
|
gtk_option_menu_set_history(GTK_OPTION_MENU(clocksrcOpt), clocksrcVal);
|
||||||
|
|
||||||
adat=!memcmp(dmodeName[dmodeVal], "ADAT", 4);
|
adat=!memcmp(dmodeName[dmodeVal], "ADAT", 4);
|
||||||
SetSensitivity(adat);
|
SetSensitivity(adat);
|
||||||
if (adat) {
|
if (adat) {
|
||||||
|
|
@ -1403,11 +1442,19 @@ void Digital_mode_activate(GtkWidget *widget, gpointer mode) {
|
||||||
|
|
||||||
|
|
||||||
void Clock_source_activate(GtkWidget *widget, gpointer clk) {
|
void Clock_source_activate(GtkWidget *widget, gpointer clk) {
|
||||||
|
unsigned int source;
|
||||||
|
|
||||||
if (SetEnum(clocksrcId, (int)clk)<0)
|
source=(unsigned int)clk & 0xff;
|
||||||
|
if (SetEnum(clocksrcId, source)<0) {
|
||||||
gtk_option_menu_set_history(GTK_OPTION_MENU(clocksrcOpt), clocksrcVal);
|
gtk_option_menu_set_history(GTK_OPTION_MENU(clocksrcOpt), clocksrcVal);
|
||||||
else
|
} else {
|
||||||
clocksrcVal=(int)clk;
|
clocksrcVal=(int)clk & 0xff;
|
||||||
|
// Change only when the user triggers it
|
||||||
|
if (((int)clk & DONT_CHANGE)==0 && AutoClock>=0) {
|
||||||
|
AutoClock=clocksrcVal;
|
||||||
|
AutoClock_toggled(autoclockChkbutton, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2144,7 +2191,7 @@ printf("components = %s\n", snd_ctl_card_info_get_components(hw_info));*/
|
||||||
|
|
||||||
|
|
||||||
// Switches
|
// Switches
|
||||||
if (phantomId) {
|
if (phantomId || clocksrcId) {
|
||||||
frame=gtk_frame_new("Switches");
|
frame=gtk_frame_new("Switches");
|
||||||
gtk_widget_show(frame);
|
gtk_widget_show(frame);
|
||||||
gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, FALSE, 0);
|
||||||
|
|
@ -2160,6 +2207,15 @@ printf("components = %s\n", snd_ctl_card_info_get_components(hw_info));*/
|
||||||
gtk_signal_connect(GTK_OBJECT(phantomChkbutton), "toggled", PhantomPower_toggled, NULL);
|
gtk_signal_connect(GTK_OBJECT(phantomChkbutton), "toggled", PhantomPower_toggled, NULL);
|
||||||
InitPhantomPowerGUI(phantomId);
|
InitPhantomPowerGUI(phantomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto clock switch
|
||||||
|
if (clocksrcId) {
|
||||||
|
autoclockChkbutton=gtk_check_button_new_with_label("Autoclock");
|
||||||
|
gtk_widget_show(autoclockChkbutton);
|
||||||
|
gtk_box_pack_start(GTK_BOX(hbox), autoclockChkbutton, TRUE, FALSE, 0);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(autoclockChkbutton), "toggled", AutoClock_toggled, NULL);
|
||||||
|
AutoClock=-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue