在Linux上使麦克风静音时收听

问题描述 投票:0回答:1

我正在用Python开发一个可显示麦克风当前状态(静音/打开)的Ubuntu AppIndicator。

我能够在我的Python脚本中使麦克风静音/取消静音,但是当麦克风在我的应用程序之外被静音时(例如,在Ubuntu声音设置中),我还需要收听Linux事件以更新指示器图标。 。

在Linux上有没有办法监听“麦克风静音”事件?

python linux audio microphone appindicator
1个回答
0
投票

一种方法是使用pacmd轮询状态:

pacmd list-sinks | grep muted

如果使用Pulseaudio,则将其包装在名为pulsectl的库中。

© www.soinside.com 2019 - 2024. All rights reserved.