guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: services: alsa-service-type: Fix the loading of 'pulse' plugin.


From: ???
Subject: 01/03: services: alsa-service-type: Fix the loading of 'pulse' plugin.
Date: Mon, 25 Jun 2018 11:30:11 -0400 (EDT)

iyzsong pushed a commit to branch master
in repository guix.

commit 1e3861eb00a2e9531bc4326b37a31405e34cc0ff
Author: Oleg Pykhalov <address@hidden>
Date:   Sun Jun 24 13:18:53 2018 +0300

    services: alsa-service-type: Fix the loading of 'pulse' plugin.
    
    Fixes <https://bugs.gnu.org/31591>.
    
    * gnu/services/sound.scm (<alsa-configuration>)[alsa-plugins]: New field.
    (alsa-config-file): Use 'pcm_type.pulse' and 'ctl_type.pulse' to specify 
file
    paths to the 'pulse' plugin.
    * doc/guix.texi (Sound Services): Document this.
    
    Co-authored-by: 宋文武 <address@hidden>
---
 doc/guix.texi          |  3 +++
 gnu/services/sound.scm | 34 ++++++++++++++++++++++++----------
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 74c10e4..e5366ac 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13152,6 +13152,9 @@ See below for details about @code{alsa-configuration}.
 Data type representing the configuration for @code{alsa-service}.
 
 @table @asis
address@hidden @code{alsa-plugins} (default: @var{alsa-plugins})
address@hidden package to use.
+
 @item @code{pulseaudio?} (default: @var{#t})
 Whether ALSA applications should transparently be made to use the
 @uref{http://www.pulseaudio.org/, PulseAudio} sound server.
diff --git a/gnu/services/sound.scm b/gnu/services/sound.scm
index 5fe555e..f2dd244 100644
--- a/gnu/services/sound.scm
+++ b/gnu/services/sound.scm
@@ -26,6 +26,7 @@
   #:use-module (guix packages)
   #:use-module (guix records)
   #:use-module (guix store)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages pulseaudio)
   #:use-module (ice-9 match)
   #:export (alsa-configuration
@@ -44,17 +45,31 @@
 
 (define-record-type* <alsa-configuration>
   alsa-configuration make-alsa-configuration alsa-configuration?
+  (alsa-plugins alsa-configuration-alsa-plugins ;<package>
+                (default alsa-plugins))
   (pulseaudio?   alsa-configuration-pulseaudio? ;boolean
                  (default #t))
   (extra-options alsa-configuration-extra-options ;string
                  (default "")))
 
-(define (alsa-config-file config)
-  "Return the ALSA configuration file corresponding to CONFIG."
-  (plain-file "asound.conf"
-              (string-append "# Generated by 'alsa-service'.\n\n"
-                             (if (alsa-configuration-pulseaudio? config)
-                                 "# Use PulseAudio by default
+(define alsa-config-file
+  ;; Return the ALSA configuration file.
+  (match-lambda
+    (($ <alsa-configuration> alsa-plugins pulseaudio? extra-options)
+     (apply mixed-text-file "asound.conf"
+            `("# Generated by 'alsa-service'.\n\n"
+              ,@(if pulseaudio?
+                    `("# Use PulseAudio by default
+pcm_type.pulse {
+  lib \"" ,#~(string-append #$alsa-plugins:pulseaudio
+                            "/lib/alsa-lib/libasound_module_pcm_pulse.so") "\"
+}
+
+ctl_type.pulse {
+  lib \"" ,#~(string-append #$alsa-plugins:pulseaudio
+                            "/lib/alsa-lib/libasound_module_ctl_pulse.so") "\"
+}
+
 pcm.!default {
   type pulse
   fallback \"sysdefault\"
@@ -67,10 +82,9 @@ pcm.!default {
 ctl.!default {
   type pulse
   fallback \"sysdefault\"
-}
-"
-                                 "")
-                             (alsa-configuration-extra-options config))))
+}\n\n")
+                    '())
+              ,extra-options)))))
 
 (define (alsa-etc-service config)
   (list `("asound.conf" ,(alsa-config-file config))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]