Continued work on pipewire integration.
This commit is contained in:
parent
19b4ac947a
commit
1b20be1589
10 changed files with 79 additions and 8 deletions
|
@ -4,9 +4,20 @@
|
|||
|
||||
. /etc/profile
|
||||
|
||||
### Set a custom device so we don't clobber it.
|
||||
set-audio set "CUSTOM (UNMANAGED)"
|
||||
set-audio esset "DAC"
|
||||
ES_SETTINGS="/storage/.config/emulationstation/es_settings.cfg"
|
||||
|
||||
function set_es_path() {
|
||||
AUDIODEVICE=${1}
|
||||
sed -i '/^.*<string name="AudioDevice".*$/d' ${ES_SETTINGS}
|
||||
if [ -e "/storage/.config/profile.d/99-mixer" ]
|
||||
then
|
||||
rm "/storage/.config/profile.d/99-mixer"
|
||||
fi
|
||||
sed -i '/^.*AudioCard.*$/a \\t<string name="AudioDevice" value="'"${AUDIODEVICE}"'" \/>' ${ES_SETTINGS}
|
||||
echo "DEVICE_AUDIO_MIXER=\"${AUDIODEVICE}\"" >/storage/.config/profile.d/99-mixer
|
||||
}
|
||||
|
||||
set_es_path "DAC"
|
||||
|
||||
cat <<EOF >/storage/.config/asound.conf
|
||||
pcm.!default {
|
||||
|
|
|
@ -4,9 +4,20 @@
|
|||
|
||||
. /etc/profile
|
||||
|
||||
### Set a custom device so we don't clobber it.
|
||||
set-audio set "CUSTOM (UNMANAGED)"
|
||||
set-audio esset "Master"
|
||||
ES_SETTINGS="/storage/.config/emulationstation/es_settings.cfg"
|
||||
|
||||
function set_es_path() {
|
||||
AUDIODEVICE=${1}
|
||||
sed -i '/^.*<string name="AudioDevice".*$/d' ${ES_SETTINGS}
|
||||
if [ -e "/storage/.config/profile.d/99-mixer" ]
|
||||
then
|
||||
rm "/storage/.config/profile.d/99-mixer"
|
||||
fi
|
||||
sed -i '/^.*AudioCard.*$/a \\t<string name="AudioDevice" value="'"${AUDIODEVICE}"'" \/>' ${ES_SETTINGS}
|
||||
echo "DEVICE_AUDIO_MIXER=\"${AUDIODEVICE}\"" >/storage/.config/profile.d/99-mixer
|
||||
}
|
||||
|
||||
set_es_path "Master"
|
||||
|
||||
cat <<EOF >/storage/.config/asound.conf
|
||||
pcm.!default {
|
||||
|
|
|
@ -7,8 +7,8 @@ cat <<EOF >/storage/.config/profile.d/001-deviceconfig
|
|||
DEVICE_FAKE_JACKSENSE=false
|
||||
DEVICE_VOLUMECTL=true
|
||||
DEVICE_POWER_LED=false
|
||||
DEVICE_PLAYBACK_PATH_SPK="SPK"
|
||||
DEVICE_PLAYBACK_PATH_HP="HP"
|
||||
DEVICE_PLAYBACK_PATH_SPK="HP"
|
||||
DEVICE_PLAYBACK_PATH_HP="SPK"
|
||||
#DEVICE_HEADPHONE_DEV=""
|
||||
DEVICE_BRIGHTNESS="128"
|
||||
UI_SERVICE="emustation.service"
|
||||
|
|
|
@ -13,6 +13,14 @@ then
|
|||
systemctl start pipewire-pulse
|
||||
fi
|
||||
|
||||
DEFAULT_SINK=$(pactl list short sinks | awk '! /hdmi/ {print $2; exit}')
|
||||
if [ ! -z "${DEFAULT_SINK}" ]
|
||||
then
|
||||
### Set the default sink ignoring HDMI
|
||||
pactl set-default-sink ${DEFAULT_SINK}
|
||||
pactl set-default-source ${DEFAULT_SINK}.monitor
|
||||
fi
|
||||
|
||||
### Set the default audio path, needed for some devices
|
||||
if [ ! -z "${DEVICE_PLAYBACK_PATH_SPK}" ]
|
||||
then
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
. /etc/os-release
|
||||
|
||||
export XDG_RUNTIME_DIR=/var/run/0-runtime-dir
|
||||
export PATH="/usr/bin:/usr/local/bin:/storage/bin:${PATH}"
|
||||
export SDL_GAMECONTROLLERCONFIG_FILE="/storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt"
|
||||
|
||||
|
|
|
@ -164,3 +164,19 @@ if [ -e "/storage/.config/flycast/emu.cfg" ]
|
|||
then
|
||||
cp -f /usr/config/flycast/emu.cfg /storage/.config/flycast/emu.cfg
|
||||
fi
|
||||
|
||||
### Set the default output to Master for pipewire
|
||||
ES_SETTINGS="/storage/.config/emulationstation/es_settings.cfg"
|
||||
|
||||
function set_es_path() {
|
||||
AUDIODEVICE=${1}
|
||||
sed -i '/^.*<string name="AudioDevice".*$/d' ${ES_SETTINGS}
|
||||
if [ -e "/storage/.config/profile.d/99-mixer" ]
|
||||
then
|
||||
rm "/storage/.config/profile.d/99-mixer"
|
||||
fi
|
||||
sed -i '/^.*AudioCard.*$/a \\t<string name="AudioDevice" value="'"${AUDIODEVICE}"'" \/>' ${ES_SETTINGS}
|
||||
echo "DEVICE_AUDIO_MIXER=\"${AUDIODEVICE}\"" >/storage/.config/profile.d/99-mixer
|
||||
}
|
||||
|
||||
set_es_path "Master"
|
||||
|
|
|
@ -18,6 +18,7 @@ makeinstall_target() {
|
|||
mkdir -p ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/sources/scripts/fancontrol ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/sources/scripts/headphone_sense ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/sources/scripts/hdmi_sense ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/sources/scripts/volume_sense ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/sources/scripts/bluetooth_sense ${INSTALL}/usr/bin
|
||||
cp ${PKG_DIR}/sources/scripts/ledcontrol ${INSTALL}/usr/bin
|
||||
|
|
21
packages/sysutils/system-utils/sources/scripts/hdmi_sense
Executable file
21
packages/sysutils/system-utils/sources/scripts/hdmi_sense
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2021-present Fewtarius
|
||||
|
||||
# Source predefined functions and variables
|
||||
. /etc/profile
|
||||
|
||||
HDMI_DEVICE="/sys/class/drm/card0/card0-HDMI-A-1"
|
||||
HDMI_STATUS=$(cat ${HDMI_DEVICE}/status)
|
||||
|
||||
case ${HDMI_STATUS} in
|
||||
connected)
|
||||
DEFAULT_SINK=$(pactl list short sinks | awk '/hdmi/ {print $2; exit}')
|
||||
;;
|
||||
*)
|
||||
DEFAULT_SINK=$(pactl list short sinks | awk '! /hdmi/ {print $2; exit}')
|
||||
;;
|
||||
esac
|
||||
|
||||
pactl set-default-sink ${DEFAULT_SINK}
|
1
packages/sysutils/system-utils/udev.d/99-hdmi.rules
Normal file
1
packages/sysutils/system-utils/udev.d/99-hdmi.rules
Normal file
|
@ -0,0 +1 @@
|
|||
KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/bin/hdmi_sense"
|
|
@ -3,6 +3,7 @@ Description=EmulationStation emulator frontend
|
|||
ConditionPathExists=/var/lock/start.games
|
||||
|
||||
[Service]
|
||||
Environment=XDG_RUNTIME_DIR=/var/run/0-runtime-dir
|
||||
Environment=HOME=/storage
|
||||
Environment=SDL_AUDIODRIVER=pulseaudio
|
||||
ExecStartPre=/usr/bin/es_settings
|
||||
|
|
Loading…
Reference in a new issue