unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Oleg Pykhalov <go.wigust@gmail.com>
Cc: 31297@debbugs.gnu.org
Subject: [bug#31297] [PATCH] gnu: Add sound service.
Date: Mon, 30 Apr 2018 22:55:31 +0200	[thread overview]
Message-ID: <87muxkv2gs.fsf@gnu.org> (raw)
In-Reply-To: <20180428103341.30675-1-go.wigust@gmail.com> (Oleg Pykhalov's message of "Sat, 28 Apr 2018 13:33:41 +0300")

Hello,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

> * gnu/services/sound.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add this.
> * doc/guix.texi (Sound Services): New chapter.

[...]

> +@node Sound Services
> +@subsubsection Sound Services
> +
> +The @code{(gnu services alsa)} module provides an
> +@code{alsa-service-type} service to generate an ALSA
> +@file{/etc/asound.conf} configuration file.

Is this file required to get PulseAudio support?  I realize I have
~/.asoundrc that’s similar to what this new service does, so it may be
that I simply forgot that things wouldn’t work well without it.

> +@deffn {Scheme Variable} alsa-service-type
> +This is the type for the @uref{https://alsa-project.org/, alsa},

s/alsa/ALSA/


> +(define-record-type* <alsa-configuration>
> +  alsa-configuration make-alsa-configuration alsa-configuration?
> +  (pulseaudio?   alsa-configuration-pulseaudio? ;boolean
> +                 (default #t))
> +  (extra-options alsa-configuration-extra-options ;string
> +                 (default #f)))

s/#f/""/ since it’s a string.

> +(define (alsa-config-file config)
> +  "Return the ALSA configuration file corresponding to CONFIG."
> +  (computed-file
> +   "asound.conf"
> +   #~(call-with-output-file #$output
> +       (lambda (port)
> +         (display "# Generated by 'alsa-service'.\n\n" port)
> +         (when #$(alsa-configuration-pulseaudio? config)
> +           (display "# Use PulseAudio by default
> +pcm.!default {
> +  type pulse
> +  fallback \"sysdefault\"
> +  hint {
> +    show on
> +    description \"Default ALSA Output (currently PulseAudio Sound Server)\"
> +  }
> +}
> +
> +ctl.!default {
> +  type pulse
> +  fallback \"sysdefault\"
> +}
> +"
> +                    port))
> +         (let ((extra-options #$(alsa-configuration-extra-options config)))
> +           (when extra-options (display extra-options port)))))))

I think you could instead write:

  (if (alsa-configuration-pulseaudio? config)
      (plain-file "asound.conf" (string-append "# Generated by…" extra-options))
      (plain-file "asound.conf" extra-options))

> +(define (alsa-activation config)
> +  "Return the activation GEXP for CONFIG."
> +  (with-imported-modules '((guix build utils))
> +    #~(begin
> +        (use-modules (guix build utils))
> +        (copy-file #$(alsa-config-file config) "/etc/asound.conf"))))

Please extend ‘etc-service-type’ instead.

> +(define alsa-service-type
> +  (service-type
> +   (name 'alsa)
> +   (extensions
> +    (list (service-extension activation-service-type alsa-activation)))
> +   (default-value (alsa-configuration))
> +   (description "Configure the alsa.")))

“Configure low-level Linux sound support, ALSA.”

Thanks,
Ludo’.

  reply	other threads:[~2018-04-30 20:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-28 10:33 [bug#31297] [PATCH] gnu: Add sound service Oleg Pykhalov
2018-04-30 20:55 ` Ludovic Courtès [this message]
2018-05-01  9:39   ` Oleg Pykhalov
2018-05-01 20:03     ` Ludovic Courtès
2018-05-01 20:04     ` Ludovic Courtès
2018-05-02 11:41       ` Marius Bakke
2018-05-02 12:15       ` Oleg Pykhalov
2018-05-03 20:32         ` Ludovic Courtès
2018-05-11  9:17           ` bug#31297: " Oleg Pykhalov

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muxkv2gs.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=31297@debbugs.gnu.org \
    --cc=go.wigust@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).