From f1f085abcf578a633e55eaeaa7031d54bffd3209 Mon Sep 17 00:00:00 2001 From: "Geoffrey D. Bennett" Date: Thu, 20 Feb 2025 23:50:15 +1030 Subject: [PATCH] Add support for new 4th Gen control names The 4th Gen driver has renamed "Line" to "Analogue" and removed "Input" and "Output" in cases like "Mixer Input", "DSP Input", and "Analogue Output". Some numbers are no longer zero-padded. --- src/alsa.c | 10 ++++++---- src/iface-mixer.c | 6 +++++- src/window-routing.c | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/alsa.c b/src/alsa.c index 9e6fe3e..8038374 100644 --- a/src/alsa.c +++ b/src/alsa.c @@ -597,14 +597,14 @@ static void get_routing_snks(struct alsa_card *card) { elem->is_routing_snk = 1; - if (strncmp(elem->name, "Mixer Input", 11) == 0 || + if (strncmp(elem->name, "Mixer", 5) == 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) { + } else if (strncmp(elem->name, "DSP", 3) == 0) { elem->port_category = PC_DSP; } else if (strncmp(elem->name, "PCM", 3) == 0 || strncmp(elem->name, "Input Source", 12) == 0) { @@ -664,10 +664,12 @@ void alsa_get_routing_controls(struct alsa_card *card) { // check that we can find a routing control card->sample_capture_elem = get_elem_by_name(card->elems, "PCM 01 Capture Enum"); - if (!card->sample_capture_elem) { + if (!card->sample_capture_elem) + card->sample_capture_elem = + get_elem_by_name(card->elems, "PCM 1 Capture Enum"); + if (!card->sample_capture_elem) card->sample_capture_elem = get_elem_by_name(card->elems, "Input Source 01 Capture Route"); - } if (!card->sample_capture_elem) { fprintf( diff --git a/src/iface-mixer.c b/src/iface-mixer.c index 723a0ec..5e82a84 100644 --- a/src/iface-mixer.c +++ b/src/iface-mixer.c @@ -813,7 +813,8 @@ static void create_output_controls( gtk_grid_attach(GTK_GRID(output_grid), w, 0, 1, 1, 1); } else if (strncmp(elem->name, "Line", 4) == 0 || - strncmp(elem->name, "Master", 4) == 0) { + strncmp(elem->name, "Master", 4) == 0 || + strncmp(elem->name, "Analogue", 8) == 0) { if (strstr(elem->name, "Playback Volume")) { w = make_gain_alsa_elem(elem, 1, WIDGET_GAIN_TAPER_LOG, 1); @@ -966,6 +967,9 @@ static GtkWidget *create_main_window_controls(struct alsa_card *card) { if (!output_count) output_count = get_max_elem_by_name(card->elems, "Master", "Playback Volume") * 2; + if (!output_count) + output_count = + get_max_elem_by_name(card->elems, "Analogue", "Playback Volume"); create_global_controls(card, top, &x); create_input_controls(card, top, &x, input_count); diff --git a/src/window-routing.c b/src/window-routing.c index 82a07d0..0436b2a 100644 --- a/src/window-routing.c +++ b/src/window-routing.c @@ -853,7 +853,7 @@ static void make_routing_alsa_elem(struct routing_snk *r_snk) { 0, elem->port_num + 1, 1, 1 ); - // "* Output X Playback Enum" controls go along the right, in + // "* X Playback Enum" controls go along the right, in // card->routing_hw_out_grid } else if (elem->port_category == PC_HW) {