[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] 4 commits: alsa-mixer: Fix well-known descriptions for steelseries game/chat outputs

Tanu Kaskinen gitlab at gitlab.freedesktop.org
Sun Jul 26 04:43:52 UTC 2020



Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio


Commits:
680d7bb9 by Tomasz Kontusz at 2020-07-26T04:39:40+00:00
alsa-mixer: Fix well-known descriptions for steelseries game/chat outputs

- - - - -
9696e107 by Tomasz Kontusz at 2020-07-26T04:39:40+00:00
alsa-mixer: Remove unused iec958-passthrough* descriptions

They were unused since 20f1fa17bebe086cb9cff09a5157dc7ca009ba61.

- - - - -
8482b62b by Tomasz Kontusz at 2020-07-26T04:39:40+00:00
alsa-mixer: add description-key to Mappings and Profiles

- - - - -
47d81122 by Tomasz Kontusz at 2020-07-26T04:39:40+00:00
alsa-mixer: add support for Astro A50 gaming headset

- - - - -


5 changed files:

- src/modules/alsa/90-pulseaudio.rules
- src/modules/alsa/alsa-mixer.c
- src/modules/alsa/alsa-mixer.h
- src/modules/alsa/mixer/profile-sets/steelseries-arctis-common-usb-audio.conf
- src/modules/alsa/mixer/profile-sets/usb-gaming-headset.conf


Changes:

=====================================
src/modules/alsa/90-pulseaudio.rules
=====================================
@@ -119,6 +119,8 @@ ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1294", ENV{PULSE_PROFILE_SET}="usb-g
 ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1730", ENV{PULSE_PROFILE_SET}="usb-gaming-headset.conf"
 # Lucidsound LS31
 ATTRS{idVendor}=="2f12", ATTRS{idProduct}=="0109", ENV{PULSE_PROFILE_SET}="usb-gaming-headset.conf"
+# ID 9886:002c is for the Astro A50 Gen4
+ATTRS{idVendor}=="9886", ATTRS{idProduct}=="002c", ENV{PULSE_PROFILE_SET}="usb-gaming-headset.conf"
 
 # ID 1038:1250 is for the Arctis 5
 # ID 1037:12aa is for the Arctis 5 2019


=====================================
src/modules/alsa/alsa-mixer.c
=====================================
@@ -2725,11 +2725,10 @@ static int path_verify(pa_alsa_path *p) {
         { "hdmi-output",                      N_("HDMI / DisplayPort"),           PA_DEVICE_PORT_TYPE_HDMI },
         { "iec958-stereo-output",             N_("Digital Output (S/PDIF)"),      PA_DEVICE_PORT_TYPE_SPDIF },
         { "iec958-stereo-input",              N_("Digital Input (S/PDIF)"),       PA_DEVICE_PORT_TYPE_SPDIF },
-        { "iec958-passthrough-output",        N_("Digital Passthrough (S/PDIF)"), PA_DEVICE_PORT_TYPE_SPDIF },
         { "multichannel-input",               N_("Multichannel Input"),           PA_DEVICE_PORT_TYPE_LINE },
         { "multichannel-output",              N_("Multichannel Output"),          PA_DEVICE_PORT_TYPE_LINE },
-        { "steelseries-arctis-5-output-game", N_("Game Output"),                  PA_DEVICE_PORT_TYPE_HEADSET },
-        { "steelseries-arctis-5-output-chat", N_("Chat Output"),                  PA_DEVICE_PORT_TYPE_HEADSET },
+        { "steelseries-arctis-output-game-common", N_("Game Output"),             PA_DEVICE_PORT_TYPE_HEADSET },
+        { "steelseries-arctis-output-chat-common", N_("Chat Output"),             PA_DEVICE_PORT_TYPE_HEADSET },
     };
 
     pa_alsa_element *e;
@@ -3715,6 +3714,7 @@ static void mapping_free(pa_alsa_mapping *m) {
 
     pa_xfree(m->name);
     pa_xfree(m->description);
+    pa_xfree(m->description_key);
 
     pa_proplist_free(m->proplist);
 
@@ -3741,6 +3741,7 @@ static void profile_free(pa_alsa_profile *p) {
 
     pa_xfree(p->name);
     pa_xfree(p->description);
+    pa_xfree(p->description_key);
     pa_xfree(p->input_name);
     pa_xfree(p->output_name);
 
@@ -4015,6 +4016,30 @@ static int mapping_parse_description(pa_config_parser_state *state) {
     return 0;
 }
 
+static int mapping_parse_description_key(pa_config_parser_state *state) {
+    pa_alsa_profile_set *ps;
+    pa_alsa_profile *p;
+    pa_alsa_mapping *m;
+
+    pa_assert(state);
+
+    ps = state->userdata;
+
+    if ((m = pa_alsa_mapping_get(ps, state->section))) {
+        pa_xfree(m->description_key);
+        m->description_key = pa_xstrdup(state->rvalue);
+    } else if ((p = profile_get(ps, state->section))) {
+        pa_xfree(p->description_key);
+        p->description_key = pa_xstrdup(state->rvalue);
+    } else {
+        pa_log("[%s:%u] Section name %s invalid.", state->filename, state->lineno, state->section);
+        return -1;
+    }
+
+    return 0;
+}
+
+
 static int mapping_parse_priority(pa_config_parser_state *state) {
     pa_alsa_profile_set *ps;
     pa_alsa_profile *p;
@@ -4377,13 +4402,15 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
         { "analog-surround-70",     N_("Analog Surround 7.0") },
         { "analog-surround-71",     N_("Analog Surround 7.1") },
         { "iec958-stereo",          N_("Digital Stereo (IEC958)") },
-        { "iec958-passthrough",     N_("Digital Passthrough (IEC958)") },
         { "iec958-ac3-surround-40", N_("Digital Surround 4.0 (IEC958/AC3)") },
         { "iec958-ac3-surround-51", N_("Digital Surround 5.1 (IEC958/AC3)") },
         { "iec958-dts-surround-51", N_("Digital Surround 5.1 (IEC958/DTS)") },
         { "hdmi-stereo",            N_("Digital Stereo (HDMI)") },
         { "hdmi-surround-51",       N_("Digital Surround 5.1 (HDMI)") },
+        { "gaming-headset-chat",    N_("Chat") },
+        { "gaming-headset-game",    N_("Game") },
     };
+    const char *description_key = m->description_key ? m->description_key : m->name;
 
     pa_assert(m);
 
@@ -4404,7 +4431,7 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
     }
 
     if (!m->description)
-        m->description = pa_xstrdup(lookup_description(m->name,
+        m->description = pa_xstrdup(lookup_description(description_key,
                                                        well_known_descriptions,
                                                        PA_ELEMENTSOF(well_known_descriptions)));
 
@@ -4522,6 +4549,7 @@ static int profile_verify(pa_alsa_profile *p) {
         { "output:unknown-stereo+input:unknown-stereo", N_("Stereo Duplex") },
         { "off",                                      N_("Off") }
     };
+    const char *description_key = p->description_key ? p->description_key : p->name;
 
     pa_assert(p);
 
@@ -4603,7 +4631,7 @@ static int profile_verify(pa_alsa_profile *p) {
     }
 
     if (!p->description)
-        p->description = pa_xstrdup(lookup_description(p->name,
+        p->description = pa_xstrdup(lookup_description(description_key,
                                                        well_known_descriptions,
                                                        PA_ELEMENTSOF(well_known_descriptions)));
 
@@ -4727,6 +4755,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel
 
         /* Shared by [Mapping ...] and [Profile ...] */
         { "description",            mapping_parse_description,    NULL, NULL },
+        { "description-key",        mapping_parse_description_key,NULL, NULL },
         { "priority",               mapping_parse_priority,       NULL, NULL },
         { "fallback",               mapping_parse_fallback,       NULL, NULL },
 


=====================================
src/modules/alsa/alsa-mixer.h
=====================================
@@ -281,6 +281,7 @@ struct pa_alsa_mapping {
 
     char *name;
     char *description;
+    char *description_key;
     unsigned priority;
     pa_alsa_direction_t direction;
     /* These are copied over to the resultant sink/source */
@@ -322,6 +323,7 @@ struct pa_alsa_profile {
 
     char *name;
     char *description;
+    char *description_key;
     unsigned priority;
 
     char *input_name;


=====================================
src/modules/alsa/mixer/profile-sets/steelseries-arctis-common-usb-audio.conf
=====================================
@@ -2,7 +2,7 @@
 auto-profiles = yes
 
 [Mapping analog-chat]
-description = Chat
+description-key = gaming-headset-chat
 device-strings = hw:%f,0,0
 channel-map = left,right
 paths-input = analog-input-mic
@@ -10,7 +10,7 @@ paths-output = steelseries-arctis-output-chat-common
 intended-roles = phone
 
 [Mapping analog-game]
-description = Game
+description-key = gaming-headset-game
 device-strings = hw:%f,1,0
 channel-map = left,right
 paths-output = steelseries-arctis-output-game-common


=====================================
src/modules/alsa/mixer/profile-sets/usb-gaming-headset.conf
=====================================
@@ -14,36 +14,51 @@
 # along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
 
 ; USB gaming headset.
-; These headsets usually have two output devices. The first one is mono,
-; meant for voice audio, and the second one is stereo, meant for everything
-; else. The purpose of this unusual design is to provide separate volume
+; These headsets usually have two output devices. The first one is meant
+; for voice audio, and the second one is meant for everything else.
+; The purpose of this unusual design is to provide separate volume
 ; controls for voice and other audio, which can be useful in gaming.
 ;
 ; Works with:
 ; Steelseries Arctis 7
 ; Steelseries Arctis Pro Wireless.
 ; Lucidsound LS31
+; Astro A50
 ;
 ; See default.conf for an explanation on the directives used here.
 
 [General]
 auto-profiles = yes
 
-[Mapping analog-mono]
+[Mapping mono-chat]
+description-key = gaming-headset-chat
 device-strings = hw:%f,0,0
 channel-map = mono
 paths-output = usb-gaming-headset-output-mono
 paths-input = usb-gaming-headset-input
 intended-roles = phone
 
-[Mapping analog-stereo]
+[Mapping stereo-chat]
+description-key = gaming-headset-chat
+device-strings = hw:%f,0,0
+channel-map = left,right
+paths-output = usb-gaming-headset-output-stereo
+paths-input = usb-gaming-headset-input
+intended-roles = phone
+
+[Mapping stereo-game]
+description-key = gaming-headset-game
 device-strings = hw:%f,1,0
 channel-map = left,right
 paths-output = usb-gaming-headset-output-stereo
 direction = output
 
-[Profile output:analog-mono+output:analog-stereo+input:analog-mono]
-output-mappings = analog-mono analog-stereo
-input-mappings = analog-mono
+[Profile output:mono-chat+output:stereo-game+input:mono-chat]
+output-mappings = mono-chat stereo-game
+input-mappings = mono-chat
+priority = 5100
+
+[Profile output:stereo-game+output:stereo-chat+input:mono-chat]
+output-mappings = stereo-game stereo-chat
+input-mappings = mono-chat
 priority = 5100
-skip-probe = yes



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/compare/414644dff1abd32294db3be1fde001f56ec9e65a...47d811224dc70ab2f04b3714cbc36ae3f3650b0a

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/compare/414644dff1abd32294db3be1fde001f56ec9e65a...47d811224dc70ab2f04b3714cbc36ae3f3650b0a
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20200726/612e277b/attachment-0001.htm>


More information about the pulseaudio-commits mailing list