I start PulseAudio like this:
sudo -u lightdm /usr/bin/pulseaudio --daemonize=yes --log-target=journal
with the intention to use it with mopidy.service:
[Unit]
Description=Mopidy music server
After=avahi-daemon.service
After=dbus.service
After=network-online.target
Wants=network-online.target
After=nss-lookup.target
After=pulseaudio.service
After=remote-fs.target
After=sound.target
[Service]
User=mopidy
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/cache/mopidy
ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy
ExecStart=/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf
[Install]
WantedBy=multi-user.target
and mopidy.service does use it; stoping lightdm-pulseaudio determines errors in mopidy's log, restoring lightdm-pulseaudio get mopidy back on track so clearly mopidy "picks" it.
The problem is that with lightdm there's no useful sink available:
$sudo -u lightdm pacmd list-sinks
1 sink(s) available.
* index: 0
name: <auto_null>
driver: <module-null-sink.c>
flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: RUNNING
suspend cause: (none)
priority: 1000
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 67.98 ms
max request: 16 KiB
max rewind: 16 KiB
monitor source: 0
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 1
linked by: 1
configured latency: 90.00 ms; range is 0.50 .. 2000.00 ms
module: 15
properties:
device.description = "Dummy Output"
device.class = "abstract"
device.icon_name = "audio-card"
But sinks are available, e.g.:
$pactl list short sinks
PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
xcb_connection_has_error() returned true
348 alsa_output.pci-0000_00_1f.3.iec958-stereo.6 PipeWire s32le 2ch 48000Hz SUSPENDED
System: Ubuntu 23.04
I know that others, e.g. HDMI, exist too, but I would like to use the optical one anyway. What should I do to use the optical sink (i.e. device=iec958:CARD=PCH,DEV=0) with lightdm-pulseaudio?