From 920e1279d41be4736c76b5b2668cf8a465c1e78b Mon Sep 17 00:00:00 2001 From: Giovanni Fulco Date: Fri, 26 Jan 2024 12:06:18 +0100 Subject: [PATCH] [Feature] Assume PLAYBACK=custom when asound.conf is provided #90 (#91) --- README.md | 1 + bin/entrypoint.sh | 13 ++++++++++--- userconfig/topping-d10-softvol.asound.conf | 2 +- userconfig/topping-d10.asound.conf | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a4dd191..5f23999 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,7 @@ An already started tidal-connect container should start working immediately, at Date|Comment :---|:--- +2024-01-26|Assume `custom` playback device when asound.conf is provided, see [#90](https://github.com/GioF71/tidal-connect/issues/90) 2024-01-25|Support custom asound.conf, support forced PLAYBACK device, see [#80](https://github.com/GioF71/tidal-connect/issues/80) 2024-01-25|Revert latest change, see ([#78](https://github.com/GioF71/tidal-connect/issues/78)) 2024-01-24|Always create sysdefault in asound.conf and log device names, see [#76](https://github.com/GioF71/tidal-connect/issues/76) diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 3136a8e..351cd93 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo "Tidal Connect - https://github.com/GioF71/tidal-connect.git - entrypoint.sh version 0.1.0" +echo "Tidal Connect - https://github.com/GioF71/tidal-connect.git - entrypoint.sh version 0.1.1" ASOUND_CONF_SIMPLE_FILE=asound.conf ASOUND_CONF_FILE=/etc/$ASOUND_CONF_SIMPLE_FILE @@ -62,6 +62,8 @@ echo "CARD_NAME=$CARD_NAME" echo "CARD_INDEX=$CARD_INDEX" echo "CARD_DEVICE=$CARD_DEVICE" +PLAYBACK_DEVICE=default + ## see if there is a user-provided asound.conf file USER_CONFIG_DIR=/userconfig if [ -f "$USER_CONFIG_DIR/$ASOUND_CONF_SIMPLE_FILE" ]; then @@ -71,6 +73,13 @@ if [ -f "$USER_CONFIG_DIR/$ASOUND_CONF_SIMPLE_FILE" ]; then chmod -w $ASOUND_CONF_FILE ASOUND_CONF_EXISTS=1 ASOUND_CONF_WRITABLE=0 + # set PLAYBACK_DEVICE to [custom] if not set + if [[ -z "${FORCE_PLAYBACK_DEVICE}" ]]; then + echo "FORCE_PLAYBACK_DEVICE empty, setting to [custom]" + FORCE_PLAYBACK_DEVICE=custom + else + echo "FORCE_PLAYBACK_DEVICE is already set to [${FORCE_PLAYBACK_DEVICE}], leaving as-is" + fi else echo "File [$ASOUND_CONF_SIMPLE_FILE] has not been provided" if [ -f "$ASOUND_CONF_FILE" ]; then @@ -100,8 +109,6 @@ if [ $ASOUND_CONF_EXISTS -eq 1 ]; then cat $ASOUND_CONF_FILE fi -PLAYBACK_DEVICE=default - if [[ $ASOUND_CONF_EXISTS -eq 0 ]] || [[ $ASOUND_CONF_WRITABLE -eq 1 ]]; then if [[ -z "${card_index}" || "${card_index}" == "-1" ]] && [[ -n "${card_name}" ]]; then # card name is set diff --git a/userconfig/topping-d10-softvol.asound.conf b/userconfig/topping-d10-softvol.asound.conf index 8ff8bd5..e3999c9 100644 --- a/userconfig/topping-d10-softvol.asound.conf +++ b/userconfig/topping-d10-softvol.asound.conf @@ -8,7 +8,7 @@ pcm.tidal-d10 { } } -pcm.tidal-d10-softvol { +pcm.custom { type softvol slave { pcm "tidal-d10" diff --git a/userconfig/topping-d10.asound.conf b/userconfig/topping-d10.asound.conf index 504d88f..3d8d6bb 100644 --- a/userconfig/topping-d10.asound.conf +++ b/userconfig/topping-d10.asound.conf @@ -1,4 +1,4 @@ -pcm.tidal-d10 { +pcm.custom { type plug slave.pcm { type hw