diff --git a/spa/plugins/alsa/90-pipewire-alsa.rules b/spa/plugins/alsa/90-pipewire-alsa.rules index d27c63667..1752402af 100644 --- a/spa/plugins/alsa/90-pipewire-alsa.rules +++ b/spa/plugins/alsa/90-pipewire-alsa.rules @@ -110,7 +110,9 @@ ATTRS{idVendor}=="0763", ATTRS{idProduct}=="2012", ENV{PULSE_PROFILE_SET}="maudi ATTRS{idVendor}=="045e", ATTRS{idProduct}=="02bb", ENV{PULSE_PROFILE_SET}="kinect-audio.conf" ATTRS{idVendor}=="041e", ATTRS{idProduct}=="322c", ENV{PULSE_PROFILE_SET}="sb-omni-surround-5.1.conf" ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="4014", ENV{PULSE_PROFILE_SET}="dell-dock-tb16-usb-audio.conf" - +ATTRS{idVendor}=="08bb", ATTRS{idProduct}=="2902", ENV{PULSE_PROFILE_SET}="behringer-umc22.conf" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0269", ENV{PULSE_PROFILE_SET}="hp-tbt-dock-120w-g2.conf" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0567", ENV{PULSE_PROFILE_SET}="hp-tbt-dock-audio-module.conf" # ID 1038:12ad is for the 2018 refresh of the Arctis 7. # ID 1038:1294 is for Arctis Pro Wireless (which works with the Arctis 7 configuration). diff --git a/spa/plugins/alsa/acp/alsa-mixer.c b/spa/plugins/alsa/acp/alsa-mixer.c index f8935c572..8ac687994 100644 --- a/spa/plugins/alsa/acp/alsa-mixer.c +++ b/spa/plugins/alsa/acp/alsa-mixer.c @@ -3191,7 +3191,7 @@ void pa_alsa_element_dump(pa_alsa_element *e) { pa_assert(e); alsa_id_str(buf, sizeof(buf), &e->alsa_id); - pa_log_debug("Element %s, direction=%i, switch=%i, volume=%i, volume_limit=%li, enumeration=%i, required=%i, required_any=%i, required_absent=%i, mask=0x%llx, n_channels=%u, override_map=%02x", + pa_log_debug("Element %s, direction=%i, switch=%i, volume=%i, volume_limit=%li, enumeration=%i, required=%i, required_any=%i, required_absent=%i, mask=0x%llx, n_channels=%u, override_map=%s", buf, e->direction, e->switch_use, @@ -3203,7 +3203,7 @@ void pa_alsa_element_dump(pa_alsa_element *e) { e->required_absent, (long long unsigned) e->merged_mask, e->n_channels, - e->override_map); + pa_yes_no(e->override_map)); PA_LLIST_FOREACH(o, e->options) pa_alsa_option_dump(o); @@ -4313,28 +4313,42 @@ fail: } /* the logic is simple: if we see the jack in multiple paths */ -/* assign all those jacks to one availability_group */ -static void mapping_group_available(pa_hashmap *paths) -{ - void *state, *state2; - pa_alsa_path *p, *p2; - pa_alsa_jack *j, *j2; +/* assign all those paths to one availability_group */ +static void profile_set_set_availability_groups(pa_alsa_profile_set *ps) { + pa_dynarray *paths; + pa_alsa_path *p; + void *state; + unsigned idx1; uint32_t num = 1; - PA_HASHMAP_FOREACH(p, paths, state) { + /* Merge ps->input_paths and ps->output_paths into one dynarray. */ + paths = pa_dynarray_new(NULL); + PA_HASHMAP_FOREACH(p, ps->input_paths, state) + pa_dynarray_append(paths, p); + PA_HASHMAP_FOREACH(p, ps->output_paths, state) + pa_dynarray_append(paths, p); + + PA_DYNARRAY_FOREACH(p, paths, idx1) { + pa_alsa_jack *j; const char *found = NULL; bool has_control = false; + PA_LLIST_FOREACH(j, p->jacks) { + pa_alsa_path *p2; + unsigned idx2; + if (!j->has_control || j->state_plugged == PA_AVAILABLE_NO) continue; has_control = true; - PA_HASHMAP_FOREACH(p2, paths, state2) { + PA_DYNARRAY_FOREACH(p2, paths, idx2) { + pa_alsa_jack *j2; + if (p2 == p) - break; + break; PA_LLIST_FOREACH(j2, p2->jacks) { if (!j2->has_control || j2->state_plugged == PA_AVAILABLE_NO) continue; - if (pa_streq(j->name, j2->name)) { + if (pa_streq(j->alsa_name, j2->alsa_name)) { j->state_plugged = PA_AVAILABLE_UNKNOWN; j2->state_plugged = PA_AVAILABLE_UNKNOWN; found = p2->availability_group; @@ -4355,6 +4369,8 @@ static void mapping_group_available(pa_hashmap *paths) if (!found) num++; } + + pa_dynarray_free(paths); } static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, @@ -4405,8 +4421,6 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, PA_HASHMAP_FOREACH(p, ps->paths, state) pa_hashmap_put(used_paths, p, p); - mapping_group_available(ps->paths); - pa_log_debug("Available mixer paths (after tidying):"); pa_alsa_path_set_dump(ps); } @@ -4415,6 +4429,8 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) { static const struct description_map well_known_descriptions[] = { { "analog-mono", N_("Analog Mono") }, + { "analog-mono-left", N_("Analog Mono (Left)") }, + { "analog-mono-right", N_("Analog Mono (Right)") }, { "analog-stereo", N_("Analog Stereo") }, { "mono-fallback", N_("Mono") }, { "stereo-fallback", N_("Stereo") }, @@ -4425,6 +4441,8 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) { * multichannel-input and multichannel-output. */ { "analog-stereo-input", N_("Analog Stereo") }, { "analog-stereo-output", N_("Analog Stereo") }, + { "analog-stereo-headset", N_("Headset") }, + { "analog-stereo-speakerphone", N_("Speakerphone") }, { "multichannel-input", N_("Multichannel") }, { "multichannel-output", N_("Multichannel") }, { "analog-surround-21", N_("Analog Surround 2.1") }, @@ -4581,6 +4599,8 @@ static int profile_verify(pa_alsa_profile *p) { static const struct description_map well_known_descriptions[] = { { "output:analog-mono+input:analog-mono", N_("Analog Mono Duplex") }, { "output:analog-stereo+input:analog-stereo", N_("Analog Stereo Duplex") }, + { "output:analog-stereo-headset+input:analog-stereo-headset", N_("Headset") }, + { "output:analog-stereo-speakerphone+input:analog-stereo-speakerphone", N_("Speakerphone") }, { "output:iec958-stereo+input:iec958-stereo", N_("Digital Stereo Duplex (IEC958)") }, { "output:multichannel-output+input:multichannel-input", N_("Multichannel Duplex") }, { "output:unknown-stereo+input:unknown-stereo", N_("Stereo Duplex") }, @@ -5159,6 +5179,8 @@ void pa_alsa_profile_set_probe( pa_hashmap_free(used_paths); pa_xfree(probe_order); + profile_set_set_availability_groups(ps); + ps->probed = true; } diff --git a/spa/plugins/alsa/acp/alsa-util.c b/spa/plugins/alsa/acp/alsa-util.c index 48f553e03..ab0b85035 100644 --- a/spa/plugins/alsa/acp/alsa-util.c +++ b/spa/plugins/alsa/acp/alsa-util.c @@ -1172,7 +1172,7 @@ snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa PA_ONCE_BEGIN { char *dn = pa_alsa_get_driver_name_by_pcm(pcm); - pa_log(ngettext("snd_pcm_avail() returned a value that is exceptionally large: %lu byte (%lu ms).\n" + pa_log_debug(ngettext("snd_pcm_avail() returned a value that is exceptionally large: %lu byte (%lu ms).\n" "Most likely this is a bug in the ALSA driver '%s'. Please report this issue to the ALSA developers.", "snd_pcm_avail() returned a value that is exceptionally large: %lu bytes (%lu ms).\n" "Most likely this is a bug in the ALSA driver '%s'. Please report this issue to the ALSA developers.", @@ -1181,7 +1181,7 @@ snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC), pa_strnull(dn)); pa_xfree(dn); - pa_alsa_dump(PA_LOG_ERROR, pcm); + pa_alsa_dump(PA_LOG_DEBUG, pcm); } PA_ONCE_END; /* Mhmm, let's try not to fail completely */ @@ -1238,7 +1238,7 @@ int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes PA_ONCE_BEGIN { char *dn = pa_alsa_get_driver_name_by_pcm(pcm); - pa_log(ngettext("snd_pcm_delay() returned a value that is exceptionally large: %li byte (%s%lu ms).\n" + pa_log_debug(ngettext("snd_pcm_delay() returned a value that is exceptionally large: %li byte (%s%lu ms).\n" "Most likely this is a bug in the ALSA driver '%s'. Please report this issue to the ALSA developers.", "snd_pcm_delay() returned a value that is exceptionally large: %li bytes (%s%lu ms).\n" "Most likely this is a bug in the ALSA driver '%s'. Please report this issue to the ALSA developers.", @@ -1248,7 +1248,7 @@ int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes (unsigned long) (pa_bytes_to_usec(abs_k, ss) / PA_USEC_PER_MSEC), pa_strnull(dn)); pa_xfree(dn); - pa_alsa_dump(PA_LOG_ERROR, pcm); + pa_alsa_dump(PA_LOG_DEBUG, pcm); } PA_ONCE_END; /* Mhmm, let's try not to fail completely */ @@ -1266,7 +1266,7 @@ int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes PA_ONCE_BEGIN { char *dn = pa_alsa_get_driver_name_by_pcm(pcm); - pa_log(ngettext("snd_pcm_avail() returned a value that is exceptionally large: %lu byte (%lu ms).\n" + pa_log_debug(ngettext("snd_pcm_avail() returned a value that is exceptionally large: %lu byte (%lu ms).\n" "Most likely this is a bug in the ALSA driver '%s'. Please report this issue to the ALSA developers.", "snd_pcm_avail() returned a value that is exceptionally large: %lu bytes (%lu ms).\n" "Most likely this is a bug in the ALSA driver '%s'. Please report this issue to the ALSA developers.", @@ -1275,7 +1275,7 @@ int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC), pa_strnull(dn)); pa_xfree(dn); - pa_alsa_dump(PA_LOG_ERROR, pcm); + pa_alsa_dump(PA_LOG_DEBUG, pcm); } PA_ONCE_END; /* Mhmm, let's try not to fail completely */ @@ -1328,7 +1328,7 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas k >= pa_bytes_per_second(ss)*10)) PA_ONCE_BEGIN { char *dn = pa_alsa_get_driver_name_by_pcm(pcm); - pa_log(ngettext("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu byte (%lu ms).\n" + pa_log_debug(ngettext("snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu byte (%lu ms).\n" "Most likely this is a bug in the ALSA driver '%s'. Please report this issue to the ALSA developers.", "snd_pcm_mmap_begin() returned a value that is exceptionally large: %lu bytes (%lu ms).\n" "Most likely this is a bug in the ALSA driver '%s'. Please report this issue to the ALSA developers.", @@ -1337,7 +1337,7 @@ int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas (unsigned long) (pa_bytes_to_usec(k, ss) / PA_USEC_PER_MSEC), pa_strnull(dn)); pa_xfree(dn); - pa_alsa_dump(PA_LOG_ERROR, pcm); + pa_alsa_dump(PA_LOG_DEBUG, pcm); } PA_ONCE_END; return r; diff --git a/spa/plugins/alsa/mixer/paths/analog-output-headphones.conf b/spa/plugins/alsa/mixer/paths/analog-output-headphones.conf index d4ad7777d..14fb81481 100644 --- a/spa/plugins/alsa/mixer/paths/analog-output-headphones.conf +++ b/spa/plugins/alsa/mixer/paths/analog-output-headphones.conf @@ -160,4 +160,8 @@ volume = off switch = off volume = off +[Element Speaker Center/LFE] +switch = off +volume = off + .include analog-output.conf.common diff --git a/spa/plugins/alsa/mixer/paths/analog-output-lineout.conf b/spa/plugins/alsa/mixer/paths/analog-output-lineout.conf index 9a6af3ad8..61df49965 100644 --- a/spa/plugins/alsa/mixer/paths/analog-output-lineout.conf +++ b/spa/plugins/alsa/mixer/paths/analog-output-lineout.conf @@ -181,6 +181,12 @@ volume = merge override-map.1 = all-center override-map.2 = all-center,lfe +[Element Center/LFE] +switch = mute +volume = merge +override-map.1 = all-center +override-map.2 = all-center,lfe + [Element Bass Speaker] switch = off volume = off diff --git a/spa/plugins/alsa/mixer/paths/analog-output-speaker-always.conf b/spa/plugins/alsa/mixer/paths/analog-output-speaker-always.conf index 71f356dce..bf781c671 100644 --- a/spa/plugins/alsa/mixer/paths/analog-output-speaker-always.conf +++ b/spa/plugins/alsa/mixer/paths/analog-output-speaker-always.conf @@ -174,4 +174,10 @@ volume = merge override-map.1 = all-center override-map.2 = all-center,lfe +[Element Center/LFE] +switch = mute +volume = merge +override-map.1 = all-center +override-map.2 = all-center,lfe + .include analog-output.conf.common diff --git a/spa/plugins/alsa/mixer/paths/analog-output-speaker.conf b/spa/plugins/alsa/mixer/paths/analog-output-speaker.conf index 27a3983d5..1610b9a05 100644 --- a/spa/plugins/alsa/mixer/paths/analog-output-speaker.conf +++ b/spa/plugins/alsa/mixer/paths/analog-output-speaker.conf @@ -220,6 +220,12 @@ volume = merge override-map.1 = all-center override-map.2 = all-center,lfe +[Element Center/LFE] +switch = mute +volume = merge +override-map.1 = all-center +override-map.2 = all-center,lfe + [Element Speaker CLFE] switch = mute volume = merge diff --git a/spa/plugins/alsa/mixer/paths/analog-output.conf b/spa/plugins/alsa/mixer/paths/analog-output.conf index e6ba98358..0f6b5f5a0 100644 --- a/spa/plugins/alsa/mixer/paths/analog-output.conf +++ b/spa/plugins/alsa/mixer/paths/analog-output.conf @@ -79,4 +79,10 @@ volume = merge override-map.1 = all-center override-map.2 = all-center,lfe +[Element Center/LFE] +switch = mute +volume = merge +override-map.1 = all-center +override-map.2 = all-center,lfe + .include analog-output.conf.common diff --git a/spa/plugins/alsa/mixer/profile-sets/behringer-umc22.conf b/spa/plugins/alsa/mixer/profile-sets/behringer-umc22.conf new file mode 100644 index 000000000..cc74852c3 --- /dev/null +++ b/spa/plugins/alsa/mixer/profile-sets/behringer-umc22.conf @@ -0,0 +1,68 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see . + +; Behringer U-Phoria UMC22 +; +; Default mapping only allows to use stereo input and sound card has two +; physical input channels. +; +; However in case of only using a single input channel (like condenser +; microphone) only one channel will have any sound, which is often +; inconvenient for casual use. +; +; This config includes mono input options which makes it much more +; friendly in single input configuration. +; +; This config also removes default digital input/output mappings that do +; not physically exist on this card. +; +; Added by Nazar Mokrynskyi + +[General] +auto-profiles = yes + +[Mapping analog-stereo-input] +device-strings = hw:%f +channel-map = left,right +paths-input = analog-input-mic +direction = input +priority = 4 + +[Mapping analog-mono] +device-strings = hw:%f +channel-map = mono,mono +paths-input = analog-input-mic +direction = input +priority = 3 + +[Mapping analog-mono-left] +device-strings = hw:%f +channel-map = mono,aux1 +paths-input = analog-input-mic +direction = input +priority = 2 + +[Mapping analog-mono-right] +device-strings = hw:%f +channel-map = aux1,mono +paths-input = analog-input-mic +direction = input +priority = 1 + +[Mapping analog-stereo-output] +device-strings = front:%f +channel-map = left,right +paths-output = analog-output +direction = output diff --git a/spa/plugins/alsa/mixer/profile-sets/default.conf b/spa/plugins/alsa/mixer/profile-sets/default.conf index c517d2b95..9b691fed4 100644 --- a/spa/plugins/alsa/mixer/profile-sets/default.conf +++ b/spa/plugins/alsa/mixer/profile-sets/default.conf @@ -44,7 +44,11 @@ ; [Mapping id] ; device-strings = ... # ALSA device string. %f will be replaced by the card identifier. ; channel-map = ... # Channel mapping to use for this device -; description = ... +; description = ... # Description for the mapping. Note that it's better to set the description +; # in the well_known_descriptions table in alsa-mixer.c than with this +; # option, because the descriptions in alsa-mixer.c are translatable. +; description-key = ... # A custom key for the well_known_descriptions table (by default the mapping +; # name is used). ; paths-input = ... # A list of mixer paths to use. Every path in this list will be probed. ; # If multiple are found to be working they will be available as device ports ; paths-output = ... @@ -464,7 +468,6 @@ exact-channels = false fallback = yes priority = 1 direction = output -paths-output = multichannel-output [Mapping multichannel-input] device-strings = hw:%f @@ -473,7 +476,6 @@ exact-channels = false fallback = yes priority = 1 direction = input -paths-input = multichannel-input ; An example for defining multiple-sink profiles #[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo] diff --git a/spa/plugins/alsa/mixer/profile-sets/hp-tbt-dock-120w-g2.conf b/spa/plugins/alsa/mixer/profile-sets/hp-tbt-dock-120w-g2.conf new file mode 100644 index 000000000..a683a4e4e --- /dev/null +++ b/spa/plugins/alsa/mixer/profile-sets/hp-tbt-dock-120w-g2.conf @@ -0,0 +1,35 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see . + +; HP Thunderbolt Dock 120W G2 +; +; This dock has a 3.5mm headset connector. Both input and output are stereo. +; +; There's a separate speakerphone module called "HP Thunderbolt Dock Audio +; Module", which can be attached to this dock. The module will appear in ALSA +; as a separate USB sound card, configuration for it is in +; hp-tbt-dock-audio-module.conf. + +[General] +auto-profiles = no + +[Mapping analog-stereo-headset] +device-strings = hw:%f,0,0 +channel-map = left,right + +[Profile output:analog-stereo-headset+input:analog-stereo-headset] +output-mappings = analog-stereo-headset +input-mappings = analog-stereo-headset +skip-probe = yes diff --git a/spa/plugins/alsa/mixer/profile-sets/hp-tbt-dock-audio-module.conf b/spa/plugins/alsa/mixer/profile-sets/hp-tbt-dock-audio-module.conf new file mode 100644 index 000000000..692ab8dd0 --- /dev/null +++ b/spa/plugins/alsa/mixer/profile-sets/hp-tbt-dock-audio-module.conf @@ -0,0 +1,36 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see . + +; HP Thunderbolt Dock Audio Module +; +; This device attaches to the "HP Thunderbolt Dock 120W G2" dock. The audio +; module provides a speakerphone with echo cancellation and appears in ALSA as +; a USB sound card with stereo input and output. +; +; The dock itself has a 3.5mm headset connector and appears as a separate USB +; sound card, configuration for it is in hp-tbt-dock-120w-g2.conf. + +[General] +auto-profiles = no + +[Mapping analog-stereo-speakerphone] +device-strings = hw:%f,0,0 +channel-map = left,right +intended-roles = phone + +[Profile output:analog-stereo-speakerphone+input:analog-stereo-speakerphone] +output-mappings = analog-stereo-speakerphone +input-mappings = analog-stereo-speakerphone +skip-probe = yes