[英]How to detect processes that are using the sound card on Linux?
我想知道是否有可能獲得在特定時間使用聲卡的進程。 例如,我只想知道當前是否有任何歌曲在 Spotify 或 Chrome 中播放,等等。 先感謝您。
As far as I am aware, a Linux application could be using via PulseAudio or directly accessing ALSA (Advanced Linux Sound Architecture) which forms the foundation of Linux Sound Architecture.
要查看使用 ALSA 的進程,請以 root 身份使用以下命令lsof /dev/snd/*
您將主要看到 pulseaudio 正在使用這些。 現在,通過 PulseAudio 查看使用聲音設備的應用程序
pacmd
>>> list-clients
這應該會給你一個訪問pulseaudio的應用程序列表,並且進程ID應該在那里可見。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.