[-- Attachment #1: Type: text/plain, Size: 754 bytes --] There is a new pull request by ericonr against master on the void-packages repository https://github.com/ericonr/void-packages sndio https://github.com/void-linux/void-packages/pull/23838 Use sndio as first preference in PortAudio, enable PortAudio for spotifyd If sndio isn't available, spotifyd, using the portaudio backend, falls back to ALSA cleanly. However, in the previous version, with sndio enabled, the portaudio backend simply didn't output anything. Therefore, I believe my change to the patch makes sense. Enabling portaudio for spotifyd makes sense because it allows one to use sndio without requiring alsa-sndio. @Johnnynator and @abenson A patch file from https://github.com/void-linux/void-packages/pull/23838.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-sndio-23838.patch --] [-- Type: text/x-diff, Size: 5520 bytes --] From 7202e94a530e07dfe0c7e6989e8e40e348da556e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com> Date: Sat, 25 Jul 2020 22:50:30 -0300 Subject: [PATCH 1/2] portaudio: try sndio as first audio device, adopt. It falls back gracefully into the backends other than sndio, but otherwise might not work with sndio even if a sndio device is available. This commit fixes that behavior. --- srcpkgs/portaudio/patches/sndio.patch | 23 +++++++++++++---------- srcpkgs/portaudio/template | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/srcpkgs/portaudio/patches/sndio.patch b/srcpkgs/portaudio/patches/sndio.patch index 764916496e5..3ab0a9e4c5e 100644 --- a/srcpkgs/portaudio/patches/sndio.patch +++ b/srcpkgs/portaudio/patches/sndio.patch @@ -20,7 +20,7 @@ index 5e1a764..2747f73 100644 src/hostapi/wdmks \ src/hostapi/wmme \ diff --git configure.in configure.in -index 13816fb..4c06d10 100644 +index 83c239a..db11d65 100644 --- configure.in +++ configure.in @@ -24,6 +24,10 @@ AC_ARG_WITH(alsa, @@ -59,7 +59,7 @@ index 13816fb..4c06d10 100644 if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then DLL_LIBS="$DLL_LIBS $JACK_LIBS" CFLAGS="$CFLAGS $JACK_CFLAGS" -@@ -509,6 +524,7 @@ case "$target_os" in +@@ -510,6 +525,7 @@ case "$target_os" in ;; *) AC_MSG_RESULT([ @@ -68,7 +68,7 @@ index 13816fb..4c06d10 100644 JACK ........................ $have_jack ]) diff --git include/portaudio.h include/portaudio.h -index 8a94aaf..f94d9c4 100644 +index 9c8a295..e535a02 100644 --- include/portaudio.h +++ include/portaudio.h @@ -287,7 +287,8 @@ typedef enum PaHostApiTypeId @@ -853,7 +853,7 @@ index 0000000..725ef47 + return paNoError; +} diff --git src/os/unix/pa_unix_hostapis.c src/os/unix/pa_unix_hostapis.c -index a9b4a05..c3fa2a3 100644 +index a9b4a05..f10ced1 100644 --- src/os/unix/pa_unix_hostapis.c +++ src/os/unix/pa_unix_hostapis.c @@ -44,6 +44,7 @@ @@ -864,14 +864,17 @@ index a9b4a05..c3fa2a3 100644 PaError PaOSS_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); /* Added for IRIX, Pieter, oct 2, 2003: */ PaError PaSGI_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); -@@ -79,6 +80,10 @@ PaUtilHostApiInitializer *paHostApiInitializers[] = - - #endif /* __linux__ */ +@@ -57,6 +58,10 @@ PaError PaSkeleton_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiI + PaUtilHostApiInitializer *paHostApiInitializers[] = + { +#ifdef PA_USE_SNDIO + PaSndio_Initialize, +#endif + - #if PA_USE_JACK - PaJack_Initialize, - #endif + #ifdef __linux__ + + #if PA_USE_ALSA +-- +2.27.0 + diff --git a/srcpkgs/portaudio/template b/srcpkgs/portaudio/template index f53a2be340a..572be816257 100644 --- a/srcpkgs/portaudio/template +++ b/srcpkgs/portaudio/template @@ -1,14 +1,14 @@ # Template file for 'portaudio' pkgname=portaudio version=190600.20161030 -revision=4 +revision=5 wrksrc=portaudio build_style=gnu-configure configure_args="--enable-cxx --with-jack $(vopt_enable sndio)" hostmakedepends="automake libtool pkg-config" makedepends="alsa-lib-devel jack-devel $(vopt_if sndio sndio-devel)" short_desc="Portable cross-platform audio I/O library" -maintainer="Orphaned <orphan@voidlinux.org>" +maintainer="Érico Nogueira <ericonr@disroot.org>" license="MIT" homepage="http://www.portaudio.com" distfiles="http://www.${pkgname}.com/archives/pa_stable_v${version%.*}_${version#*.}.tgz" From 5f06da8cc3e9ed32f216162f932dba78e74279e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com> Date: Sat, 25 Jul 2020 22:55:31 -0300 Subject: [PATCH 2/2] spotifyd: add portaudio build option. This option is on by default. --- srcpkgs/spotifyd/template | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/srcpkgs/spotifyd/template b/srcpkgs/spotifyd/template index 3d9c98f51cd..00b16675698 100644 --- a/srcpkgs/spotifyd/template +++ b/srcpkgs/spotifyd/template @@ -1,12 +1,13 @@ # Template file for 'spotifyd' pkgname=spotifyd version=0.2.24 -revision=3 +revision=4 build_style=cargo configure_args="--no-default-features" hostmakedepends="pkg-config" makedepends="libressl-devel $(vopt_if alsa alsa-lib-devel) -$(vopt_if pulseaudio pulseaudio-devel) $(vopt_if dbus dbus-devel)" + $(vopt_if pulseaudio pulseaudio-devel) $(vopt_if portaudio portaudio-devel) + $(vopt_if dbus dbus-devel)" short_desc="Spotify client running as a UNIX daemon" maintainer="Andrew Benson <abenson+void@gmail.com>" license="GPL-3.0-or-later" @@ -14,8 +15,9 @@ homepage="https://github.com/Spotifyd/spotifyd" distfiles="${homepage}/archive/v${version}.tar.gz" checksum=d3763f4647217a8f98ee938b50e141d67a5f3d33e9378894fde2a92c9845ef80 -build_options="alsa pulseaudio dbus" -build_options_default="alsa pulseaudio dbus" +build_options="alsa pulseaudio portaudio dbus" +desc_option_portaudio="Enable PortAudio backend" +build_options_default="alsa pulseaudio portaudio dbus" export CFLAGS_${RUST_BUILD//-/_}="${CFLAGS_host}" export CC_${RUST_BUILD//-/_}="${BUILD_CC}" @@ -23,6 +25,7 @@ export CC_${RUST_BUILD//-/_}="${BUILD_CC}" _features="$(vopt_if alsa ',alsa_backend')" _features+="$(vopt_if pulseaudio ',pulseaudio_backend')" _features+="$(vopt_if dbus ',dbus_mpris,dbus_keyring')" +_features+="$(vopt_if portaudio ',portaudio_backend')" if [ "$_features" ]; then configure_args+=" --features $_features"
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --] New comment by Johnnynator on void-packages repository https://github.com/void-linux/void-packages/pull/23838#issuecomment-663984647 Comment: with this portaudio patch audio does not work on non sndio systems ``` PortAudio Test: output sine wave. SR = 44100, BufSize = 64 ALSA lib pcm_dsnoop.c:642:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm_dmix.c:1090:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_dmix.c:1090:(snd_pcm_dmix_open) unable to open slave Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock couldn't open play stream: No such file or directory An error occured while using the portaudio stream Error number: -9999 Error message: Unanticipated host error ``` It seems the portaudio patches does not really test if sndio exists, only when creating a stream. Currently investigating how the fallback stuff in portaudio is supposed to work.
[-- Attachment #1: Type: text/plain, Size: 482 bytes --] New comment by ericonr on void-packages repository https://github.com/void-linux/void-packages/pull/23838#issuecomment-664020537 Comment: I get nearly the same error messages, but it seems to fallback to ALSA. I tested spotifyd with _only_ the portaudio backend, and if I disable the `sndiod` service, it occupies the ALSA device. I get most of those error messages in both cases, though. And also a weird looking one when exiting: `stream drop error: PortAudio not initialized`.
[-- Attachment #1: Type: text/plain, Size: 759 bytes --] There is an updated pull request by ericonr against master on the void-packages repository https://github.com/ericonr/void-packages sndio https://github.com/void-linux/void-packages/pull/23838 Use sndio as first preference in PortAudio, enable PortAudio for spotifyd If sndio isn't available, spotifyd, using the portaudio backend, falls back to ALSA cleanly. However, in the previous version, with sndio enabled, the portaudio backend simply didn't output anything. Therefore, I believe my change to the patch makes sense. Enabling portaudio for spotifyd makes sense because it allows one to use sndio without requiring alsa-sndio. @Johnnynator and @abenson A patch file from https://github.com/void-linux/void-packages/pull/23838.patch is attached [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: github-pr-sndio-23838.patch --] [-- Type: text/x-diff, Size: 6058 bytes --] From 38e79794d3053aa553bb2c7ef166ab1d96b78d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com> Date: Sat, 25 Jul 2020 22:50:30 -0300 Subject: [PATCH 1/2] portaudio: try sndio as first audio device, adopt. The changes to sndio.patch were: - Put the sndio backend as the first one that PortAudio tries to connect; - Add return for cases when sndio isn't available so PortAudio can fallback to other systems. --- srcpkgs/portaudio/patches/sndio.patch | 28 ++++++++++++++++----------- srcpkgs/portaudio/template | 4 ++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/srcpkgs/portaudio/patches/sndio.patch b/srcpkgs/portaudio/patches/sndio.patch index 764916496e5..7e43e3fcedd 100644 --- a/srcpkgs/portaudio/patches/sndio.patch +++ b/srcpkgs/portaudio/patches/sndio.patch @@ -20,7 +20,7 @@ index 5e1a764..2747f73 100644 src/hostapi/wdmks \ src/hostapi/wmme \ diff --git configure.in configure.in -index 13816fb..4c06d10 100644 +index 83c239a..db11d65 100644 --- configure.in +++ configure.in @@ -24,6 +24,10 @@ AC_ARG_WITH(alsa, @@ -59,7 +59,7 @@ index 13816fb..4c06d10 100644 if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then DLL_LIBS="$DLL_LIBS $JACK_LIBS" CFLAGS="$CFLAGS $JACK_CFLAGS" -@@ -509,6 +524,7 @@ case "$target_os" in +@@ -510,6 +525,7 @@ case "$target_os" in ;; *) AC_MSG_RESULT([ @@ -68,7 +68,7 @@ index 13816fb..4c06d10 100644 JACK ........................ $have_jack ]) diff --git include/portaudio.h include/portaudio.h -index 8a94aaf..f94d9c4 100644 +index 9c8a295..e535a02 100644 --- include/portaudio.h +++ include/portaudio.h @@ -287,7 +287,8 @@ typedef enum PaHostApiTypeId @@ -86,7 +86,7 @@ new file mode 100644 index 0000000..725ef47 --- /dev/null +++ src/hostapi/sndio/pa_sndio.c -@@ -0,0 +1,765 @@ +@@ -0,0 +1,768 @@ +/* + * Copyright (c) 2009 Alexandre Ratchov <alex@caoua.org> + * @@ -775,6 +775,9 @@ index 0000000..725ef47 + + DPR("PaSndio_Initialize: initializing...\n"); + ++ if ((hdl=sio_open(SIO_DEVANY, SIO_PLAY, 1)) == NULL) ++ return paNoError; ++ sio_close(hdl); + /* unusable APIs should return paNoError and a NULL hostApi */ + *hostApi = NULL; + @@ -853,7 +856,7 @@ index 0000000..725ef47 + return paNoError; +} diff --git src/os/unix/pa_unix_hostapis.c src/os/unix/pa_unix_hostapis.c -index a9b4a05..c3fa2a3 100644 +index a9b4a05..f10ced1 100644 --- src/os/unix/pa_unix_hostapis.c +++ src/os/unix/pa_unix_hostapis.c @@ -44,6 +44,7 @@ @@ -864,14 +867,17 @@ index a9b4a05..c3fa2a3 100644 PaError PaOSS_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); /* Added for IRIX, Pieter, oct 2, 2003: */ PaError PaSGI_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); -@@ -79,6 +80,10 @@ PaUtilHostApiInitializer *paHostApiInitializers[] = - - #endif /* __linux__ */ +@@ -57,6 +58,10 @@ PaError PaSkeleton_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiI + PaUtilHostApiInitializer *paHostApiInitializers[] = + { +#ifdef PA_USE_SNDIO + PaSndio_Initialize, +#endif + - #if PA_USE_JACK - PaJack_Initialize, - #endif + #ifdef __linux__ + + #if PA_USE_ALSA +-- +2.27.0 + diff --git a/srcpkgs/portaudio/template b/srcpkgs/portaudio/template index f53a2be340a..572be816257 100644 --- a/srcpkgs/portaudio/template +++ b/srcpkgs/portaudio/template @@ -1,14 +1,14 @@ # Template file for 'portaudio' pkgname=portaudio version=190600.20161030 -revision=4 +revision=5 wrksrc=portaudio build_style=gnu-configure configure_args="--enable-cxx --with-jack $(vopt_enable sndio)" hostmakedepends="automake libtool pkg-config" makedepends="alsa-lib-devel jack-devel $(vopt_if sndio sndio-devel)" short_desc="Portable cross-platform audio I/O library" -maintainer="Orphaned <orphan@voidlinux.org>" +maintainer="Érico Nogueira <ericonr@disroot.org>" license="MIT" homepage="http://www.portaudio.com" distfiles="http://www.${pkgname}.com/archives/pa_stable_v${version%.*}_${version#*.}.tgz" From 8fae61844566610e00d4883e11b023c63b52d643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com> Date: Sat, 25 Jul 2020 22:55:31 -0300 Subject: [PATCH 2/2] spotifyd: add portaudio build option. This option is on by default. --- srcpkgs/spotifyd/template | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/srcpkgs/spotifyd/template b/srcpkgs/spotifyd/template index 3d9c98f51cd..00b16675698 100644 --- a/srcpkgs/spotifyd/template +++ b/srcpkgs/spotifyd/template @@ -1,12 +1,13 @@ # Template file for 'spotifyd' pkgname=spotifyd version=0.2.24 -revision=3 +revision=4 build_style=cargo configure_args="--no-default-features" hostmakedepends="pkg-config" makedepends="libressl-devel $(vopt_if alsa alsa-lib-devel) -$(vopt_if pulseaudio pulseaudio-devel) $(vopt_if dbus dbus-devel)" + $(vopt_if pulseaudio pulseaudio-devel) $(vopt_if portaudio portaudio-devel) + $(vopt_if dbus dbus-devel)" short_desc="Spotify client running as a UNIX daemon" maintainer="Andrew Benson <abenson+void@gmail.com>" license="GPL-3.0-or-later" @@ -14,8 +15,9 @@ homepage="https://github.com/Spotifyd/spotifyd" distfiles="${homepage}/archive/v${version}.tar.gz" checksum=d3763f4647217a8f98ee938b50e141d67a5f3d33e9378894fde2a92c9845ef80 -build_options="alsa pulseaudio dbus" -build_options_default="alsa pulseaudio dbus" +build_options="alsa pulseaudio portaudio dbus" +desc_option_portaudio="Enable PortAudio backend" +build_options_default="alsa pulseaudio portaudio dbus" export CFLAGS_${RUST_BUILD//-/_}="${CFLAGS_host}" export CC_${RUST_BUILD//-/_}="${BUILD_CC}" @@ -23,6 +25,7 @@ export CC_${RUST_BUILD//-/_}="${BUILD_CC}" _features="$(vopt_if alsa ',alsa_backend')" _features+="$(vopt_if pulseaudio ',pulseaudio_backend')" _features+="$(vopt_if dbus ',dbus_mpris,dbus_keyring')" +_features+="$(vopt_if portaudio ',portaudio_backend')" if [ "$_features" ]; then configure_args+=" --features $_features"
[-- Attachment #1: Type: text/plain, Size: 605 bytes --] There's a merged pull request on the void-packages repository Use sndio as first preference in PortAudio, enable PortAudio for spotifyd https://github.com/void-linux/void-packages/pull/23838 Description: If sndio isn't available, spotifyd, using the portaudio backend, falls back to ALSA cleanly. However, in the previous version, with sndio enabled, the portaudio backend simply didn't output anything. Therefore, I believe my change to the patch makes sense. Enabling portaudio for spotifyd makes sense because it allows one to use sndio without requiring alsa-sndio. @Johnnynator and @abenson