Fixed pipewire audio on RGB10 Max 3.

This commit is contained in:
fewtarius 2023-08-08 15:59:42 +00:00
parent 92182ace56
commit 9696ca57d7
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
4 changed files with 9 additions and 274 deletions

View file

@ -9,6 +9,7 @@ DEVICE_POWER_LED=false
DEVICE_PLAYBACK_PATH_SPK="HP"
DEVICE_PLAYBACK_PATH_HP="SPK"
DEVICE_BRIGHTNESS="128"
DEVICE_PIPEWIRE_PROFILE="pro-audio"
DEVICE_BATTERY_LED_STATUS=true
UI_SERVICE="weston.service"

View file

@ -1,274 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /etc/profile
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 {
type plug
slave.pcm "dmixer"
}
pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
period_time 0
period_size 4096
buffer_size 131072
rate 96000
}
bindings {
0 0
1 1
}
}
EOF
if [ ! -e "/storage/.config/asound.state" ]
then
cat <<EOF >/storage/.config/asound.state
state.Ultra {
control.1 {
iface MIXER
name 'Master Playback Volume'
value.0 223
value.1 223
comment {
access 'read write'
type INTEGER
count 2
range '0 - 252'
dbmin -9500
dbmax 0
dbvalue.0 -1094
dbvalue.1 -1094
}
}
control.2 {
iface MIXER
name 'Master Capture Volume'
value.0 226
value.1 226
comment {
access 'read write'
type INTEGER
count 2
range '0 - 255'
dbmin -9500
dbmax 0
dbvalue.0 -1081
dbvalue.1 -1081
}
}
control.3 {
iface MIXER
name 'Mic Capture Gain'
value.0 6
value.1 6
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
dbmin -1800
dbmax 2700
dbvalue.0 0
dbvalue.1 0
}
}
control.4 {
iface MIXER
name 'TDMOUT_B Lane 0 Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 255'
}
}
control.5 {
iface MIXER
name 'TDMOUT_B Lane 1 Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 255'
}
}
control.6 {
iface MIXER
name 'TDMOUT_B Lane 2 Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 255'
}
}
control.7 {
iface MIXER
name 'TDMOUT_B Lane 3 Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 255'
}
}
control.8 {
iface MIXER
name 'TDMOUT_B Gain Enable Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.9 {
iface MIXER
name 'FRDDR_A SRC 1 EN Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.10 {
iface MIXER
name 'FRDDR_A SRC 2 EN Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.11 {
iface MIXER
name 'FRDDR_A SRC 3 EN Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.12 {
iface MIXER
name 'FRDDR_A SINK 1 SEL'
value 'OUT 1'
comment {
access 'read write'
type ENUMERATED
count 1
item.0 'OUT 0'
item.1 'OUT 1'
item.2 'OUT 2'
item.3 'OUT 3'
item.4 'OUT 4'
item.5 'OUT 5'
item.6 'OUT 6'
item.7 'OUT 7'
}
}
control.13 {
iface MIXER
name 'FRDDR_A SINK 2 SEL'
value 'OUT 0'
comment {
access 'read write'
type ENUMERATED
count 1
item.0 'OUT 0'
item.1 'OUT 1'
item.2 'OUT 2'
item.3 'OUT 3'
item.4 'OUT 4'
item.5 'OUT 5'
item.6 'OUT 6'
item.7 'OUT 7'
}
}
control.14 {
iface MIXER
name 'FRDDR_A SINK 3 SEL'
value 'OUT 0'
comment {
access 'read write'
type ENUMERATED
count 1
item.0 'OUT 0'
item.1 'OUT 1'
item.2 'OUT 2'
item.3 'OUT 3'
item.4 'OUT 4'
item.5 'OUT 5'
item.6 'OUT 6'
item.7 'OUT 7'
}
}
control.15 {
iface MIXER
name 'Playback Mux'
value HP
comment {
access 'read write'
type ENUMERATED
count 1
item.0 HP
item.1 SPK
}
}
control.16 {
iface MIXER
name 'TDMOUT_B SRC SEL'
value 'IN 0'
comment {
access 'read write'
type ENUMERATED
count 1
item.0 'IN 0'
item.1 'IN 1'
item.2 'IN 2'
}
}
}
EOF
fi
alsactl restore -f /storage/.config/asound.state
amixer sset 'FRDDR_A SINK 1 SEL' 'OUT 1'
amixer sset 'FRDDR_A SRC 1 EN' 'on'
amixer sset 'TDMOUT_B SRC SEL' 'IN 0'
amixer -c0 sset "Playback Mux" "${DEVICE_PLAYBACK_PATH_SPK}"
alsactl store -f /storage/.config/asound.state

View file

@ -26,6 +26,7 @@ export SLOW_CORES \
DEVICE_KEY_VOLUMEDOWN \
DEVICE_KEY_VOLUMEUP \
DEVICE_LED_CONTROL \
DEVICE_PIPEWIRE_PROFILE \
DEVICE_PWR_LED_CONTROL \
DEVICE_PWR_LED_GPIO \
DEVICE_PLAYBACK_PATH_HP \

View file

@ -13,7 +13,9 @@ then
systemctl start pipewire-pulse
fi
DEFAULT_ID=$(pactl list short cards | awk '! /hdmi/ {print $1; exit}')
DEFAULT_SINK=$(pactl list short sinks | awk '! /hdmi/ {print $2; exit}')
if [ ! -z "${DEFAULT_SINK}" ]
then
### Set the default sink ignoring HDMI
@ -21,6 +23,11 @@ then
pactl set-default-source ${DEFAULT_SINK}.monitor
fi
if [ ! -z "${DEVICE_PIPEWIRE_PROFILE}" ]
then
pactl set-card-profile ${DEFAULT_ID} ${DEVICE_PIPEWIRE_PROFILE}
fi
### Set the default audio path, needed for some devices
if [ ! -z "${DEVICE_PLAYBACK_PATH_SPK}" ]
then