distribution/packages/jelos/autostart/005-audio
fewtarius 165f994bc1
* Rework profile bits so they are correctly named and sequenced.
* Drop deprecated device.config from AMD64.
* Add a platform quirk for AMD64.x
2023-09-04 10:46:11 +00:00

43 lines
1,002 B
Bash
Executable file

#!/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/001-functions
. /storage/.config/profile.d/001-deviceconfig
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
### 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 -c 0 cset name="${DEVICE_PLAYBACK_PATH}" ${DEVICE_PLAYBACK_PATH_SPK}
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}