Handle interfaces with fixed mixer inputs
This commit is contained in:
@@ -598,6 +598,10 @@ static void get_routing_snks(struct alsa_card *card) {
|
||||
if (strncmp(elem->name, "Mixer Input", 11) == 0 ||
|
||||
strncmp(elem->name, "Matrix", 6) == 0) {
|
||||
elem->port_category = PC_MIX;
|
||||
|
||||
if (!alsa_get_elem_writable(elem))
|
||||
card->has_fixed_mixer_inputs = 1;
|
||||
|
||||
} else if (strncmp(elem->name, "DSP Input", 9) == 0) {
|
||||
elem->port_category = PC_DSP;
|
||||
} else if (strncmp(elem->name, "PCM", 3) == 0 ||
|
||||
|
||||
@@ -186,6 +186,7 @@ struct alsa_card {
|
||||
GtkWidget *routing_mixer_out_grid;
|
||||
int has_speaker_switching;
|
||||
int has_talkback;
|
||||
int has_fixed_mixer_inputs;
|
||||
int routing_out_count[PC_COUNT];
|
||||
int routing_in_count[PC_COUNT];
|
||||
GMenu *routing_src_menu;
|
||||
|
||||
@@ -261,6 +261,12 @@ void draw_routing_lines(
|
||||
struct routing_snk *r_snk = &g_array_index(
|
||||
card->routing_snks, struct routing_snk, i
|
||||
);
|
||||
struct alsa_elem *elem = r_snk->elem;
|
||||
|
||||
// don't draw lines to read-only mixer sinks
|
||||
if (elem->port_category == PC_MIX &&
|
||||
card->has_fixed_mixer_inputs)
|
||||
continue;
|
||||
|
||||
// if dragging and a routing sink is being reconnected then draw
|
||||
// it with dots
|
||||
@@ -271,7 +277,7 @@ void draw_routing_lines(
|
||||
cairo_set_dash(cr, NULL, 0, 0);
|
||||
|
||||
// get the sink and skip if it's "Off"
|
||||
int r_src_idx = alsa_get_elem_value(r_snk->elem);
|
||||
int r_src_idx = alsa_get_elem_value(elem);
|
||||
if (!r_src_idx)
|
||||
continue;
|
||||
|
||||
@@ -300,7 +306,7 @@ void draw_routing_lines(
|
||||
draw_connection(
|
||||
cr,
|
||||
x1, y1, r_src->port_category,
|
||||
x2, y2, r_snk->elem->port_category,
|
||||
x2, y2, elem->port_category,
|
||||
r, g, b, 2
|
||||
);
|
||||
}
|
||||
|
||||
@@ -241,11 +241,12 @@ static void create_routing_grid(struct alsa_card *card) {
|
||||
GTK_ORIENTATION_HORIZONTAL, GTK_ALIGN_CENTER
|
||||
);
|
||||
}
|
||||
card->routing_mixer_in_grid = create_routing_group_grid(
|
||||
card, "routing_mixer_in_grid", "Mixer\nInputs",
|
||||
"Mixer Inputs are used to mix multiple audio channels together",
|
||||
GTK_ORIENTATION_HORIZONTAL, GTK_ALIGN_CENTER
|
||||
);
|
||||
if (!card->has_fixed_mixer_inputs)
|
||||
card->routing_mixer_in_grid = create_routing_group_grid(
|
||||
card, "routing_mixer_in_grid", "Mixer\nInputs",
|
||||
"Mixer Inputs are used to mix multiple audio channels together",
|
||||
GTK_ORIENTATION_HORIZONTAL, GTK_ALIGN_CENTER
|
||||
);
|
||||
card->routing_mixer_out_grid = create_routing_group_grid(
|
||||
card, "routing_mixer_out_grid",
|
||||
card->has_talkback ? "Mixer Outputs" : "Mixer\nOutputs",
|
||||
@@ -290,7 +291,9 @@ static void create_routing_grid(struct alsa_card *card) {
|
||||
gtk_label_set_justify(GTK_LABEL(src_label), GTK_JUSTIFY_CENTER);
|
||||
gtk_grid_attach(routing_grid, src_label, left_col_num, 3, 1, 1);
|
||||
|
||||
GtkWidget *snk_label = gtk_label_new("← Sinks\n↓");
|
||||
GtkWidget *snk_label = gtk_label_new(
|
||||
card->has_fixed_mixer_inputs ? "Sinks\n↓" : "← Sinks\n↓"
|
||||
);
|
||||
gtk_label_set_justify(GTK_LABEL(snk_label), GTK_JUSTIFY_CENTER);
|
||||
gtk_grid_attach(routing_grid, snk_label, right_col_num, 0, 1, 1);
|
||||
}
|
||||
@@ -720,6 +723,9 @@ static void make_routing_alsa_elem(struct routing_snk *r_snk) {
|
||||
// the top, in card->routing_mixer_in_grid after the DSP Inputs
|
||||
} else if (elem->port_category == PC_MIX) {
|
||||
|
||||
if (card->has_fixed_mixer_inputs)
|
||||
return;
|
||||
|
||||
char name[10];
|
||||
|
||||
snprintf(name, 10, "%d", elem->lr_num);
|
||||
|
||||
Reference in New Issue
Block a user