distribution/packages/jelos/autostart/005-audio

44 lines
999 B
Text
Raw Normal View History

#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
# Minimal OS variable loading for performance
. /etc/profile.d/02-distribution
. /storage/.config/profile.d/001-deviceconfig
2023-08-07 11:12:57 +00:00
tocon "Configuring Audio..."
STATE=$(systemctl isactive pipewire-pulse)
if [ "${STATE}" = "inactive" ]
then
systemctl start pipewire-pulse
fi
### Auto switch between internal and bluetooth devices
pactl load-module module-switch-on-connect
### Set up audio routing (Internal or HDMI)
/usr/bin/hdmi_sense
2023-08-08 15:59:42 +00:00
2023-08-07 12:02:33 +00:00
### Set the default audio path, needed for some devices
if [ ! -z "${DEVICE_PLAYBACK_PATH_SPK}" ]
then
if [ -z "${DEVICE_PLAYBACK_PATH}" ]
then
DEVICE_PLAYBACK_PATH="Playback Path"
fi
amixer cset name="${DEVICE_PLAYBACK_PATH}" ${DEVICE_PLAYBACK_PATH_SPK}
2023-08-07 12:02:33 +00:00
fi
VOLUME=$(get_setting audio.volume)
if [[ -z ${VOLUME} ]]
then
VOLUME="60"
elif [[ -n "${DEVICE_VOLUME}" ]]
then
VOLUME="${DEVICE_VOLUME}"
fi
/usr/bin/volume ${VOLUME}