mpd:PulseAudio 没有音频输出,ALSA 没有混音

Ren*_*nan 6 arch-linux pulseaudio mpd

我正在尝试将 mpd 与 PulseAudio 输出一起使用。因此我写了以下内容/etc/mpd.conf

music_directory "/mnt/dados/Musicas"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/mpd.db"
log_file "~/.mpd/mpd.log"
pid_file "~/.mpd/mpd.pid"
state_file "~/.mpd/mpdstate"
user "renan"

audio_output {
   type         "pulse"
   name         "MPD Output"
}

mixer_type         "software"
Run Code Online (Sandbox Code Playgroud)

mpd 以用户身份运行renan。但是,我没有输出;出现在 mpd.log 中:

Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused
Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused
Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused
Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused
Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused
Feb 15 20:24 : output: Failed to enable "MPD Output" [pulse]: pa_context_connect() has failed: Connection refused
Run Code Online (Sandbox Code Playgroud)

如果我尝试通过将下面的行添加到 ALSA 中/etc/mpd.confmpd可以工作,但它会阻止音频设备:如果我打开任何其他播放声音的软件,它将无法播放声音,反之亦然。

audio_output {
   type         "alsa"
   name         "My ALSA Device"
   device         "hw:0,0"  
   format         "44100:16:2"   
}
Run Code Online (Sandbox Code Playgroud)

我系统的其余部分通过 PulseAudio 输出音频没有问题。我究竟做错了什么?

我运行 x64 Arch Linux 并安装了以下 MPD/PulseAudio 相关软件包:

lib32-libpulse 3.0-1
libmpd 11.8.17-1
libmpdclient 2.7-1
libpulse 3.0-2
mpd 0.17.3-1
mpdscribble 0.22-6
pulseaudio 3.0-2
pulseaudio-alsa 2-2
python2-mpd 0.3.0-4
Run Code Online (Sandbox Code Playgroud)

Ren*_*nan 7

显然,自从迁移到 systemd 以来,这是一个已知问题。通过编辑/usr/lib/systemd/system/mpd.service文件并添加行来解决

[Service]
User=renan
PAMName=system-local-login
Run Code Online (Sandbox Code Playgroud)

(替换renan为您的用户名)

然后,如果它有效,它应该出现在 PulseAudio 混音器中,并使用您在配置文件中指定的名称:

在此处输入图片说明