Skip to content

Commit

Permalink
[Feature] Assume PLAYBACK=custom when asound.conf is provided #90 (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
GioF71 authored Jan 26, 2024
1 parent 384e210 commit 920e127
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 10 additions & 3 deletions bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion userconfig/topping-d10-softvol.asound.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pcm.tidal-d10 {
}
}

pcm.tidal-d10-softvol {
pcm.custom {
type softvol
slave {
pcm "tidal-d10"
Expand Down
2 changes: 1 addition & 1 deletion userconfig/topping-d10.asound.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pcm.tidal-d10 {
pcm.custom {
type plug
slave.pcm {
type hw
Expand Down

0 comments on commit 920e127

Please sign in to comment.