Gen 1: Add support for 1st Gen input controls

This commit is contained in:
Geoffrey D. Bennett
2025-02-20 23:02:44 +10:30
parent 845dd5c98b
commit 8178bd298b
2 changed files with 42 additions and 5 deletions

View File

@@ -210,6 +210,10 @@ button.toggle {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000; text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
} }
.window-frame button.gain-switch:checked {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
}
.window-frame button.phantom:checked { .window-frame button.phantom:checked {
text-shadow: 0 0 5px #ff0000, 0 0 15px #c00000; text-shadow: 0 0 5px #ff0000, 0 0 15px #c00000;
} }

View File

@@ -427,6 +427,25 @@ static void create_input_pad_control(
gtk_grid_attach(GTK_GRID(grid), w, column_num, current_row, 1, 1); gtk_grid_attach(GTK_GRID(grid), w, column_num, current_row, 1, 1);
} }
static void create_input_gain_switch_control(
struct alsa_elem *elem,
GtkWidget *grid,
int current_row,
int column_num
) {
GtkWidget *w = make_boolean_alsa_elem(elem, "Gain", NULL);
gtk_widget_add_css_class(w, "gain-switch");
gtk_widget_set_hexpand(w, TRUE);
gtk_widget_set_tooltip_text(
w,
"Enabling Gain switches from Low gain input (0dBFS = +16dBu)\n"
"to High gain input (0dBFS = 10dBV, approx 6dBu)."
);
// ignore current_row, always put it in the first row
gtk_grid_attach(GTK_GRID(grid), w, column_num, 1, 1, 1);
}
static void create_input_phantom_control( static void create_input_phantom_control(
struct alsa_elem *elem, struct alsa_elem *elem,
GtkWidget *grid, GtkWidget *grid,
@@ -483,13 +502,11 @@ static void create_input_controls_by_type(
static void create_input_controls( static void create_input_controls(
struct alsa_card *card, struct alsa_card *card,
GtkWidget *top, GtkWidget *top,
int *x int *x,
int input_count
) { ) {
GArray *elems = card->elems; GArray *elems = card->elems;
// find how many inputs have switches
int input_count = get_max_elem_by_name(elems, "Line", "Capture Switch");
// Only the 18i20 Gen 2 has no input controls // Only the 18i20 Gen 2 has no input controls
if (!input_count) if (!input_count)
return; return;
@@ -574,6 +591,10 @@ static void create_input_controls(
elems, input_grid, &current_row, elems, input_grid, &current_row,
"Level Capture Enum", create_input_level_control "Level Capture Enum", create_input_level_control
); );
create_input_controls_by_type(
elems, input_grid, &current_row,
"Impedance Switch", create_input_level_control
);
create_input_controls_by_type( create_input_controls_by_type(
elems, input_grid, &current_row, elems, input_grid, &current_row,
"Air Capture Switch", create_input_air_switch_control "Air Capture Switch", create_input_air_switch_control
@@ -598,6 +619,14 @@ static void create_input_controls(
elems, input_grid, &current_row, elems, input_grid, &current_row,
"Pad Capture Switch", create_input_pad_control "Pad Capture Switch", create_input_pad_control
); );
create_input_controls_by_type(
elems, input_grid, &current_row,
"Pad Switch", create_input_pad_control
);
create_input_controls_by_type(
elems, input_grid, &current_row,
"Gain Switch", create_input_gain_switch_control
);
create_input_controls_by_type( create_input_controls_by_type(
elems, input_grid, &current_row, elems, input_grid, &current_row,
"Phantom Power Capture Switch", create_input_phantom_control "Phantom Power Capture Switch", create_input_phantom_control
@@ -838,12 +867,16 @@ static GtkWidget *create_main_window_controls(struct alsa_card *card) {
int input_count = get_max_elem_by_name( int input_count = get_max_elem_by_name(
card->elems, "Line", "Capture Switch" card->elems, "Line", "Capture Switch"
); );
if (!input_count)
input_count =
get_max_elem_by_name(card->elems, "Input", "Switch");
int output_count = get_max_elem_by_name( int output_count = get_max_elem_by_name(
card->elems, "Line", "Playback Volume" card->elems, "Line", "Playback Volume"
); );
create_global_controls(card, top, &x); create_global_controls(card, top, &x);
create_input_controls(card, top, &x); create_input_controls(card, top, &x, input_count);
if (input_count + output_count >= 12) { if (input_count + output_count >= 12) {
x = 0; x = 0;