You are not logged in.
I have an external DAC (Schiit Modi 3) which is connected to my motherboard via an optical output (S/PDIF, TOSLINK). Additionally, I have external speakres that are connected to my motherboard directly via a 3.5mm jack (bypassing the DAC). I use pipewire and WirePlumber for my audio.
Originally, my DAC was connected to the PC via a USB cable, but because of a faulty power circuit in Schiit Modi DACs (faulty power delivery to USB chip - you need to "warm up" your device for up to 40 minutes before the USB starts working and the OS recognizes it) I was forced to switch to a TOSLINK cable, which bypasses the USB chip and in turn bypasses the issue. However, after doing so, I could no longer switch my audio output between my speakers (3.5mm analog jack) and my DAC (TOSLINK S/PDIF).
Previously, I used wpctl to switch my audio sink, as the DAC and the speakers had each a dedicated sink. It was very simple: find the ID of the sink with wpctl status and then change the default sink to that ID:
$ wpctl status
$ wpctl set-default <sink-id>However, after changing the cable, this was no longer possible, as I only had one sink to select. The solution to this problem is the purpose of this thread: I found that with the TOSLINK S/PDIF cable, the sink stays the same, but the device profile has to be toggled instead. Full solution is further down in the thread.
----------------
Original post
The following packages are installed on my system.
$ sudo pacman -Q | grep -E -i -w 'alsa|pipewire'
alsa-card-profiles 1:1.0.3-1
alsa-lib 1.2.11-1
alsa-topology-conf 1.2.5.1-3
alsa-ucm-conf 1.2.11-1
gst-plugin-pipewire 1:1.0.3-1
pipewire 1:1.0.3-1
pipewire-alsa 1:1.0.3-1
pipewire-audio 1:1.0.3-1
pipewire-jack 1:1.0.3-1
pipewire-pulse 1:1.0.3-1From what I can tell, the S/PDIF device is not detected by my system altogether, as it is missing in lspci:
$ lspci| grep "Audio device"
2d:00.1 Audio device: NVIDIA Corporation GA102 High Definition Audio Controller (rev a1)
2f:00.4 Audio device: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio ControllerThis is the result of wpctl status:
$ wpctl status
PipeWire 'pipewire-0' [1.0.3, nost@kingsparrow, cookie:1881258435]
└─ Clients:
31. pipewire [1.0.3, nost@kingsparrow, pid:723]
33. WirePlumber [1.0.3, nost@kingsparrow, pid:722]
34. WirePlumber [export] [1.0.3, nost@kingsparrow, pid:722]
55. polybar [1.0.3, nost@kingsparrow, pid:809]
56. polybar [1.0.3, nost@kingsparrow, pid:812]
57. polybar [1.0.3, nost@kingsparrow, pid:803]
58. polybar [1.0.3, nost@kingsparrow, pid:806]
59. Chrome input [1.0.3, nost@kingsparrow, pid:799]
60. xdg-desktop-portal [1.0.3, nost@kingsparrow, pid:1061]
61. wpctl [1.0.3, nost@kingsparrow, pid:3096]
Audio
├─ Devices:
│ 49. Starship/Matisse HD Audio Controller (X570-A PRO motherboard) [alsa]
│ 51. GA102 High Definition Audio Controller [alsa]
│
├─ Sinks:
│ * 32. Starship/Matisse HD Audio Controller (X570-A PRO motherboard) Analog Stereo [vol: 0.40]
│ 53. GA102 High Definition Audio Controller Digital Stereo (HDMI) [vol: 0.40]
│
├─ Sink endpoints:
│
├─ Sources:
│ 54. Starship/Matisse HD Audio Controller (X570-A PRO motherboard) Analog Stereo [vol: 1.00]
│
├─ Source endpoints:
│
└─ Streams:What are my next steps to make my setup work on Arch?
Last edited by n0stalghia (2024-03-12 17:44:14)
Offline
pactl list cardsyou should have profiles exposing the spdif sink you can select.
Last edited by V1del (2024-03-12 13:54:38)
Offline
This was a fantastic reply. Just three words, and yet somehow you managed to steer me in the correct direction and that allowed me to solve my problem. Amazing efficiency ![]()
EDIT: You now added a bit more on profiles, your hunch is indeed correct, that was the solution.
So, for whoever is reading along, here's what I found after running the command:
$ pactl list cards
Card #41
Name: alsa_card.pci-0000_2d_00.1
Driver: alsa
Owner Module: n/a
Properties:
api.acp.auto-port = "false"
api.acp.auto-profile = "false"
api.alsa.card = "0"
api.alsa.card.longname = "HDA NVidia at 0xfc080000 irq 147"
api.alsa.card.name = "HDA NVidia"
api.alsa.path = "hw:0"
api.alsa.use-acp = "true"
api.dbus.ReserveDevice1 = "Audio0"
device.api = "alsa"
device.bus = "pci"
device.bus_path = "pci-0000:2d:00.1"
device.description = "GA102 High Definition Audio Controller"
device.enum.api = "udev"
device.icon_name = "audio-card-analog-pci"
device.name = "alsa_card.pci-0000_2d_00.1"
device.nick = "HDA NVidia"
device.plugged.usec = "3130035"
device.product.id = "0x1aef"
device.product.name = "GA102 High Definition Audio Controller"
device.subsystem = "sound"
sysfs.path = "/devices/pci0000:00/0000:00:03.1/0000:2d:00.1/sound/card0"
device.vendor.id = "0x10de"
device.vendor.name = "NVIDIA Corporation"
media.class = "Audio/Device"
factory.id = "14"
client.id = "34"
object.id = "41"
object.serial = "41"
object.path = "alsa:pcm:0"
alsa.card = "0"
alsa.card_name = "HDA NVidia"
alsa.long_card_name = "HDA NVidia at 0xfc080000 irq 147"
alsa.driver_name = "snd_hda_intel"
device.string = "0"
Profiles:
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
output:hdmi-stereo: Digital Stereo (HDMI) Output (sinks: 1, sources: 0, priority: 5900, available: yes)
output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (sinks: 1, sources: 0, priority: 5700, available: yes)
output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (sinks: 1, sources: 0, priority: 5700, available: no)
output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (sinks: 1, sources: 0, priority: 5700, available: no)
output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (sinks: 1, sources: 0, priority: 600, available: no)
output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (sinks: 1, sources: 0, priority: 600, available: no)
output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (sinks: 1, sources: 0, priority: 600, available: no)
output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (sinks: 1, sources: 0, priority: 600, available: no)
pro-audio: Pro Audio (sinks: 4, sources: 0, priority: 1, available: yes)
Active Profile: output:hdmi-stereo
Ports:
hdmi-output-0: HDMI / DisplayPort (type: HDMI, priority: 5900, latency offset: 0 usec, availability group: Legacy 1, available)
Properties:
port.type = "hdmi"
port.availability-group = "Legacy 1"
device.icon_name = "video-display"
card.profile.port = "0"
device.product.name = "27GL850
"
Part of profile(s): output:hdmi-stereo
hdmi-output-1: HDMI / DisplayPort 2 (type: HDMI, priority: 5800, latency offset: 0 usec, availability group: Legacy 2, available)
Properties:
port.type = "hdmi"
port.availability-group = "Legacy 2"
device.icon_name = "video-display"
card.profile.port = "1"
device.product.name = "MSI MP271Q
"
Part of profile(s): output:hdmi-stereo-extra1
hdmi-output-2: HDMI / DisplayPort 3 (type: HDMI, priority: 5700, latency offset: 0 usec, availability group: Legacy 3, not available)
Properties:
port.type = "hdmi"
port.availability-group = "Legacy 3"
device.icon_name = "video-display"
card.profile.port = "2"
Part of profile(s): output:hdmi-stereo-extra2, output:hdmi-surround-extra2, output:hdmi-surround71-extra2
hdmi-output-3: HDMI / DisplayPort 4 (type: HDMI, priority: 5600, latency offset: 0 usec, availability group: Legacy 4, not available)
Properties:
port.type = "hdmi"
port.availability-group = "Legacy 4"
device.icon_name = "video-display"
card.profile.port = "3"
Part of profile(s): output:hdmi-stereo-extra3, output:hdmi-surround-extra3, output:hdmi-surround71-extra3
Card #42
Name: alsa_card.pci-0000_2f_00.4
Driver: alsa
Owner Module: n/a
Properties:
api.acp.auto-port = "false"
api.acp.auto-profile = "false"
api.alsa.card = "1"
api.alsa.card.longname = "HD-Audio Generic at 0xfca00000 irq 149"
api.alsa.card.name = "HD-Audio Generic"
api.alsa.path = "hw:1"
api.alsa.use-acp = "true"
api.dbus.ReserveDevice1 = "Audio1"
device.api = "alsa"
device.bus = "pci"
device.bus_path = "pci-0000:2f:00.4"
device.description = "Starship/Matisse HD Audio Controller (X570-A PRO motherboard)"
device.enum.api = "udev"
device.icon_name = "audio-card-analog-pci"
device.name = "alsa_card.pci-0000_2f_00.4"
device.nick = "HD-Audio Generic"
device.plugged.usec = "3308359"
device.product.id = "0x1487"
device.product.name = "Starship/Matisse HD Audio Controller (X570-A PRO motherboard)"
device.subsystem = "sound"
sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:2f:00.4/sound/card1"
device.vendor.id = "0x1022"
device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
media.class = "Audio/Device"
factory.id = "14"
client.id = "34"
object.id = "42"
object.serial = "42"
object.path = "alsa:pcm:1"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfca00000 irq 149"
alsa.driver_name = "snd_hda_intel"
device.string = "1"
Profiles:
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (sinks: 1, sources: 1, priority: 6565, available: yes)
output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority: 6500, available: yes)
output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 5565, available: yes)
output:iec958-stereo: Digital Stereo (IEC958) Output (sinks: 1, sources: 0, priority: 5500, available: yes)
output:analog-surround-21+input:analog-stereo: Analog Surround 2.1 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 1365, available: yes)
output:analog-surround-41+input:analog-stereo: Analog Surround 4.1 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 1365, available: yes)
output:analog-surround-51+input:analog-stereo: Analog Surround 5.1 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 1365, available: yes)
output:analog-surround-21: Analog Surround 2.1 Output (sinks: 1, sources: 0, priority: 1300, available: yes)
output:analog-surround-41: Analog Surround 4.1 Output (sinks: 1, sources: 0, priority: 1300, available: yes)
output:analog-surround-51: Analog Surround 5.1 Output (sinks: 1, sources: 0, priority: 1300, available: yes)
output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 1265, available: yes)
output:analog-surround-50+input:analog-stereo: Analog Surround 5.0 Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 1265, available: yes)
output:analog-surround-40: Analog Surround 4.0 Output (sinks: 1, sources: 0, priority: 1200, available: yes)
output:analog-surround-50: Analog Surround 5.0 Output (sinks: 1, sources: 0, priority: 1200, available: yes)
input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority: 65, available: no)
pro-audio: Pro Audio (sinks: 2, sources: 2, priority: 1, available: yes)
Active Profile: output:analog-stereo+input:analog-stereo
Ports:
analog-input-front-mic: Front Microphone (type: Mic, priority: 8500, latency offset: 0 usec, availability group: Legacy 1, not available)
Properties:
port.type = "mic"
port.availability-group = "Legacy 1"
device.icon_name = "audio-input-microphone"
card.profile.port = "0"
Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analog-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo
analog-input-rear-mic: Rear Microphone (type: Mic, priority: 8200, latency offset: 0 usec, availability group: Legacy 2, not available)
Properties:
port.type = "mic"
port.availability-group = "Legacy 2"
device.icon_name = "audio-input-microphone"
card.profile.port = "1"
Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analog-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo
analog-input-linein: Line In (type: Line, priority: 8100, latency offset: 0 usec, availability group: Legacy 3, not available)
Properties:
port.type = "line"
port.availability-group = "Legacy 3"
card.profile.port = "2"
Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analog-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo
analog-output-lineout: Line Out (type: Line, priority: 9000, latency offset: 0 usec, availability group: Legacy 4, available)
Properties:
port.type = "line"
port.availability-group = "Legacy 4"
card.profile.port = "3"
Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21, output:analog-surround-21+input:analog-stereo, output:analog-surround-40, output:analog-surround-40+input:analog-stereo, output:analog-surround-41, output:analog-surround-41+input:analog-stereo, output:analog-surround-50, output:analog-surround-50+input:analog-stereo, output:analog-surround-51, output:analog-surround-51+input:analog-stereo
analog-output-headphones: Headphones (type: Headphones, priority: 9900, latency offset: 0 usec, availability group: Legacy 5, not available)
Properties:
port.type = "headphones"
port.availability-group = "Legacy 5"
device.icon_name = "audio-headphones"
card.profile.port = "4"
Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo
iec958-stereo-output: Digital Output (S/PDIF) (type: SPDIF, priority: 0, latency offset: 0 usec, availability unknown)
Properties:
port.type = "spdif"
card.profile.port = "5"
Part of profile(s): output:iec958-stereo, output:iec958-stereo+input:analog-stereoAs we can see, S/PDIF is detected here, but as a profile, not a different sink. With that, I was able to Google my issue with consiser terms. Furthermore, I saw a suggestion to try and verify that everything works correctly with the pavucontrol GUI before attempting to configure it via the CLI. So I installed pavucontrol for debugging purposes and found out that I can get the desired effect (audio switches from one 3.5mm jack to TOSLINK) if I change the configuration of "Starship/Matisse HD Audio Controller (X570-A Pro motherboard)" from the profile analog-stereo to iec958-stereo:
$ wpctl status
PipeWire 'pipewire-0' [1.0.3, nost@kingsparrow, cookie:333594734]
└─ Clients:
31. pipewire [1.0.3, nost@kingsparrow, pid:695]
33. WirePlumber [1.0.3, nost@kingsparrow, pid:693]
34. WirePlumber [export] [1.0.3, nost@kingsparrow, pid:693]
55. polybar [1.0.3, nost@kingsparrow, pid:780]
56. polybar [1.0.3, nost@kingsparrow, pid:774]
57. polybar [1.0.3, nost@kingsparrow, pid:783]
58. polybar [1.0.3, nost@kingsparrow, pid:777]
59. Chrome input [1.0.3, nost@kingsparrow, pid:770]
60. xdg-desktop-portal [1.0.3, nost@kingsparrow, pid:1027]
61. ALSA plug-in [plexamp] [1.0.3, nost@kingsparrow, pid:60]
67. ALSA plug-in [plexamp] [1.0.3, nost@kingsparrow, pid:60]
68. PulseAudio Volume Control [1.0.3, nost@kingsparrow, pid:2525]
69. pavucontrol [1.0.3, nost@kingsparrow, pid:2525]
90. wpctl [1.0.3, nost@kingsparrow, pid:4788]
Audio
├─ Devices:
│ 41. GA102 High Definition Audio Controller [alsa]
│ 42. Starship/Matisse HD Audio Controller (X570-A PRO motherboard) [alsa]
│
├─ Sinks:
│ 47. GA102 High Definition Audio Controller Digital Stereo (HDMI) [vol: 0.40]
│ * 65. Starship/Matisse HD Audio Controller (X570-A PRO motherboard) Analog Stereo [vol: 1.00]
$ wpctl inspect 65 | grep profile
card.profile.device = "11"
device.profile.description = "Digital Stereo (IEC958)"
device.profile.name = "iec958-stereo"< manually change Profile in Pavucontrol using the GUI and run the commands in the terminal again >
$ wpctl status
PipeWire 'pipewire-0' [1.0.3, nost@kingsparrow, cookie:333594734]
└─ Clients:
31. pipewire [1.0.3, nost@kingsparrow, pid:695]
33. WirePlumber [1.0.3, nost@kingsparrow, pid:693]
34. WirePlumber [export] [1.0.3, nost@kingsparrow, pid:693]
55. polybar [1.0.3, nost@kingsparrow, pid:780]
56. polybar [1.0.3, nost@kingsparrow, pid:774]
57. polybar [1.0.3, nost@kingsparrow, pid:783]
58. polybar [1.0.3, nost@kingsparrow, pid:777]
59. Chrome input [1.0.3, nost@kingsparrow, pid:770]
60. xdg-desktop-portal [1.0.3, nost@kingsparrow, pid:1027]
61. ALSA plug-in [plexamp] [1.0.3, nost@kingsparrow, pid:60]
67. ALSA plug-in [plexamp] [1.0.3, nost@kingsparrow, pid:60]
68. PulseAudio Volume Control [1.0.3, nost@kingsparrow, pid:2525]
69. pavucontrol [1.0.3, nost@kingsparrow, pid:2525]
90. wpctl [1.0.3, nost@kingsparrow, pid:4709]
Audio
├─ Devices:
│ 41. GA102 High Definition Audio Controller [alsa]
│ 42. Starship/Matisse HD Audio Controller (X570-A PRO motherboard) [alsa]
│
├─ Sinks:
│ 47. GA102 High Definition Audio Controller Digital Stereo (HDMI) [vol: 0.40]
│ * 65. Starship/Matisse HD Audio Controller (X570-A PRO motherboard) Digital Stereo (IEC958) [vol: 0.40]
$ wpctl inspect 65 | grep profile
card.profile.device = "5"
device.profile.description = "Analog Stereo"
device.profile.name = "analog-stereo"Okay, so it works via the GUI and we found out that in this case, the sink stays the same, but the profile of the device changes from output:analog-stereo to output:iec958-stereo. The question now becomes: how can we change this via CLI instead of GUI?
First, I found the correct card name using pactl:
$ pactl list cards | grep card
Name: alsa_card.pci-0000_2d_00.1
api.alsa.card = "0"
api.alsa.card.longname = "HDA NVidia at 0xfc080000 irq 147"
api.alsa.card.name = "HDA NVidia"
device.icon_name = "audio-card-analog-pci"
device.name = "alsa_card.pci-0000_2d_00.1"
sysfs.path = "/devices/pci0000:00/0000:00:03.1/0000:2d:00.1/sound/card0"
alsa.card = "0"
alsa.card_name = "HDA NVidia"
alsa.long_card_name = "HDA NVidia at 0xfc080000 irq 147"
card.profile.port = "0"
card.profile.port = "1"
card.profile.port = "2"
card.profile.port = "3"
Name: alsa_card.pci-0000_2f_00.4
api.alsa.card = "1"
api.alsa.card.longname = "HD-Audio Generic at 0xfca00000 irq 149"
api.alsa.card.name = "HD-Audio Generic"
device.icon_name = "audio-card-analog-pci"
device.name = "alsa_card.pci-0000_2f_00.4"
sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:2f:00.4/sound/card1"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfca00000 irq 149"
card.profile.port = "0"
card.profile.port = "1"
card.profile.port = "2"
card.profile.port = "3"
card.profile.port = "4"
card.profile.port = "5"So the correct name is
alsa_card.pci-0000_2f_00.4Now, what are the correct profile names? They are are listed in
$ pactl list cardsas well, and in my case, they are output:iec958-stereo and output:analog-stereo. How to change the output from CLI, then? After Googling:
$ pactl set-card-profile alsa_card.pci-0000_2f_00.4 output:iec958-stereo
$ pactl set-card-profile alsa_card.pci-0000_2f_00.4 output:analog-stereoHowever, from what I can find, pactl is a compatibility layer for pipewire-pulse, so I'd prefer a completely native solution. The wiki has a guide on how to do this: Pipewire Wiki's Pulseaudio to Pipewire migration guide helps here, and this is the native solution:
$ pw-cli s 42 Profile '{ index: 2, save: true }'
$ pw-cli s 42 Profile '{ index: 4, save: true }'Last edited by n0stalghia (2024-03-12 19:03:10)
Offline
In case someone wants to write a routine to toggle between the two with an execution of a shell script, here's my attempt. Fairly sure it could be improved, I'm not good in bash whatsoever.
#!/bin/bash
# This script toggles between two different profiles of the same output sink
# It uses pipewire command line interface
output=$(pw-cli ls Device)
# Initialize an array to store output strings
declare -a devices
declare device
# Split devies into an array
while IFS= read -r block; do
if [[ $block =~ id\ [0-9]+, ]]; then
devices+=("$block")
else
devices[-1]+=$'\n'"$block"
fi
done < <(echo "$output")
# Iterate through the array
for block in "${devices[@]}"; do
# Find sound controller
if echo $block | grep -q "Starship/Matisse HD Audio Controller (X570-A PRO motherboard)"; then
device=$block
fi
done
card_id=$(echo "$device" | grep "object.serial" | sed 's/[^0-9]*//g')
declare -a profiles
declare analog_stereo_profile
declare iec958_stereo_profile
# Split the profiles into an array
while IFS= read -r block; do
if [[ $block =~ Object:\ size\ [0-9]+, ]]; then
profiles+=("$block")
else
profiles[-1]+=$'\n'"$block"
fi
done < <(pw-cli e $card_id EnumProfile)
# Iterate through profiles, find our two stereo profiles
for block in "${profiles[@]}"; do
if echo $block | grep -q "\"output:analog-stereo\""; then
analog_stereo_profile=$block
fi
if echo $block | grep -q "\"output:iec958-stereo\""; then
iec958_stereo_profile=$block
fi
done
analog_stereo_id=$(echo "$analog_stereo_profile" | grep "index" -A 1 | grep "Int" | sed 's/[^0-9]*//g')
iec958_stereo_id=$(echo "$iec958_stereo_profile" | grep "index" -A 1 | grep "Int" | sed 's/[^0-9]*//g')
# Find current sink name and ID
sink=$(wpctl status | awk '/Sinks/,0' | grep "Starship/Matisse HD Audio Controller (X570-A PRO motherboard)")
sink_id=${sink:8:2}
# Toggle between the two stereo profiles
if [[ $sink == *"Analog Stereo"* ]]; then
pw-cli s $card_id Profile "{ index: $iec958_stereo_id, save: true }" >/dev/null
wpctl set-default "${sink_id}"
else
pw-cli s $card_id Profile "{ index: $analog_stereo_id, save: true }" >/dev/null
wpctl set-default "${sink_id}"
fiGood luck!
Last edited by n0stalghia (2024-04-24 15:50:43)
Offline
Good stuff ![]()
Yeah I was like maybe that's a bit too terse of an information if you're not aware to look for card profiles so I added that blurb, but good job on digging yourself into the relevant rabbit hole to write something to toggle. Depending on if the digital and analog ports are sufficiently distinct, an "easier" alternative would be to create an additional profile merging the optical and analog sinks (create a relevant config with the examples in /usr/share/alsa-card-profiles and refer to that via udev rules bending your usb device to use that)
Please mark the topic as [SOLVED] by editing the title in your first post.
Offline
Good stuff
Yeah I was like maybe that's a bit too terse of an information if you're not aware to look for card profiles so I added that blurb, but good job on digging yourself into the relevant rabbit hole to write something to toggle. Depending on if the digital and analog ports are sufficiently distinct, an "easier" alternative would be to create an additional profile merging the optical and analog sinks (create a relevant config with the examples in /usr/share/alsa-card-profiles and refer to that via udev rules bending your usb device to use that)
Please mark the topic as [SOLVED] by editing the title in your first post.
Thanks, I'll look into that someday! And don't worry, it was perfect, I learned a ton in the process. I've rewritten the OP a little bit to give more context to people who are searching for answers.
Offline
Update: After today, changing the profile with
pw-cli s $card_id Profile "{ index: $iec958_stereo_id, save: true }"for some reason now also changes the sink. Maybe a bug in a package, or maybe some setting got changed, or maybe my audio profiles reset somehow. In any case, now the script should explicitly set not only the profile, but also the sink (using wpctl). I've edited my solution with the updated code.
Last edited by n0stalghia (2024-04-24 15:51:00)
Offline