From: Oleg Pykhalov <go.wigust@gmail.com>
To: 宋文武 <iyzsong@member.fsf.org>
Cc: 31934@debbugs.gnu.org
Subject: [bug#31934] [PATCH] services: sound: Properly handle alsa-plugins.
Date: Sun, 24 Jun 2018 13:44:54 +0300 [thread overview]
Message-ID: <87h8lso449.fsf_-_@gmail.com> (raw)
In-Reply-To: <87a7rkhdg2.fsf@member.fsf.org> ("宋文武"'s message of "Sun, 24 Jun 2018 15:05:17 +0800")
[-- Attachment #1.1: Type: text/plain, Size: 547 bytes --]
Hello,
iyzsong@member.fsf.org (宋文武) writes:
> Julien Lepiller <julien@lepiller.eu> writes:
[…]
> Hello, after some hours of searching... I found that we can use the
> 'lib' option in 'pcm_type' and 'ctl_type' to specify the library path
> for alsa plugins, e.g:
Thats a nice hack :-) Thank you for working on this.
[…]
> So I think we can make our 'alsa-service' do this, instead of patching
> alsa-lib for 'ALSA_PLUGIN_DIR'.
Done. Here is a patch which I tested on my machine by ‘system reconfigure’:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: services: sound: Properly handle alsa-plugins. --]
[-- Type: text/x-patch, Size: 3369 bytes --]
From 22186e76d991a47e7057d1abe23af02b52f8153b Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Sun, 24 Jun 2018 13:18:53 +0300
Subject: [PATCH] services: sound: Properly handle alsa-plugins.
* gnu/services/sound.scm (<alsa-configuration>)[alsa-plugins]: New field.
(alsa-config-file): Add this.
* doc/guix.texi (Sound Services): Document this.
---
doc/guix.texi | 3 +++
gnu/services/sound.scm | 31 +++++++++++++++++++++++--------
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 74c10e4bb..e5366ac6b 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
+@item @code{alsa-plugins} (default: @var{alsa-plugins})
+@code{alsa-plugins} 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 5fe555e8b..2b2cabd7b 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)
+ (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\"
@@ -69,8 +84,8 @@ ctl.!default {
fallback \"sysdefault\"
}
"
- "")
- (alsa-configuration-extra-options config))))
+ ""
+ extra-options))))
(define (alsa-etc-service config)
(list `("asound.conf" ,(alsa-config-file config))))
--
2.17.1
[-- Attachment #1.3: Type: text/plain, Size: 27 bytes --]
[…]
Thanks,
Oleg.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2018-06-24 10:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-22 12:39 [bug#31934] [PATCH] Fix ALSA_PLUGIN_DIR usage Julien Lepiller
2018-06-22 19:54 ` Ludovic Courtès
2018-06-22 20:22 ` Julien Lepiller
2018-06-23 21:54 ` Ludovic Courtès
2018-06-24 7:05 ` 宋文武
2018-06-24 10:44 ` Oleg Pykhalov [this message]
2018-06-25 15:34 ` bug#31591: [bug#31934] [PATCH] services: sound: Properly handle alsa-plugins 宋文武
2018-06-25 15:34 ` 宋文武
2018-06-25 15:37 ` Julien Lepiller
2018-06-26 11:38 ` 宋文武
2018-06-26 11:49 ` Marius Bakke
2018-06-26 12:34 ` bug#31934: " 宋文武
2018-06-26 12:59 ` [bug#31934] " Marius Bakke
2018-06-26 14:02 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h8lso449.fsf_-_@gmail.com \
--to=go.wigust@gmail.com \
--cc=31934@debbugs.gnu.org \
--cc=iyzsong@member.fsf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.