mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-29 05:40:25 -04:00
Updated for latest ICE1712 driver, used ideas by Dirk Kalis <dirk.kalis@rs2.de>
This commit is contained in:
parent
f7d6dd76c1
commit
90d50374eb
5 changed files with 380 additions and 48 deletions
|
|
@ -46,8 +46,12 @@ void control_input_callback(gpointer data, gint source, GdkInputCondition condit
|
|||
spdif_input_update();
|
||||
else if (!strcmp(name, "Delta IEC958 Output Defaults"))
|
||||
spdif_output_update();
|
||||
else if (!strcmp(name, "Multi Track IEC958 Master"))
|
||||
else if (!strcmp(name, "Multi Track Internal Clock"))
|
||||
master_clock_update();
|
||||
else if (!strcmp(name, "Multi Track Rate Locking"))
|
||||
rate_locking_update();
|
||||
else if (!strcmp(name, "Multi Track Rate Reset"))
|
||||
rate_reset_update();
|
||||
else if (!strcmp(name, "Multi Playback Volume"))
|
||||
mixer_update_stream(index + 1, 1, 0);
|
||||
else if (!strcmp(name, "Multi Capture Volume"))
|
||||
|
|
@ -64,6 +68,8 @@ void control_input_callback(gpointer data, gint source, GdkInputCondition condit
|
|||
dac_volume_update(index);
|
||||
else if (!strcmp(name, "ADC Volume"))
|
||||
adc_volume_update(index);
|
||||
else if (!strcmp(name, "IPGA Analog Capture Volume"))
|
||||
ipga_volume_update(index);
|
||||
else if (!strcmp(name, "Output Sensitivity Switch"))
|
||||
dac_sense_update(index);
|
||||
else if (!strcmp(name, "Input Sensitivity Switch"))
|
||||
|
|
|
|||
|
|
@ -36,11 +36,24 @@ GtkWidget *mixer_stereo_toggle[20];
|
|||
|
||||
GtkWidget *router_radio[10][12];
|
||||
|
||||
GtkWidget *hw_master_clock_xtal_radio;
|
||||
//GtkWidget *hw_master_clock_xtal_radio;
|
||||
GtkWidget *hw_master_clock_xtal_22050;
|
||||
GtkWidget *hw_master_clock_xtal_32000;
|
||||
GtkWidget *hw_master_clock_xtal_44100;
|
||||
GtkWidget *hw_master_clock_xtal_48000;
|
||||
GtkWidget *hw_master_clock_xtal_88200;
|
||||
GtkWidget *hw_master_clock_xtal_96000;
|
||||
GtkWidget *hw_master_clock_spdif_radio;
|
||||
GtkWidget *hw_master_clock_word_radio;
|
||||
GtkWidget *hw_master_clock_status_label;
|
||||
|
||||
GtkWidget *hw_clock_state_label;
|
||||
GtkWidget *hw_clock_state_locked;
|
||||
GtkWidget *hw_clock_state_reset;
|
||||
|
||||
GtkWidget *hw_rate_locking_check;
|
||||
GtkWidget *hw_rate_reset_check;
|
||||
|
||||
GtkObject *hw_volume_change_adj;
|
||||
GtkWidget *hw_volume_change_spin;
|
||||
|
||||
|
|
@ -78,8 +91,10 @@ GtkWidget *hw_spdif_input_optical_radio;
|
|||
|
||||
GtkObject *av_dac_volume_adj[10];
|
||||
GtkObject *av_adc_volume_adj[10];
|
||||
GtkObject *av_ipga_volume_adj[10];
|
||||
GtkLabel *av_dac_volume_label[10];
|
||||
GtkLabel *av_adc_volume_label[10];
|
||||
GtkLabel *av_ipga_volume_label[10];
|
||||
GtkWidget *av_dac_sense_radio[10][4];
|
||||
GtkWidget *av_adc_sense_radio[10][4];
|
||||
|
||||
|
|
@ -430,31 +445,81 @@ static void create_master_clock(GtkWidget *fixed)
|
|||
gtk_widget_show(frame);
|
||||
gtk_fixed_put(GTK_FIXED(fixed), frame, 8, 8);
|
||||
gtk_widget_set_uposition(frame, 8, 8);
|
||||
gtk_widget_set_usize(frame, 135, 140);
|
||||
gtk_widget_set_usize(frame, 135, 197);
|
||||
|
||||
fixed1 = gtk_fixed_new();
|
||||
gtk_widget_show(fixed1);
|
||||
gtk_container_add(GTK_CONTAINER(frame), fixed1);
|
||||
|
||||
radio = gtk_radio_button_new_with_label(group, "Internal Xtal");
|
||||
hw_master_clock_xtal_radio = radio;
|
||||
radio = gtk_radio_button_new_with_label(group, "Int 22050");
|
||||
hw_master_clock_xtal_22050 = radio;
|
||||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
gtk_widget_show(radio);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 8, 8);
|
||||
gtk_widget_set_uposition(radio, 8, 8);
|
||||
gtk_widget_set_usize(radio, 115, 24);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 24, 0);
|
||||
gtk_widget_set_uposition(radio, 24, 0);
|
||||
gtk_widget_set_usize(radio, 115, 16);
|
||||
gtk_signal_connect(GTK_OBJECT(radio), "toggled",
|
||||
(GtkSignalFunc)master_clock_toggled, (gpointer)"Xtal");
|
||||
(GtkSignalFunc)internal_clock_toggled, (gpointer)"22050");
|
||||
|
||||
radio = gtk_radio_button_new_with_label(group, "Int 32000");
|
||||
hw_master_clock_xtal_32000 = radio;
|
||||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
gtk_widget_show(radio);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 12, 16);
|
||||
gtk_widget_set_uposition(radio, 12, 16);
|
||||
gtk_widget_set_usize(radio, 115, 16);
|
||||
gtk_signal_connect(GTK_OBJECT(radio), "toggled",
|
||||
(GtkSignalFunc)internal_clock_toggled, (gpointer)"32000");
|
||||
|
||||
radio = gtk_radio_button_new_with_label(group, "Int 44100");
|
||||
hw_master_clock_xtal_44100 = radio;
|
||||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
gtk_widget_show(radio);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 12, 32);
|
||||
gtk_widget_set_uposition(radio, 12, 32);
|
||||
gtk_widget_set_usize(radio, 115, 16);
|
||||
gtk_signal_connect(GTK_OBJECT(radio), "toggled",
|
||||
(GtkSignalFunc)internal_clock_toggled, (gpointer)"44100");
|
||||
|
||||
radio = gtk_radio_button_new_with_label(group, "Int 48000");
|
||||
hw_master_clock_xtal_48000 = radio;
|
||||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
gtk_widget_show(radio);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 12, 48);
|
||||
gtk_widget_set_uposition(radio, 12, 48);
|
||||
gtk_widget_set_usize(radio, 115, 16);
|
||||
gtk_signal_connect(GTK_OBJECT(radio), "toggled",
|
||||
(GtkSignalFunc)internal_clock_toggled, (gpointer)"48000");
|
||||
|
||||
radio = gtk_radio_button_new_with_label(group, "Int 88200");
|
||||
hw_master_clock_xtal_88200 = radio;
|
||||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
gtk_widget_show(radio);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 12, 64);
|
||||
gtk_widget_set_uposition(radio, 12, 64);
|
||||
gtk_widget_set_usize(radio, 115, 16);
|
||||
gtk_signal_connect(GTK_OBJECT(radio), "toggled",
|
||||
(GtkSignalFunc)internal_clock_toggled, (gpointer)"88200");
|
||||
|
||||
radio = gtk_radio_button_new_with_label(group, "Int 96000");
|
||||
hw_master_clock_xtal_96000 = radio;
|
||||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
gtk_widget_show(radio);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 12, 80);
|
||||
gtk_widget_set_uposition(radio, 12, 80);
|
||||
gtk_widget_set_usize(radio, 115, 16);
|
||||
gtk_signal_connect(GTK_OBJECT(radio), "toggled",
|
||||
(GtkSignalFunc)internal_clock_toggled, (gpointer)"96000");
|
||||
|
||||
radio = gtk_radio_button_new_with_label(group, "S/PDIF In");
|
||||
hw_master_clock_spdif_radio = radio;
|
||||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
gtk_widget_show(radio);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 8, 32);
|
||||
gtk_widget_set_uposition(radio, 8, 32);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 8, 104);
|
||||
gtk_widget_set_uposition(radio, 8, 104);
|
||||
gtk_widget_set_usize(radio, 115, 24);
|
||||
gtk_signal_connect(GTK_OBJECT(radio), "toggled",
|
||||
(GtkSignalFunc)master_clock_toggled, (gpointer)"SPDIF");
|
||||
(GtkSignalFunc)internal_clock_toggled, (gpointer)"SPDIF");
|
||||
|
||||
if (card_eeprom.subvendor != ICE1712_SUBDEVICE_DELTA1010)
|
||||
return;
|
||||
|
|
@ -463,16 +528,16 @@ static void create_master_clock(GtkWidget *fixed)
|
|||
hw_master_clock_word_radio = radio;
|
||||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
gtk_widget_show(radio);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 8, 56);
|
||||
gtk_widget_set_uposition(radio, 8, 56);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), radio, 8, 128);
|
||||
gtk_widget_set_uposition(radio, 8, 128);
|
||||
gtk_widget_set_usize(radio, 115, 24);
|
||||
gtk_signal_connect(GTK_OBJECT(radio), "toggled",
|
||||
(GtkSignalFunc)master_clock_toggled, (gpointer)"WordClock");
|
||||
(GtkSignalFunc)internal_clock_toggled, (gpointer)"WordClock");
|
||||
|
||||
viewport = gtk_viewport_new(NULL, NULL);
|
||||
gtk_widget_show(viewport);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), viewport, 9, 80);
|
||||
gtk_widget_set_uposition(viewport, 9, 80);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), viewport, 9, 147);
|
||||
gtk_widget_set_uposition(viewport, 9, 147);
|
||||
gtk_widget_set_usize(viewport, 90, 26);
|
||||
|
||||
fixed2 = gtk_fixed_new();
|
||||
|
|
@ -487,6 +552,42 @@ static void create_master_clock(GtkWidget *fixed)
|
|||
gtk_widget_set_usize(label, 86, 16);
|
||||
}
|
||||
|
||||
static void create_rate_state(GtkWidget *fixed)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *fixed1;
|
||||
GtkWidget *check;
|
||||
|
||||
frame = gtk_frame_new("Rate State");
|
||||
gtk_widget_show(frame);
|
||||
gtk_fixed_put(GTK_FIXED(fixed), frame, 8, 208);
|
||||
gtk_widget_set_uposition(frame, 8, 208);
|
||||
gtk_widget_set_usize(frame, 135, 39);
|
||||
|
||||
fixed1 = gtk_fixed_new();
|
||||
gtk_widget_show(fixed1);
|
||||
gtk_container_add(GTK_CONTAINER(frame), fixed1);
|
||||
|
||||
check = gtk_check_button_new_with_label("locked");
|
||||
hw_rate_locking_check = check;
|
||||
gtk_widget_show(check);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), check, 8, 0);
|
||||
gtk_widget_set_uposition(check, 8, 0);
|
||||
gtk_widget_set_usize(check, 115, 16);
|
||||
gtk_signal_connect(GTK_OBJECT(check), "toggled",
|
||||
(GtkSignalFunc)rate_locking_toggled, (gpointer)"locked");
|
||||
|
||||
check = gtk_check_button_new_with_label("reset");
|
||||
hw_rate_reset_check = check;
|
||||
gtk_widget_show(check);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), check, 76, 0);
|
||||
gtk_widget_set_uposition(check, 76, 0);
|
||||
gtk_widget_set_usize(check, 115, 16);
|
||||
gtk_signal_connect(GTK_OBJECT(check), "toggled",
|
||||
(GtkSignalFunc)rate_reset_toggled, (gpointer)"reset");
|
||||
|
||||
}
|
||||
|
||||
static void create_volume_change(GtkWidget *fixed)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
|
|
@ -497,9 +598,9 @@ static void create_volume_change(GtkWidget *fixed)
|
|||
|
||||
frame = gtk_frame_new("Volume Change");
|
||||
gtk_widget_show(frame);
|
||||
gtk_fixed_put(GTK_FIXED(fixed), frame, 8, 167);
|
||||
gtk_widget_set_uposition(frame, 8, 167);
|
||||
gtk_widget_set_usize(frame, 135, 140);
|
||||
gtk_fixed_put(GTK_FIXED(fixed), frame, 8, 250);
|
||||
gtk_widget_set_uposition(frame, 8, 250);
|
||||
gtk_widget_set_usize(frame, 135, 58);
|
||||
|
||||
fixed1 = gtk_fixed_new();
|
||||
gtk_widget_show(fixed1);
|
||||
|
|
@ -972,6 +1073,7 @@ static void create_hardware(GtkWidget *main, GtkWidget *notebook, int page)
|
|||
gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page), label);
|
||||
|
||||
create_master_clock(fixed);
|
||||
create_rate_state(fixed);
|
||||
create_volume_change(fixed);
|
||||
create_spdif_output_settings(fixed);
|
||||
create_spdif_input_select(fixed);
|
||||
|
|
@ -1139,6 +1241,41 @@ static void create_analog_volume(GtkWidget *main, GtkWidget *notebook, int page)
|
|||
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio));
|
||||
}
|
||||
}
|
||||
|
||||
/* create IPGA */
|
||||
for (i = 0; i < envy_ipga_volumes(); i++) {
|
||||
char name[32];
|
||||
sprintf(name, "IPGA %d", i);
|
||||
frame = gtk_frame_new(name);
|
||||
gtk_widget_show(frame);
|
||||
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_fixed_put(GTK_FIXED(fixed), frame, 2 + (i + envy_dac_volumes() + envy_adc_volumes()) * 120, 2);
|
||||
gtk_widget_set_uposition(frame, 2 + (i + envy_dac_volumes() + envy_adc_volumes()) * 120, 2);
|
||||
gtk_widget_set_usize(frame, 115, 288);
|
||||
|
||||
fixed1 = gtk_fixed_new();
|
||||
gtk_widget_show(fixed1);
|
||||
gtk_container_add(GTK_CONTAINER(frame), fixed1);
|
||||
|
||||
adj = gtk_adjustment_new(0, -36, 0, 1, 16, 0);
|
||||
av_ipga_volume_adj[i] = adj;
|
||||
vscale = gtk_vscale_new(GTK_ADJUSTMENT(adj));
|
||||
gtk_scale_set_draw_value(GTK_SCALE(vscale), FALSE);
|
||||
gtk_widget_show(vscale);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), vscale, 26, 2);
|
||||
gtk_widget_set_usize(vscale, 66, 180);
|
||||
gtk_scale_set_value_pos(GTK_SCALE(vscale), GTK_POS_BOTTOM);
|
||||
gtk_scale_set_digits(GTK_SCALE(vscale), 0);
|
||||
gtk_signal_connect(GTK_OBJECT(adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC(ipga_volume_adjust), (gpointer)(i));
|
||||
|
||||
label = gtk_label_new("100 (-000dB)");
|
||||
av_ipga_volume_label[i] = (GtkLabel *)label;
|
||||
gtk_widget_show(label);
|
||||
gtk_fixed_put(GTK_FIXED(fixed1), label, 4, 182);
|
||||
gtk_widget_set_uposition(label, 4, 182);
|
||||
gtk_widget_set_usize(label, 105, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -58,11 +58,20 @@ extern GtkWidget *mixer_stereo_toggle[20];
|
|||
|
||||
extern GtkWidget *router_radio[10][12];
|
||||
|
||||
extern GtkWidget *hw_master_clock_xtal_radio;
|
||||
//extern GtkWidget *hw_master_clock_xtal_radio;
|
||||
extern GtkWidget *hw_master_clock_xtal_22050;
|
||||
extern GtkWidget *hw_master_clock_xtal_32000;
|
||||
extern GtkWidget *hw_master_clock_xtal_44100;
|
||||
extern GtkWidget *hw_master_clock_xtal_48000;
|
||||
extern GtkWidget *hw_master_clock_xtal_88200;
|
||||
extern GtkWidget *hw_master_clock_xtal_96000;
|
||||
extern GtkWidget *hw_master_clock_spdif_radio;
|
||||
extern GtkWidget *hw_master_clock_word_radio;
|
||||
extern GtkWidget *hw_master_clock_status_label;
|
||||
|
||||
extern GtkWidget *hw_rate_locking_check;
|
||||
extern GtkWidget *hw_rate_reset_check;
|
||||
|
||||
extern GtkObject *hw_volume_change_adj;
|
||||
extern GtkWidget *hw_volume_change_spin;
|
||||
|
||||
|
|
@ -100,8 +109,10 @@ extern GtkWidget *hw_spdif_input_optical_radio;
|
|||
|
||||
extern GtkObject *av_dac_volume_adj[];
|
||||
extern GtkObject *av_adc_volume_adj[];
|
||||
extern GtkObject *av_ipga_volume_adj[];
|
||||
extern GtkLabel *av_dac_volume_label[];
|
||||
extern GtkLabel *av_adc_volume_label[];
|
||||
extern GtkLabel *av_ipga_volume_label[];
|
||||
extern GtkWidget *av_dac_sense_radio[][4];
|
||||
extern GtkWidget *av_adc_sense_radio[][4];
|
||||
|
||||
|
|
@ -125,8 +136,12 @@ void patchbay_init(void);
|
|||
void patchbay_postinit(void);
|
||||
|
||||
void master_clock_update(void);
|
||||
void master_clock_toggled(GtkWidget *togglebutton, gpointer data);
|
||||
gint master_clock_status_timeout_callback(gpointer data);
|
||||
void internal_clock_toggled(GtkWidget *togglebutton, gpointer data);
|
||||
void rate_locking_update(void);
|
||||
void rate_locking_toggled(GtkWidget *togglebutton, gpointer data);
|
||||
void rate_reset_update(void);
|
||||
void rate_reset_toggled(GtkWidget *togglebutton, gpointer data);
|
||||
void volume_change_rate_update(void);
|
||||
void volume_change_rate_adj(GtkAdjustment *adj, gpointer data);
|
||||
void profi_data_toggled(GtkWidget *togglebutton, gpointer data);
|
||||
|
|
@ -146,6 +161,7 @@ void analog_volume_init(void);
|
|||
void analog_volume_postinit(void);
|
||||
int envy_dac_volumes(void);
|
||||
int envy_adc_volumes(void);
|
||||
int envy_ipga_volumes(void);
|
||||
int envy_dac_senses(void);
|
||||
int envy_adc_senses(void);
|
||||
int envy_dac_sense_items(void);
|
||||
|
|
@ -156,10 +172,12 @@ int envy_analog_volume_available(void);
|
|||
|
||||
void dac_volume_update(int idx);
|
||||
void adc_volume_update(int idx);
|
||||
void ipga_volume_update(int idx);
|
||||
void dac_sense_update(int idx);
|
||||
void adc_sense_update(int idx);
|
||||
void dac_volume_adjust(GtkAdjustment *adj, gpointer data);
|
||||
void adc_volume_adjust(GtkAdjustment *adj, gpointer data);
|
||||
void ipga_volume_adjust(GtkAdjustment *adj, gpointer data);
|
||||
void dac_sense_toggled(GtkWidget *togglebutton, gpointer data);
|
||||
void adc_sense_toggled(GtkWidget *togglebutton, gpointer data);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,10 @@
|
|||
|
||||
#include "envy24control.h"
|
||||
|
||||
static snd_ctl_elem_value_t *spdif_master;
|
||||
static snd_ctl_elem_value_t *internal_clock;
|
||||
static snd_ctl_elem_value_t *word_clock_sync;
|
||||
static snd_ctl_elem_value_t *rate_locking;
|
||||
static snd_ctl_elem_value_t *rate_reset;
|
||||
static snd_ctl_elem_value_t *volume_rate;
|
||||
static snd_ctl_elem_value_t *spdif_input;
|
||||
static snd_ctl_elem_value_t *spdif_output;
|
||||
|
|
@ -35,35 +37,38 @@ static int is_active(GtkWidget *widget)
|
|||
|
||||
void master_clock_update(void)
|
||||
{
|
||||
int err;
|
||||
int err, rate;
|
||||
|
||||
if ((err = snd_ctl_elem_read(ctl, spdif_master)) < 0)
|
||||
g_print("Unable to read S/PDIF master state: %s\n", snd_strerror(err));
|
||||
if ((err = snd_ctl_elem_read(ctl, internal_clock)) < 0)
|
||||
g_print("Unable to read Internal Clock state: %s\n", snd_strerror(err));
|
||||
if (card_eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010) {
|
||||
if ((err = snd_ctl_elem_read(ctl, word_clock_sync)) < 0)
|
||||
g_print("Unable to read word clock sync selection: %s\n", snd_strerror(err));
|
||||
}
|
||||
if (snd_ctl_elem_value_get_boolean(spdif_master, 0)) {
|
||||
if (snd_ctl_elem_value_get_enumerated(internal_clock, 0) == 13) {
|
||||
if (snd_ctl_elem_value_get_boolean(word_clock_sync, 0)) {
|
||||
toggle_set(hw_master_clock_word_radio, TRUE);
|
||||
} else {
|
||||
toggle_set(hw_master_clock_spdif_radio, TRUE);
|
||||
}
|
||||
} else {
|
||||
toggle_set(hw_master_clock_xtal_radio, TRUE);
|
||||
// toggle_set(hw_master_clock_xtal_radio, TRUE);
|
||||
rate = snd_ctl_elem_value_get_enumerated(internal_clock, 0);
|
||||
switch (rate) {
|
||||
case 5: toggle_set(hw_master_clock_xtal_22050, TRUE); break;
|
||||
case 7: toggle_set(hw_master_clock_xtal_32000, TRUE); break;
|
||||
case 8: toggle_set(hw_master_clock_xtal_44100, TRUE); break;
|
||||
case 9: toggle_set(hw_master_clock_xtal_48000, TRUE); break;
|
||||
case 11: toggle_set(hw_master_clock_xtal_88200, TRUE); break;
|
||||
case 12: toggle_set(hw_master_clock_xtal_96000, TRUE); break;
|
||||
default:
|
||||
g_print("Error in rate: %d\n", rate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
master_clock_status_timeout_callback(NULL);
|
||||
}
|
||||
|
||||
static void master_clock_spdif_master(int on)
|
||||
{
|
||||
int err;
|
||||
|
||||
snd_ctl_elem_value_set_boolean(spdif_master, 0, on ? 1 : 0);
|
||||
if ((err = snd_ctl_elem_write(ctl, spdif_master)) < 0)
|
||||
g_print("Unable to write S/PDIF master state: %s\n", snd_strerror(err));
|
||||
}
|
||||
|
||||
static void master_clock_word_select(int on)
|
||||
{
|
||||
int err;
|
||||
|
|
@ -75,22 +80,40 @@ static void master_clock_word_select(int on)
|
|||
g_print("Unable to write word clock sync selection: %s\n", snd_strerror(err));
|
||||
}
|
||||
|
||||
void master_clock_toggled(GtkWidget *togglebutton, gpointer data)
|
||||
static void internal_clock_set(int xrate)
|
||||
{
|
||||
int err;
|
||||
|
||||
master_clock_word_select(0);
|
||||
snd_ctl_elem_value_set_enumerated(internal_clock, 0, xrate);
|
||||
if ((err = snd_ctl_elem_write(ctl, internal_clock)) < 0)
|
||||
g_print("Unable to write internal clock rate: %s\n", snd_strerror(err));
|
||||
}
|
||||
|
||||
void internal_clock_toggled(GtkWidget *togglebutton, gpointer data)
|
||||
{
|
||||
char *what = (char *) data;
|
||||
|
||||
if (!is_active(togglebutton))
|
||||
return;
|
||||
if (!strcmp(what, "Xtal")) {
|
||||
master_clock_spdif_master(0);
|
||||
if (!strcmp(what, "22050")) {
|
||||
internal_clock_set(5);
|
||||
} else if (!strcmp(what, "32000")) {
|
||||
internal_clock_set(7);
|
||||
} else if (!strcmp(what, "44100")) {
|
||||
internal_clock_set(8);
|
||||
} else if (!strcmp(what, "48000")) {
|
||||
internal_clock_set(9);
|
||||
} else if (!strcmp(what, "88200")) {
|
||||
internal_clock_set(11);
|
||||
} else if (!strcmp(what, "96000")) {
|
||||
internal_clock_set(12);
|
||||
} else if (!strcmp(what, "SPDIF")) {
|
||||
master_clock_spdif_master(1);
|
||||
master_clock_word_select(0);
|
||||
internal_clock_set(13);
|
||||
} else if (!strcmp(what, "WordClock")) {
|
||||
master_clock_spdif_master(1);
|
||||
master_clock_word_select(1);
|
||||
} else {
|
||||
g_print("master_clock_toggled: %s ???\n", what);
|
||||
g_print("internal_clock_toggled: %s ???\n", what);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -111,6 +134,74 @@ gint master_clock_status_timeout_callback(gpointer data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void rate_locking_update(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((err = snd_ctl_elem_read(ctl, rate_locking)) < 0)
|
||||
g_print("Unable to read rate locking state: %s\n", snd_strerror(err));
|
||||
if (snd_ctl_elem_value_get_boolean(rate_locking, 0))
|
||||
toggle_set(hw_rate_locking_check, TRUE);
|
||||
}
|
||||
|
||||
void rate_reset_update(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((err = snd_ctl_elem_read(ctl, rate_reset)) < 0)
|
||||
g_print("Unable to read rate reset state: %s\n", snd_strerror(err));
|
||||
if (snd_ctl_elem_value_get_boolean(rate_reset, 0))
|
||||
toggle_set(hw_rate_reset_check, TRUE);
|
||||
}
|
||||
|
||||
static void rate_locking_set(int on)
|
||||
{
|
||||
int err;
|
||||
|
||||
snd_ctl_elem_value_set_boolean(rate_locking, 0, on ? 1 : 0);
|
||||
if ((err = snd_ctl_elem_write(ctl, rate_locking)) < 0)
|
||||
g_print("Unable to write rate locking state: %s\n", snd_strerror(err));
|
||||
}
|
||||
|
||||
static void rate_reset_set(int on)
|
||||
{
|
||||
int err;
|
||||
|
||||
snd_ctl_elem_value_set_boolean(rate_reset, 0, on ? 1 : 0);
|
||||
if ((err = snd_ctl_elem_write(ctl, rate_reset)) < 0)
|
||||
g_print("Unable to write rate reset state: %s\n", snd_strerror(err));
|
||||
}
|
||||
|
||||
void rate_locking_toggled(GtkWidget *togglebutton, gpointer data)
|
||||
{
|
||||
char *what = (char *) data;
|
||||
|
||||
if (!is_active(togglebutton)) {
|
||||
rate_locking_set(0);
|
||||
return;
|
||||
}
|
||||
if (!strcmp(what, "locked")) {
|
||||
rate_locking_set(1);
|
||||
} else {
|
||||
g_print("rate_locking_toggled: %s ???\n", what);
|
||||
}
|
||||
}
|
||||
|
||||
void rate_reset_toggled(GtkWidget *togglebutton, gpointer data)
|
||||
{
|
||||
char *what = (char *) data;
|
||||
|
||||
if (!is_active(togglebutton)) {
|
||||
rate_reset_set(0);
|
||||
return;
|
||||
}
|
||||
if (!strcmp(what, "reset")) {
|
||||
rate_reset_set(1);
|
||||
} else {
|
||||
g_print("rate_reset_toggled: %s ???\n", what);
|
||||
}
|
||||
}
|
||||
|
||||
void volume_change_rate_update(void)
|
||||
{
|
||||
int err;
|
||||
|
|
@ -406,8 +497,10 @@ void spdif_input_toggled(GtkWidget *togglebutton, gpointer data)
|
|||
|
||||
void hardware_init(void)
|
||||
{
|
||||
if (snd_ctl_elem_value_malloc(&spdif_master) < 0 ||
|
||||
if (snd_ctl_elem_value_malloc(&internal_clock) < 0 ||
|
||||
snd_ctl_elem_value_malloc(&word_clock_sync) < 0 ||
|
||||
snd_ctl_elem_value_malloc(&rate_locking) < 0 ||
|
||||
snd_ctl_elem_value_malloc(&rate_reset) < 0 ||
|
||||
snd_ctl_elem_value_malloc(&volume_rate) < 0 ||
|
||||
snd_ctl_elem_value_malloc(&spdif_input) < 0 ||
|
||||
snd_ctl_elem_value_malloc(&spdif_output) < 0) {
|
||||
|
|
@ -415,12 +508,18 @@ void hardware_init(void)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
snd_ctl_elem_value_set_interface(spdif_master, SND_CTL_ELEM_IFACE_MIXER);
|
||||
snd_ctl_elem_value_set_name(spdif_master, "Multi Track IEC958 Master");
|
||||
snd_ctl_elem_value_set_interface(internal_clock, SND_CTL_ELEM_IFACE_MIXER);
|
||||
snd_ctl_elem_value_set_name(internal_clock, "Multi Track Internal Clock");
|
||||
|
||||
snd_ctl_elem_value_set_interface(word_clock_sync, SND_CTL_ELEM_IFACE_PCM);
|
||||
snd_ctl_elem_value_set_name(word_clock_sync, "Word Clock Sync");
|
||||
|
||||
snd_ctl_elem_value_set_interface(rate_locking, SND_CTL_ELEM_IFACE_MIXER);
|
||||
snd_ctl_elem_value_set_name(rate_locking, "Multi Track Rate Locking");
|
||||
|
||||
snd_ctl_elem_value_set_interface(rate_reset, SND_CTL_ELEM_IFACE_MIXER);
|
||||
snd_ctl_elem_value_set_name(rate_reset, "Multi Track Rate Reset");
|
||||
|
||||
snd_ctl_elem_value_set_interface(volume_rate, SND_CTL_ELEM_IFACE_MIXER);
|
||||
snd_ctl_elem_value_set_name(volume_rate, "Multi Track Volume Rate");
|
||||
|
||||
|
|
@ -434,6 +533,8 @@ void hardware_init(void)
|
|||
void hardware_postinit(void)
|
||||
{
|
||||
master_clock_update();
|
||||
rate_locking_update();
|
||||
rate_reset_update();
|
||||
volume_change_rate_update();
|
||||
spdif_input_update();
|
||||
spdif_output_update();
|
||||
|
|
|
|||
|
|
@ -27,11 +27,13 @@
|
|||
|
||||
#define DAC_VOLUME_NAME "DAC Volume"
|
||||
#define ADC_VOLUME_NAME "ADC Volume"
|
||||
#define IPGA_VOLUME_NAME "IPGA Analog Capture Volume"
|
||||
#define DAC_SENSE_NAME "Output Sensitivity Switch"
|
||||
#define ADC_SENSE_NAME "Input Sensitivity Switch"
|
||||
|
||||
static int dac_volumes;
|
||||
static int adc_volumes;
|
||||
static int ipga_volumes;
|
||||
static int dac_senses;
|
||||
static int adc_senses;
|
||||
static int dac_sense_items;
|
||||
|
|
@ -49,6 +51,11 @@ int envy_adc_volumes(void)
|
|||
return adc_volumes;
|
||||
}
|
||||
|
||||
int envy_ipga_volumes(void)
|
||||
{
|
||||
return ipga_volumes;
|
||||
}
|
||||
|
||||
int envy_dac_senses(void)
|
||||
{
|
||||
return dac_senses;
|
||||
|
|
@ -81,7 +88,7 @@ const char *envy_adc_sense_enum_name(int i)
|
|||
|
||||
int envy_analog_volume_available(void)
|
||||
{
|
||||
return dac_volumes > 0 || adc_volumes > 0;
|
||||
return dac_volumes > 0 || adc_volumes > 0 || ipga_volumes > 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -118,6 +125,38 @@ void adc_volume_update(int idx)
|
|||
}
|
||||
gtk_adjustment_set_value(GTK_ADJUSTMENT(av_adc_volume_adj[idx]),
|
||||
-snd_ctl_elem_value_get_integer(val, 0));
|
||||
snd_ctl_elem_value_set_name(val, IPGA_VOLUME_NAME);
|
||||
snd_ctl_elem_value_set_index(val, idx);
|
||||
if ((err = snd_ctl_elem_read(ctl, val)) < 0) {
|
||||
g_print("Unable to read ipga volume: %s\n", snd_strerror(err));
|
||||
return;
|
||||
}
|
||||
gtk_adjustment_set_value(GTK_ADJUSTMENT(av_ipga_volume_adj[idx]),
|
||||
-0);
|
||||
}
|
||||
|
||||
void ipga_volume_update(int idx)
|
||||
{
|
||||
snd_ctl_elem_value_t *val;
|
||||
int err;
|
||||
snd_ctl_elem_value_alloca(&val);
|
||||
snd_ctl_elem_value_set_interface(val, SND_CTL_ELEM_IFACE_MIXER);
|
||||
snd_ctl_elem_value_set_name(val, IPGA_VOLUME_NAME);
|
||||
snd_ctl_elem_value_set_index(val, idx);
|
||||
if ((err = snd_ctl_elem_read(ctl, val)) < 0) {
|
||||
g_print("Unable to read ipga volume: %s\n", snd_strerror(err));
|
||||
return;
|
||||
}
|
||||
gtk_adjustment_set_value(GTK_ADJUSTMENT(av_ipga_volume_adj[idx]),
|
||||
-snd_ctl_elem_value_get_integer(val, 0));
|
||||
snd_ctl_elem_value_set_name(val, ADC_VOLUME_NAME);
|
||||
snd_ctl_elem_value_set_index(val, idx);
|
||||
if ((err = snd_ctl_elem_read(ctl, val)) < 0) {
|
||||
g_print("Unable to read adc volume: %s\n", snd_strerror(err));
|
||||
return;
|
||||
}
|
||||
gtk_adjustment_set_value(GTK_ADJUSTMENT(av_adc_volume_adj[idx]),
|
||||
-127);
|
||||
}
|
||||
|
||||
void dac_sense_update(int idx)
|
||||
|
|
@ -194,6 +233,24 @@ void adc_volume_adjust(GtkAdjustment *adj, gpointer data)
|
|||
g_print("Unable to write adc volume: %s\n", snd_strerror(err));
|
||||
}
|
||||
|
||||
void ipga_volume_adjust(GtkAdjustment *adj, gpointer data)
|
||||
{
|
||||
int idx = (int)data;
|
||||
snd_ctl_elem_value_t *val;
|
||||
int err, ival = -(int)adj->value;
|
||||
char text[16];
|
||||
|
||||
snd_ctl_elem_value_alloca(&val);
|
||||
snd_ctl_elem_value_set_interface(val, SND_CTL_ELEM_IFACE_MIXER);
|
||||
snd_ctl_elem_value_set_name(val, IPGA_VOLUME_NAME);
|
||||
snd_ctl_elem_value_set_index(val, idx);
|
||||
snd_ctl_elem_value_set_integer(val, 0, ival);
|
||||
sprintf(text, "%03i %s", ival, ival == 0 ? "0dB" : (ival == 36 ? "+18dB" : ""));
|
||||
gtk_label_set_text(av_ipga_volume_label[idx], text);
|
||||
if ((err = snd_ctl_elem_write(ctl, val)) < 0)
|
||||
g_print("Unable to write ipga volume: %s\n", snd_strerror(err));
|
||||
}
|
||||
|
||||
void dac_sense_toggled(GtkWidget *togglebutton, gpointer data)
|
||||
{
|
||||
int idx = (long)data >> 8;
|
||||
|
|
@ -292,6 +349,15 @@ void analog_volume_init(void)
|
|||
adc_sense_name[i] = strdup(snd_ctl_elem_info_get_item_name(info));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
snd_ctl_elem_info_set_name(info, IPGA_VOLUME_NAME);
|
||||
snd_ctl_elem_info_set_numid(info, 0);
|
||||
snd_ctl_elem_info_set_index(info, i);
|
||||
if (snd_ctl_elem_info(ctl, info) < 0)
|
||||
break;
|
||||
}
|
||||
ipga_volumes = i;
|
||||
}
|
||||
|
||||
void analog_volume_postinit(void)
|
||||
|
|
@ -306,6 +372,10 @@ void analog_volume_postinit(void)
|
|||
adc_volume_update(i);
|
||||
adc_volume_adjust((GtkAdjustment *)av_adc_volume_adj[i], (gpointer)i);
|
||||
}
|
||||
for (i = 0; i < ipga_volumes; i++) {
|
||||
ipga_volume_update(i);
|
||||
ipga_volume_adjust((GtkAdjustment *)av_ipga_volume_adj[i], (gpointer)i);
|
||||
}
|
||||
for (i = 0; i < dac_senses; i++)
|
||||
dac_sense_update(i);
|
||||
for (i = 0; i < adc_senses; i++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue