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

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

我正在尝试将 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"

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

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

audio_output {
   type         "alsa"
   name         "My ALSA Device"
   device         "hw:0,0"  
   format         "44100:16:2"   
}

我的系统的其余部分通过 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

答案1

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

[Service]
User=renan
PAMName=system-local-login

(替换renan为您的用户名)

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

在此输入图像描述

答案2

用户“renan”必须是组“audio”的成员。做

$ sudo usermod -a -G audio renan

相关内容