Arch-Linux

mpd:PulseAudio 無音頻輸出,ALSA 無混音

  • March 7, 2013

我正在嘗試將 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 來使用 ALSA,/etc/mpd.conf那麼mpd它可以工作,但它會阻止音頻設備:如果我打開任何其他播放聲音的軟體,它將無法播放聲音,反之亦然。

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

顯然,自從遷移到 systemd 以來,這是一個已知問題。通過編輯/usr/lib/systemd/system/mpd.service文件並添加行來解決

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

(替換renan為您的使用者名)

然後,如果它工作,它應該出現在 PulseAudio 混音器中,名稱與您在配置文件中給出的名稱相同:

在此處輸入圖像描述

使用者“renan”必須是組“audio”的成員。做

$ sudo usermod -a -G audio renan

引用自:https://unix.stackexchange.com/questions/64914